1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModelAPI_Session.hxx
4 // Created: 20 Mar 2014
5 // Author: Mikhail PONIKAROV
7 #include <ModelAPI_Session.h>
8 // to avoid unresolved ModelAPI_Document()
9 #include <ModelAPI_Document.h>
10 // to avoid unresolved ModelAPI_Feature()
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Object.h>
13 // to avoid unresolved ModelAPI_Data()
14 #include <ModelAPI_Data.h>
15 // to avoid unresolved ModelAPI_Plugin()
16 #include <ModelAPI_Plugin.h>
17 #include <ModelAPI_Attribute.h>
18 #include <ModelAPI_AttributeDocRef.h>
19 #include <ModelAPI_AttributeDouble.h>
20 #include <ModelAPI_AttributeBoolean.h>
21 #include <ModelAPI_AttributeInteger.h>
22 #include <ModelAPI_AttributeString.h>
23 #include <ModelAPI_AttributeReference.h>
24 #include <ModelAPI_AttributeRefAttr.h>
25 #include <ModelAPI_AttributeRefList.h>
26 #include <ModelAPI_AttributeBoolean.h>
27 #include <ModelAPI_AttributeSelection.h>
28 #include <ModelAPI_AttributeSelectionList.h>
29 #include <ModelAPI_Events.h>
30 #include <ModelAPI_Validator.h>
31 #include <ModelAPI_ResultBody.h>
32 #include <ModelAPI_ResultConstruction.h>
34 #include <Config_ModuleReader.h>
35 #include <Config_PropManager.h>
47 /// Manager that will be initialized from Model package, one per application
48 std::shared_ptr<ModelAPI_Session> MY_MANAGER;
50 void ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session> theManager)
52 MY_MANAGER = theManager;
55 std::shared_ptr<ModelAPI_Session> ModelAPI_Session::get()
57 if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
58 Config_ModuleReader::loadLibrary("Model");
60 Config_PropManager::registerProp("Visualization", "body_deflection",
61 "Body deflection coefficient",
63 ModelAPI_ResultBody::DEFAULT_DEFLECTION());
65 Config_PropManager::registerProp("Visualization", "construction_deflection",
66 "Construction deflection coefficient",
68 ModelAPI_ResultConstruction::DEFAULT_DEFLECTION());
74 /// instance of the events creator, one pre application
75 const ModelAPI_EventCreator* MY_API_CREATOR = 0;
77 const ModelAPI_EventCreator* ModelAPI_EventCreator::get()
79 if (!MY_API_CREATOR) { // import Model library that implements this interface of ModelAPI
80 Config_ModuleReader::loadLibrary("Model");
82 return MY_API_CREATOR;
85 void ModelAPI_EventCreator::set(const ModelAPI_EventCreator* theCreator)
87 MY_API_CREATOR = theCreator;