Salome HOME
refs #75 - reported by Hervé Legrand: sketch - color of planes displayed in 3D viewer...
[modules/shaper.git] / src / ModelAPI / ModelAPI_PluginManager.cpp
1 // File:        ModelAPI_PluginManager.hxx
2 // Created:     20 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include <ModelAPI_PluginManager.h>
6 // to avoid unresolved ModelAPI_Document()
7 #include <ModelAPI_Document.h>
8 // to avoid unresolved ModelAPI_Feature()
9 #include <ModelAPI_Feature.h>
10 #include <ModelAPI_Object.h>
11 // to avoid unresolved ModelAPI_Data()
12 #include <ModelAPI_Data.h>
13 // to avoid unresolved ModelAPI_Plugin()
14 #include <ModelAPI_Plugin.h>
15 #include <ModelAPI_Attribute.h>
16 #include <ModelAPI_AttributeDocRef.h>
17 #include <ModelAPI_AttributeDouble.h>
18 #include <ModelAPI_AttributeReference.h>
19 #include <ModelAPI_AttributeRefAttr.h>
20 #include <ModelAPI_AttributeRefList.h>
21
22 #include <Config_ModuleReader.h>
23
24 #ifdef WIN32
25 #include <windows.h>
26 #else
27 #include <dlfcn.h>
28 #endif
29
30 using namespace std;
31
32 #ifdef _DEBUG
33 #include <iostream>
34 #endif
35
36 /// Manager that will be initialized from Model package, one per application
37 boost::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
38
39 ModelAPI_PluginManager::ModelAPI_PluginManager()
40 {
41 }
42
43 void ModelAPI_PluginManager::SetPluginManager(
44   boost::shared_ptr<ModelAPI_PluginManager> theManager)
45 {
46   MY_MANAGER = theManager;
47 }
48
49 boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
50 {
51   if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
52     Config_ModuleReader::loadLibrary("Model");
53   }
54   return MY_MANAGER;
55 }