Salome HOME
Dump Python in the High Level Parameterized Geometry API (issue #1648)
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Plugin.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    ExchangePlugin_Plugin.cpp
4 // Created: Aug 28, 2014
5 // Author:  Sergey BELASH
6
7 #include <ExchangePlugin_Plugin.h>
8 #include <ExchangePlugin_Dump.h>
9 #include <ExchangePlugin_ImportFeature.h>
10 #include <ExchangePlugin_ExportFeature.h>
11 #include <ExchangePlugin_Validators.h>
12
13 #include <Config_PropManager.h>
14
15 #include <ModelAPI_Session.h>
16 #include <ModelAPI_Validator.h>
17
18 #include <memory>
19
20 using namespace std;
21
22 // the only created instance of this plugin
23 static ExchangePlugin_Plugin* MY_EXCHANGE_INSTANCE = new ExchangePlugin_Plugin();
24
25 ExchangePlugin_Plugin::ExchangePlugin_Plugin()
26 {
27   // register this plugin
28   SessionPtr aSession = ModelAPI_Session::get();
29   aSession->registerPlugin(this);
30   ModelAPI_ValidatorsFactory* aFactory = aSession->validators();
31   aFactory->registerValidator("ExchangePlugin_ImportFormat",
32                               new ExchangePlugin_ImportFormatValidator);
33   aFactory->registerValidator("ExchangePlugin_ExportFormat",
34                               new ExchangePlugin_ExportFormatValidator);
35 }
36
37 FeaturePtr ExchangePlugin_Plugin::createFeature(string theFeatureID)
38 {
39   if (theFeatureID == ExchangePlugin_ImportFeature::ID()) {
40     return FeaturePtr(new ExchangePlugin_ImportFeature);
41   } else
42   if (theFeatureID == ExchangePlugin_ExportFeature::ID()) {
43     return FeaturePtr(new ExchangePlugin_ExportFeature);
44   } else
45   if (theFeatureID == ExchangePlugin_Dump::ID()) {
46     return FeaturePtr(new ExchangePlugin_Dump);
47   }
48   // feature of such kind is not found
49   return FeaturePtr();
50 }