]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSetPlugin/PartSetPlugin_Plugin.cxx
Salome HOME
Remove Boost shared_ptr, use std instead
[modules/shaper.git] / src / PartSetPlugin / PartSetPlugin_Plugin.cxx
1 #include "PartSetPlugin_Plugin.h"
2 #include "PartSetPlugin_NewPart.h"
3 #include <ModelAPI_PluginManager.h>
4 #include <ModelAPI_Document.h>
5
6 using namespace std;
7
8 // group identification of the newly created parts in the Part Set document
9 const int MY_PARTS_GROUP = 1;
10
11 // the only created instance of this plugin
12 static PartSetPlugin_Plugin* MY_INSTANCE = new PartSetPlugin_Plugin();
13
14 PartSetPlugin_Plugin::PartSetPlugin_Plugin() 
15 {
16   // register this plugin
17   ModelAPI_PluginManager::get()->registerPlugin(this);
18 }
19
20 std::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
21 {
22   std::shared_ptr<ModelAPI_Feature> aCreated;
23   if (theFeatureID == "new_part") {
24     aCreated = std::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_NewPart());
25   }
26   // add to a root document for the current moment
27   if (aCreated)
28     ModelAPI_PluginManager::get()->rootDocument()->AddObject(aCreated, MY_PARTS_GROUP);
29   // feature of such kind is not found
30   return aCreated;
31 }