fd6e8416922e4071c80fd1afb757bc9d579fad8e
[occt.git] / src / BinDrivers / BinDrivers.cxx
1 // Created on: 2002-10-29
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2002-2012 OPEN CASCADE SAS
4 //
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
9 //
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
12 //
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
19
20
21 #include <BinDrivers.ixx>
22 #include <BinLDrivers.hxx>
23 #include <BinMDF.hxx>
24 #include <BinMDataStd.hxx>
25 #include <BinMDataXtd.hxx>
26 #include <BinMNaming.hxx>
27 #include <BinMDocStd.hxx>
28 #include <BinMFunction.hxx>
29 #include <BinMPrsStd.hxx>
30 #include <Standard_Failure.hxx>
31 #include <BinDrivers_DocumentStorageDriver.hxx>
32 #include <BinDrivers_DocumentRetrievalDriver.hxx>
33 #include <Plugin_Macro.hxx>
34
35 // avoid warnings on 'extern "C"' functions returning C++ classes
36 #ifdef WNT
37 #pragma warning(4:4190)
38 #endif
39
40 static Standard_GUID BinStorageDriver  ("03a56835-8269-11d5-aab2-0050044b1af1");
41 static Standard_GUID BinRetrievalDriver("03a56836-8269-11d5-aab2-0050044b1af1");
42
43 //=======================================================================
44 //function : Factory
45 //purpose  : PLUGIN FACTORY
46 //=======================================================================
47 Handle(Standard_Transient) BinDrivers::Factory(const Standard_GUID& theGUID)
48 {
49   if (theGUID == BinStorageDriver)
50   {
51     cout << "BinDrivers : Storage Plugin" << endl;
52     static Handle(BinDrivers_DocumentStorageDriver) model_sd =
53       new BinDrivers_DocumentStorageDriver;
54     return model_sd;
55   }
56
57   if (theGUID == BinRetrievalDriver)
58   {
59     cout << "BinDrivers : Retrieval Plugin" << endl;
60     static Handle(BinDrivers_DocumentRetrievalDriver) model_rd =
61       new BinDrivers_DocumentRetrievalDriver;
62     return model_rd;
63   }
64
65   Standard_Failure::Raise ("BinDrivers : unknown GUID");
66   return NULL;
67 }
68
69 //=======================================================================
70 //function : AttributeDrivers
71 //purpose  :
72 //=======================================================================
73
74 Handle(BinMDF_ADriverTable) BinDrivers::AttributeDrivers 
75                          (const Handle(CDM_MessageDriver)& aMsgDrv)
76 {
77   Handle(BinMDF_ADriverTable) aTable = new BinMDF_ADriverTable;
78
79   BinMDF        ::AddDrivers (aTable, aMsgDrv);
80   BinMDataStd   ::AddDrivers (aTable, aMsgDrv);
81   BinMDataXtd   ::AddDrivers (aTable, aMsgDrv);  
82   BinMNaming    ::AddDrivers (aTable, aMsgDrv);
83   BinMDocStd    ::AddDrivers (aTable, aMsgDrv);
84   BinMFunction  ::AddDrivers (aTable, aMsgDrv);
85   BinMPrsStd    ::AddDrivers (aTable, aMsgDrv);
86   return aTable;
87 }
88
89 //=======================================================================
90 //function : StorageVersion
91 //purpose  : 
92 //=======================================================================
93
94 TCollection_AsciiString BinDrivers::StorageVersion()
95 {
96   return BinLDrivers::StorageVersion();
97 }
98 PLUGIN(BinDrivers)