b311480e |
1 | // Created on: 2000-09-07 |
2 | // Created by: TURIN Anatoliy |
3 | // Copyright (c) 2000-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 | |
7fd59977 |
20 | |
21 | #include <StdDrivers.ixx> |
22 | #include <StdDrivers_DocumentStorageDriver.hxx> |
23 | #include <StdDrivers_DocumentRetrievalDriver.hxx> |
24 | #include <StdSchema.hxx> |
25 | #include <StdLSchema.hxx> |
26 | #include <ShapeSchema.hxx> |
27 | #include <Storage_HArrayOfSchema.hxx> |
28 | |
29 | #include <Standard_Failure.hxx> |
30 | #include <Standard_GUID.hxx> |
31 | #include <Plugin_Macro.hxx> |
32 | |
33 | // avoid warnings on 'extern "C"' functions returning C++ classes |
34 | #ifdef WNT |
35 | #pragma warning(4:4190) |
36 | #endif |
37 | |
38 | static Standard_GUID StdStorageDriver ("ad696000-5b34-11d1-b5ba-00a0c9064368"); |
39 | static Standard_GUID StdRetrievalDriver ("ad696001-5b34-11d1-b5ba-00a0c9064368"); |
40 | static Standard_GUID StdSchemaID ("ad696002-5b34-11d1-b5ba-00a0c9064368"); |
41 | |
42 | Handle(Standard_Transient) StdDrivers::Factory(const Standard_GUID& aGUID) { |
43 | |
44 | if(aGUID == StdSchemaID) { |
45 | #ifdef DEB |
46 | cout << "StdSchema : Plugin" << endl; |
47 | #endif |
48 | static Handle(StdLSchema) model_ss = new StdLSchema; |
49 | static Standard_Boolean aNeedNested = Standard_True; |
50 | if(aNeedNested) { |
51 | aNeedNested = Standard_False; |
52 | #ifdef DEB |
53 | cout << "StdSchema: Adding nested schema" << endl; |
54 | #endif |
55 | Handle(StdSchema) aSchema = new StdSchema; |
56 | Handle(ShapeSchema) aSSchema = new ShapeSchema; |
57 | Handle(Storage_HArrayOfSchema) aSchemas = new Storage_HArrayOfSchema(0,1); |
58 | aSchemas->SetValue(0, aSSchema); |
59 | aSchemas->SetValue(1, aSchema); |
60 | model_ss->SetNestedSchemas(aSchemas); |
61 | } |
62 | return model_ss; |
63 | } |
64 | |
65 | if(aGUID == StdStorageDriver) { |
66 | #ifdef DEB |
67 | cout << "StdDrivers : Storage Plugin" << endl; |
68 | #endif |
69 | static Handle(StdDrivers_DocumentStorageDriver) model_sd = new StdDrivers_DocumentStorageDriver; |
70 | return model_sd; |
71 | } |
72 | if(aGUID == StdRetrievalDriver) { |
73 | #ifdef DEB |
74 | cout << "StdDrivers : Retrieval Plugin" << endl; |
75 | #endif |
76 | static Handle(StdDrivers_DocumentRetrievalDriver) model_rd = new StdDrivers_DocumentRetrievalDriver; |
77 | return model_rd; |
78 | } |
79 | |
80 | Standard_Failure::Raise ("StdDrivers : unknown GUID"); |
81 | Handle(Standard_Transient) t; |
82 | return t; |
83 | } |
84 | |
85 | // Declare entry point PLUGINFACTORY |
86 | PLUGIN(StdDrivers) |