0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / StdLDrivers / StdLDrivers.cxx
index 1a2a8ab..03c8bdf 100644 (file)
@@ -1,6 +1,6 @@
 // Created on: 2000-09-07
 // Created by: TURIN Anatoliy
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
+// Copyright (c) 2000-2015 OPEN CASCADE SAS
 //
 // This file is part of Open CASCADE Technology software library.
 //
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#include <StdLDrivers.ixx>
-#include <StdLDrivers_DocumentStorageDriver.hxx>
+#include <StdLDrivers.hxx>
 #include <StdLDrivers_DocumentRetrievalDriver.hxx>
-#include <ShapeSchema.hxx>
-#include <Storage_HArrayOfSchema.hxx>
-#include <StdLSchema.hxx>
+#include <StdLPersistent.hxx>
 
 #include <Standard_Failure.hxx>
 #include <Standard_GUID.hxx>
 #include <Plugin_Macro.hxx>
 
-static Standard_GUID StdLStorageDriver     ("bd696000-5b34-11d1-b5ba-00a0c9064368");
-static Standard_GUID StdLRetrievalDriver   ("bd696001-5b34-11d1-b5ba-00a0c9064368");
-static Standard_GUID StdLSchemaID          ("bd696002-5b34-11d1-b5ba-00a0c9064368");
+#include <PCDM_StorageDriver.hxx>
+#include <TDocStd_Application.hxx>
 
-Handle(Standard_Transient) StdLDrivers::Factory(const Standard_GUID& aGUID) {
+static Standard_GUID StdLRetrievalDriver ("bd696001-5b34-11d1-b5ba-00a0c9064368");
 
-  if(aGUID == StdLSchemaID) {    
+//=======================================================================
+//function : Factory
+//purpose  : Depending from the ID, returns a list of storage
+//           or retrieval attribute drivers. Used for plugin
+//=======================================================================
+Handle(Standard_Transient) StdLDrivers::Factory (const Standard_GUID& aGUID)
+{
+  if (aGUID == StdLRetrievalDriver)
+  {
 #ifdef OCCT_DEBUG
-    cout << "StdLSchema : Plugin" << endl;
+    std::cout << "StdLDrivers : Retrieval Plugin" << std::endl;
 #endif
-    static Handle(StdLSchema) model_ss = new StdLSchema;
-    Handle(ShapeSchema) aSSchema = new ShapeSchema;
-    Handle(Storage_HArrayOfSchema) aSchemas = new Storage_HArrayOfSchema(0,0);
-    aSchemas->SetValue(0, aSSchema);
-    model_ss->SetNestedSchemas(aSchemas);
 
-    return model_ss;
-  }
-
-  if(aGUID == StdLStorageDriver)  {
-#ifdef OCCT_DEBUG
-    cout << "StdLDrivers : Storage Plugin" << endl;
-#endif
-    static Handle(StdLDrivers_DocumentStorageDriver) model_sd = new StdLDrivers_DocumentStorageDriver;
-    return model_sd;
-  }
-  if(aGUID == StdLRetrievalDriver) {  
-#ifdef OCCT_DEBUG
-    cout << "StdLDrivers : Retrieval Plugin" << endl;
-#endif
     static Handle(StdLDrivers_DocumentRetrievalDriver) model_rd = new StdLDrivers_DocumentRetrievalDriver;
     return model_rd;
   }
  
-  Standard_Failure::Raise ("StdLDrivers : unknown GUID");
-  Handle(Standard_Transient) t;
-  return t;
+  throw Standard_Failure("StdLDrivers : unknown GUID");
 }
 
-#ifdef _MSC_VER
-#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
-#endif
+//=======================================================================
+//function : DefineFormat
+//purpose  : 
+//=======================================================================
+void StdLDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
+{
+  theApp->DefineFormat ("OCC-StdLite", "Lite OCAF Document", "stdl",
+                        new StdLDrivers_DocumentRetrievalDriver, 0);
+}
+
+//=======================================================================
+//function : BindTypes
+//purpose  : Register types
+//=======================================================================
+void StdLDrivers::BindTypes (StdObjMgt_MapOfInstantiators& theMap)
+{
+  StdLPersistent::BindTypes (theMap);
+}
 
 // Declare entry point PLUGINFACTORY
-PLUGIN(StdLDrivers)
+PLUGIN (StdLDrivers)