b311480e |
1 | // Created on: 2002-10-29 |
2 | // Created by: Michael SAZONOV |
973c2be1 |
3 | // Copyright (c) 2002-2014 OPEN CASCADE SAS |
b311480e |
4 | // |
973c2be1 |
5 | // This file is part of Open CASCADE Technology software library. |
b311480e |
6 | // |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
12 | // |
973c2be1 |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
7fd59977 |
15 | |
42cf5bc1 |
16 | |
17 | #include <BinLDrivers.hxx> |
18 | #include <BinLDrivers_DocumentRetrievalDriver.hxx> |
19 | #include <BinLDrivers_DocumentStorageDriver.hxx> |
7fd59977 |
20 | #include <BinMDataStd.hxx> |
42cf5bc1 |
21 | #include <BinMDF.hxx> |
22 | #include <BinMDF_ADriverTable.hxx> |
7fd59977 |
23 | #include <BinMDocStd.hxx> |
42cf5bc1 |
24 | #include <BinMFunction.hxx> |
25 | #include <CDM_MessageDriver.hxx> |
7fd59977 |
26 | #include <Plugin_Macro.hxx> |
42cf5bc1 |
27 | #include <Standard_Failure.hxx> |
28 | #include <Standard_GUID.hxx> |
29 | #include <Standard_Transient.hxx> |
30 | #include <TCollection_AsciiString.hxx> |
6fe96f84 |
31 | #include <TDocStd_Application.hxx> |
7fd59977 |
32 | |
42cf5bc1 |
33 | //#include <BinMNaming.hxx> |
7fd59977 |
34 | static Standard_GUID BinLStorageDriver ("13a56835-8269-11d5-aab2-0050044b1af1"); |
35 | static Standard_GUID BinLRetrievalDriver("13a56836-8269-11d5-aab2-0050044b1af1"); |
f47afe53 |
36 | #define CURRENT_DOCUMENT_VERSION 8 |
7fd59977 |
37 | |
38 | //======================================================================= |
39 | //function : Factory |
40 | //purpose : PLUGIN FACTORY |
41 | //======================================================================= |
ce8b059a |
42 | const Handle(Standard_Transient)& BinLDrivers::Factory(const Standard_GUID& theGUID) |
7fd59977 |
43 | { |
44 | if (theGUID == BinLStorageDriver) |
45 | { |
0797d9d3 |
46 | #ifdef OCCT_DEBUG |
7fd59977 |
47 | cout << "BinLDrivers : Storage Plugin" << endl; |
63c629aa |
48 | #endif |
4796758e |
49 | static Handle(Standard_Transient) model_sd = |
7fd59977 |
50 | new BinLDrivers_DocumentStorageDriver; |
51 | return model_sd; |
52 | } |
53 | |
54 | if (theGUID == BinLRetrievalDriver) |
55 | { |
0797d9d3 |
56 | #ifdef OCCT_DEBUG |
7fd59977 |
57 | cout << "BinLDrivers : Retrieval Plugin" << endl; |
63c629aa |
58 | #endif |
4796758e |
59 | static Handle(Standard_Transient) model_rd = |
7fd59977 |
60 | new BinLDrivers_DocumentRetrievalDriver; |
61 | return model_rd; |
62 | } |
63 | |
64 | Standard_Failure::Raise ("BinLDrivers : unknown GUID"); |
ce8b059a |
65 | static Handle(Standard_Transient) aNullHandle; |
66 | return aNullHandle; |
7fd59977 |
67 | } |
68 | |
6fe96f84 |
69 | //======================================================================= |
70 | //function : DefineFormat |
71 | //purpose : |
72 | //======================================================================= |
73 | void BinLDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp) |
74 | { |
75 | theApp->DefineFormat ("BinLOcaf", "Binary Lite OCAF Document", "cbfl", |
76 | new BinLDrivers_DocumentRetrievalDriver, |
77 | new BinLDrivers_DocumentStorageDriver); |
78 | } |
79 | |
7fd59977 |
80 | //======================================================================= |
81 | //function : AttributeDrivers |
82 | //purpose : |
83 | //======================================================================= |
84 | |
85 | Handle(BinMDF_ADriverTable) BinLDrivers::AttributeDrivers |
86 | (const Handle(CDM_MessageDriver)& aMsgDrv) |
87 | { |
88 | Handle(BinMDF_ADriverTable) aTable = new BinMDF_ADriverTable; |
89 | |
90 | BinMDF ::AddDrivers (aTable, aMsgDrv); |
91 | BinMDataStd ::AddDrivers (aTable, aMsgDrv); |
92 | BinMFunction ::AddDrivers (aTable, aMsgDrv); |
93 | BinMDocStd ::AddDrivers (aTable, aMsgDrv); |
94 | |
7fd59977 |
95 | return aTable; |
96 | } |
97 | |
98 | //======================================================================= |
99 | //function : StorageVersion |
100 | //purpose : |
101 | //======================================================================= |
102 | |
103 | TCollection_AsciiString BinLDrivers::StorageVersion() |
104 | { |
105 | TCollection_AsciiString aVersionStr (CURRENT_DOCUMENT_VERSION); |
106 | return aVersionStr; |
107 | } |
498ce76b |
108 | |
7fd59977 |
109 | PLUGIN(BinLDrivers) |