Salome HOME
Put groups to the separated plugin: Collection
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Plugin.cpp
index b3256862a1c9e1c726bae79e19fec8e41d6477fc..08dcb202b1051b9fff7a333998b481ebe51c9d47 100644 (file)
@@ -1,29 +1,47 @@
-/*
- *
- */
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:    ExchangePlugin_Plugin.cpp
+// Created: Aug 28, 2014
+// Author:  Sergey BELASH
 
 #include <ExchangePlugin_Plugin.h>
+#include <ExchangePlugin_Dump.h>
 #include <ExchangePlugin_ImportFeature.h>
+#include <ExchangePlugin_ExportFeature.h>
+#include <ExchangePlugin_Validators.h>
 
-#include <ModelAPI_Session.h>
+#include <Config_PropManager.h>
 
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
 
-using namespace std;
+#include <memory>
 
 // the only created instance of this plugin
-static ExchangePlugin_Plugin* MY_INSTANCE = new ExchangePlugin_Plugin();
+static ExchangePlugin_Plugin* MY_EXCHANGE_INSTANCE = new ExchangePlugin_Plugin();
 
 ExchangePlugin_Plugin::ExchangePlugin_Plugin()
 {
   // register this plugin
-  ModelAPI_Session::get()->registerPlugin(this);
+  SessionPtr aSession = ModelAPI_Session::get();
+  aSession->registerPlugin(this);
+  ModelAPI_ValidatorsFactory* aFactory = aSession->validators();
+  aFactory->registerValidator("ExchangePlugin_ImportFormat",
+                              new ExchangePlugin_ImportFormatValidator);
+  aFactory->registerValidator("ExchangePlugin_ExportFormat",
+                              new ExchangePlugin_ExportFormatValidator);
 }
 
-FeaturePtr ExchangePlugin_Plugin::createFeature(string theFeatureID)
+FeaturePtr ExchangePlugin_Plugin::createFeature(std::string theFeatureID)
 {
   if (theFeatureID == ExchangePlugin_ImportFeature::ID()) {
     return FeaturePtr(new ExchangePlugin_ImportFeature);
+  } else
+  if (theFeatureID == ExchangePlugin_ExportFeature::ID()) {
+    return FeaturePtr(new ExchangePlugin_ExportFeature);
+  } else
+  if (theFeatureID == ExchangePlugin_Dump::ID()) {
+    return FeaturePtr(new ExchangePlugin_Dump);
   }
   // feature of such kind is not found
   return FeaturePtr();