Salome HOME
Fix pyconfig redefined declarations for _XOPEN_SOURCE and _POSIX_C_SOURCE
[modules/shaper.git] / src / ParametersPlugin / ParametersPlugin_Plugin.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #include <pyconfig.h>
4
5 #include <ParametersPlugin_Plugin.h>
6 #include <ParametersPlugin_Parameter.h>
7 #include <ParametersPlugin_Validators.h>
8
9 #include <ModelAPI_Session.h>
10 #include <ModelAPI_Validator.h>
11
12 #include <memory>
13
14 // the only created instance of this plugin
15 static ParametersPlugin_Plugin* MY_PARAMETERSPLUGIN_INSTANCE = new ParametersPlugin_Plugin();
16
17 ParametersPlugin_Plugin::ParametersPlugin_Plugin()
18 {
19   // register this plugin
20   SessionPtr aSession = ModelAPI_Session::get();
21   aSession->registerPlugin(this);
22
23   ModelAPI_ValidatorsFactory* aFactory = aSession->validators();
24   aFactory->registerValidator("Parameters_VariableValidator",
25                               new ParametersPlugin_VariableValidator);
26   aFactory->registerValidator("Parameters_ExpressionValidator",
27                               new ParametersPlugin_ExpressionValidator);
28
29   myEvalListener = std::shared_ptr<ParametersPlugin_EvalListener>(new ParametersPlugin_EvalListener());
30 }
31
32 FeaturePtr ParametersPlugin_Plugin::createFeature(std::string theFeatureID)
33 {
34   // TODO: register some features
35   if (theFeatureID == ParametersPlugin_Parameter::ID()) {
36     return FeaturePtr(new ParametersPlugin_Parameter);
37   }
38   return FeaturePtr();
39 }
40