Salome HOME
merge V9_dev
[modules/yacs.git] / src / runtime / SalomeContainer.cxx
index 849e7e5af04b5bdcaecb99496c44153dc3222c8f..70b405be81ec278df2a943cf15461b75d9e080d7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 using namespace YACS::ENGINE;
 using namespace std;
 
+const char SalomeContainer::KIND[]="Salome";
+
+const char SalomeContainer::TYPE_PROPERTY_STR[]="type";
+
 SalomeContainer::SalomeContainer():_launchModeType(new SalomeContainerMonoHelper),_shutdownLevel(999)
 {
 }
@@ -64,9 +68,9 @@ SalomeContainer::SalomeContainer(const SalomeContainer& other)
 {
 }
 
-SalomeContainer::SalomeContainer(const Container& other, const SalomeContainerTools& sct, SalomeContainerHelper *lmt,
+SalomeContainer::SalomeContainer(const Container& other, const SalomeContainerTools& sct, const SalomeContainerHelper *lmt,
                                  const std::vector<std::string>& componentNames, int shutdownLev):Container(other),_componentNames(componentNames),
-                                     _launchModeType(lmt),_shutdownLevel(shutdownLev),_sct(sct)
+                                     _launchModeType(const_cast<SalomeContainerHelper *>(lmt)),_shutdownLevel(shutdownLev),_sct(sct)
 {
   if(lmt)
     lmt->incrRef();
@@ -87,6 +91,11 @@ void SalomeContainer::unLock()
   _mutex.unLock();
 }
 
+std::string SalomeContainer::getKind() const
+{
+  return KIND;
+}
+
 Container *SalomeContainer::clone() const
 {
   if(_isAttachedOnCloning)
@@ -111,7 +120,14 @@ void SalomeContainer::checkCapabilityToDealWith(const ComponentInstance *inst) c
 
 void SalomeContainer::setProperty(const std::string& name, const std::string& value)
 {
-  if (name == "type")
+  if (name == AOC_ENTRY)
+    {
+      std::istringstream iss(value);
+      int val;
+      iss >> val;
+      setAttachOnCloningStatus((bool)val);
+    }
+  else if (name == TYPE_PROPERTY_STR)
     {
       if (value == SalomeContainerMonoHelper::TYPE_NAME)
         {
@@ -125,13 +141,20 @@ void SalomeContainer::setProperty(const std::string& name, const std::string& va
         }
       else
         throw Exception("SalomeContainer::setProperty : type value is not correct (mono or multi): " + value);
-      return ;
     }
   _sct.setProperty(name,value);
 }
 
 std::string SalomeContainer::getProperty(const std::string& name) const
 {
+  if (name == TYPE_PROPERTY_STR)
+    return _launchModeType->getType();
+  if (name==AOC_ENTRY)
+    {
+      int reti(_isAttachedOnCloning);
+      std::ostringstream oss; oss << reti;
+      return oss.str();
+    }
   return _sct.getProperty(name);
 }