0025418: Debug output to be limited to OCC development environment
[occt.git] / src / StdDrivers / StdDrivers.cxx
1 // Created on: 2000-09-07
2 // Created by: TURIN Anatoliy
3 // Copyright (c) 2000-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 #include <StdDrivers.ixx>
17 #include <StdDrivers_DocumentStorageDriver.hxx>
18 #include <StdDrivers_DocumentRetrievalDriver.hxx>
19 #include <StdSchema.hxx>
20 #include <StdLSchema.hxx>
21 #include <ShapeSchema.hxx>
22 #include <Storage_HArrayOfSchema.hxx>
23
24 #include <Standard_Failure.hxx>
25 #include <Standard_GUID.hxx>
26 #include <Plugin_Macro.hxx>
27
28 static Standard_GUID StdStorageDriver     ("ad696000-5b34-11d1-b5ba-00a0c9064368");
29 static Standard_GUID StdRetrievalDriver   ("ad696001-5b34-11d1-b5ba-00a0c9064368");
30 static Standard_GUID StdSchemaID          ("ad696002-5b34-11d1-b5ba-00a0c9064368");
31
32 Handle(Standard_Transient) StdDrivers::Factory(const Standard_GUID& aGUID) {
33
34   if(aGUID == StdSchemaID) {    
35 #ifdef OCCT_DEBUG
36     cout << "StdSchema : Plugin" << endl;
37 #endif
38     static Handle(StdLSchema) model_ss = new StdLSchema;
39     static Standard_Boolean aNeedNested = Standard_True;
40     if(aNeedNested) {
41       aNeedNested = Standard_False;
42 #ifdef OCCT_DEBUG
43       cout << "StdSchema: Adding nested schema" << endl;
44 #endif
45       Handle(StdSchema) aSchema = new StdSchema;
46       Handle(ShapeSchema) aSSchema = new ShapeSchema;
47       Handle(Storage_HArrayOfSchema) aSchemas = new Storage_HArrayOfSchema(0,1);
48       aSchemas->SetValue(0, aSSchema);
49       aSchemas->SetValue(1, aSchema);
50       model_ss->SetNestedSchemas(aSchemas);
51     }
52     return model_ss;
53   }
54
55   if(aGUID == StdStorageDriver)  {
56 #ifdef OCCT_DEBUG
57     cout << "StdDrivers : Storage Plugin" << endl;
58 #endif
59     static Handle(StdDrivers_DocumentStorageDriver) model_sd = new StdDrivers_DocumentStorageDriver;
60     return model_sd;
61   }
62   if(aGUID == StdRetrievalDriver) {  
63 #ifdef OCCT_DEBUG
64     cout << "StdDrivers : Retrieval Plugin" << endl;
65 #endif
66     static Handle(StdDrivers_DocumentRetrievalDriver) model_rd = new StdDrivers_DocumentRetrievalDriver;
67     return model_rd;
68   }
69  
70   Standard_Failure::Raise ("StdDrivers : unknown GUID");
71   Handle(Standard_Transient) t;
72   return t;
73 }
74
75 #ifdef _MSC_VER
76 #pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
77 #endif
78
79 // Declare entry point PLUGINFACTORY
80 PLUGIN(StdDrivers)