0030675: Visualization - remove redundant proxy classes in hierarchy of PrsMgr_Presen...
[occt.git] / src / BinLDrivers / BinLDrivers.cxx
1 // Created on: 2002-10-29
2 // Created by: Michael SAZONOV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
4 //
5 // This file is part of Open CASCADE Technology software library.
6 //
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
12 //
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
15
16
17 #include <BinLDrivers.hxx>
18 #include <BinLDrivers_DocumentRetrievalDriver.hxx>
19 #include <BinLDrivers_DocumentStorageDriver.hxx>
20 #include <BinMDataStd.hxx>
21 #include <BinMDF.hxx>
22 #include <BinMDF_ADriverTable.hxx>
23 #include <BinMDocStd.hxx>
24 #include <BinMFunction.hxx>
25 #include <Message_Messenger.hxx>
26 #include <Plugin_Macro.hxx>
27 #include <Standard_Failure.hxx>
28 #include <Standard_GUID.hxx>
29 #include <Standard_Transient.hxx>
30 #include <TCollection_AsciiString.hxx>
31 #include <TDocStd_Application.hxx>
32
33 //#include <BinMNaming.hxx>
34 static Standard_GUID BinLStorageDriver  ("13a56835-8269-11d5-aab2-0050044b1af1");
35 static Standard_GUID BinLRetrievalDriver("13a56836-8269-11d5-aab2-0050044b1af1");
36 #define CURRENT_DOCUMENT_VERSION 10
37
38 //=======================================================================
39 //function : Factory
40 //purpose  : PLUGIN FACTORY
41 //=======================================================================
42 const Handle(Standard_Transient)& BinLDrivers::Factory(const Standard_GUID& theGUID)
43 {
44   if (theGUID == BinLStorageDriver)
45   {
46 #ifdef OCCT_DEBUG
47     cout << "BinLDrivers : Storage Plugin" << endl;
48 #endif
49     static Handle(Standard_Transient) model_sd =
50       new BinLDrivers_DocumentStorageDriver;
51     return model_sd;
52   }
53
54   if (theGUID == BinLRetrievalDriver)
55   {
56 #ifdef OCCT_DEBUG
57     cout << "BinLDrivers : Retrieval Plugin" << endl;
58 #endif
59     static Handle(Standard_Transient) model_rd =
60       new BinLDrivers_DocumentRetrievalDriver;
61     return model_rd;
62   }
63
64   throw Standard_Failure("BinLDrivers : unknown GUID");
65 }
66
67 //=======================================================================
68 //function : DefineFormat
69 //purpose  : 
70 //=======================================================================
71 void BinLDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
72 {
73   theApp->DefineFormat ("BinLOcaf", "Binary Lite OCAF Document", "cbfl",
74                         new BinLDrivers_DocumentRetrievalDriver, 
75                         new BinLDrivers_DocumentStorageDriver);
76 }
77
78 //=======================================================================
79 //function : AttributeDrivers
80 //purpose  :
81 //=======================================================================
82
83 Handle(BinMDF_ADriverTable) BinLDrivers::AttributeDrivers 
84                          (const Handle(Message_Messenger)& aMsgDrv)
85 {
86   Handle(BinMDF_ADriverTable) aTable = new BinMDF_ADriverTable;
87
88   BinMDF        ::AddDrivers (aTable, aMsgDrv);
89   BinMDataStd   ::AddDrivers (aTable, aMsgDrv);
90   BinMFunction  ::AddDrivers (aTable, aMsgDrv);
91   BinMDocStd    ::AddDrivers (aTable, aMsgDrv);
92
93   return aTable;
94 }
95
96 //=======================================================================
97 //function : StorageVersion
98 //purpose  : 
99 //=======================================================================
100
101 TCollection_AsciiString BinLDrivers::StorageVersion()
102 {
103   TCollection_AsciiString aVersionStr (CURRENT_DOCUMENT_VERSION);
104   return aVersionStr;
105 }
106
107 PLUGIN(BinLDrivers)