Salome HOME
Ready to update Executor to take into account of the new type of containers.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 1 Aug 2014 13:55:16 +0000 (15:55 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 1 Aug 2014 13:55:16 +0000 (15:55 +0200)
43 files changed:
src/engine/ComponentInstance.hxx
src/engine/Container.cxx
src/engine/Container.hxx
src/engine/ElementaryNode.cxx
src/engine/ElementaryNode.hxx
src/engine/Executor.cxx
src/engine/InlineNode.cxx
src/engine/InlineNode.hxx
src/engine/PropertyInterface.hxx
src/engine/ServiceNode.cxx
src/engine/ServiceNode.hxx
src/engine/Task.hxx
src/engine/Test/ComponentInstanceTest.cxx
src/engine/Test/ComponentInstanceTest.hxx
src/engine/Test/ContainerTest.cxx
src/engine/Test/ContainerTest.hxx
src/engine_swig/pilot.i
src/runtime/CMakeLists.txt
src/runtime/CORBAComponent.cxx
src/runtime/CORBAComponent.hxx
src/runtime/CppComponent.cxx
src/runtime/CppComponent.hxx
src/runtime/CppContainer.cxx
src/runtime/CppContainer.hxx
src/runtime/DistributedPythonNode.cxx
src/runtime/PythonNode.cxx
src/runtime/RuntimeSALOME.cxx
src/runtime/SalomeComponent.cxx
src/runtime/SalomeComponent.hxx
src/runtime/SalomeContainer.cxx
src/runtime/SalomeContainer.hxx
src/runtime/SalomeContainerHelper.cxx
src/runtime/SalomeContainerHelper.hxx
src/runtime/SalomeContainerTools.cxx
src/runtime/SalomeContainerTools.hxx
src/runtime/SalomeHPContainer.cxx
src/runtime/SalomeHPContainer.hxx
src/runtime/SalomeHPContainerTools.cxx [new file with mode: 0644]
src/runtime/SalomeHPContainerTools.hxx [new file with mode: 0644]
src/runtime/SalomePythonComponent.cxx
src/runtime/SalomePythonComponent.hxx
src/runtime/SalomePythonNode.cxx
src/runtime_swig/SALOMERuntime.i

index d3caef620ffb8ae13e91d379b2dae4b5d9106aa7..f76ff3019551168a23192908f861fc6b7909fcb2 100644 (file)
@@ -31,8 +31,9 @@ namespace YACS
 {
   namespace ENGINE
   {
-    class Container;
+    class Task;
     class ServiceNode;
+    class Container;
 
     class YACSLIBENGINE_EXPORT ComponentInstance : public PropertyInterface, public RefCounter
     {
@@ -50,11 +51,11 @@ namespace YACS
       virtual void setContainer(Container *cont);
       Container *getContainer() const { return _container; }
 //! Load the component instance
-      virtual void load(ServiceNode *askingNode) = 0;
+      virtual void load(Task *askingNode) = 0;
 //! Unload the component instance
-      virtual void unload(ServiceNode *askingNode) = 0;
+      virtual void unload(Task *askingNode) = 0;
 //! Indicate if the component instance is loaded (true) or not
-      virtual bool isLoaded(ServiceNode *askingNode) = 0;
+      virtual bool isLoaded(Task *askingNode) const = 0;
       virtual void attachOnCloning() const;
       virtual void dettachOnCloning() const;
       bool isAttachedOnCloning() const;
index 133c5784afce0cf4b16973f6c6258722f73af18c..b77a262109ff6f0ada90a7a992247c4fd73d680e 100644 (file)
@@ -70,6 +70,3 @@ void Container::setProperties(const std::map<std::string,std::string>& propertie
     setProperty((*it).first,(*it).second);
 }
 
-void Container::shutdown(int level)
-{
-}
index 00675f643737a1dffca79b0bf74745bb73651b62..1a7c2aed254220dab3ba40b5b3c0ea9b0f0e7f22 100644 (file)
@@ -33,6 +33,7 @@ namespace YACS
   {
     class ComponentInstance;
     class Proc;
+    class Task;
     /*!
      * This is an abstract class, that represents an abstract process in which ComponentInstances can be launched and run.
      * An instance of this will be mapped to one and only one physical container (except in the foreach context)
@@ -46,10 +47,10 @@ namespace YACS
 #endif
     public:
       //Execution only methods
-      virtual bool isAlreadyStarted(const ComponentInstance *inst) const = 0;
-      virtual void start(const ComponentInstance *inst) throw(Exception) = 0;
-      virtual std::string getPlacementId(const ComponentInstance *inst) const = 0;
-      virtual std::string getFullPlacementId(const ComponentInstance *inst) const = 0;
+      virtual bool isAlreadyStarted(const Task *askingNode) const = 0;
+      virtual void start(const Task *askingNode) throw(Exception) = 0;
+      virtual std::string getPlacementId(const Task *askingNode) const = 0;
+      virtual std::string getFullPlacementId(const Task *askingNode) const = 0;
       //Edition only methods
       virtual void attachOnCloning() const;
       virtual void dettachOnCloning() const;
@@ -72,7 +73,7 @@ namespace YACS
       void setName(std::string name) { _name = name; };
       void setProc(Proc* proc) { _proc = proc; };
       Proc* getProc() { return _proc; };
-      virtual void shutdown(int level);
+      virtual void shutdown(int level) = 0;
     protected:
       std::string _name;
       mutable bool _isAttachedOnCloning;
index 145d5e56f64aa2f6e28960a9c87add6e2b5b45be..933768992eea83c02708bb7d622c12d1f6f5c61d 100644 (file)
@@ -111,6 +111,11 @@ ComponentInstance *ElementaryNode::getComponent()
   return 0;
 }
 
+const ComponentInstance *ElementaryNode::getComponent() const
+{
+  return 0;
+}
+
 Container *ElementaryNode::getContainer()
 {
   return 0;
index 8cfb57759d7a9e20cb9fadb20d30174ea12eb637..62d8e185d98408bbccbb5cf4c11e5ce9130dcdd6 100644 (file)
@@ -62,6 +62,7 @@ namespace YACS
       void init(bool start=true);
       bool isDeployable() const;
       ComponentInstance *getComponent();
+      const ComponentInstance *getComponent() const;
       Container *getContainer();
       YACS::StatesForNode getState() const;
       void getReadyTasks(std::vector<Task *>& tasks);
index 1f958a0efafc76c0e1c088a0fe163d327f0eccb2..46dc33c529bad52c8c75bac389b3cbb60c944518 100644 (file)
@@ -25,6 +25,7 @@
 #include "ComponentInstance.hxx"
 
 #include "VisitorSaveState.hxx"
+#include "ServiceNode.hxx"
 #include "ComposedNode.hxx"
 
 #include <iostream>
@@ -1235,8 +1236,9 @@ void Executor::traceExec(Task *task, const std::string& message)
     {
       containerName = cont->getName();
       ComponentInstance *compo = task->getComponent();
-      //if (compo)
-      placement = cont->getFullPlacementId(compo);
+      ServiceNode *taskCast(dynamic_cast<ServiceNode *>(task));
+      if(taskCast)
+        placement = cont->getFullPlacementId(taskCast);
     }
 #ifdef WIN32
   DWORD now = timeGetTime();
index 57194ae52763e8e664edc79c646130875e3dd8e9..b2f4b757a1cb05b6b1798408d9c78e3b233b0c01 100644 (file)
@@ -29,7 +29,11 @@ using namespace YACS::ENGINE;
 using namespace std;
 
 
-InlineNode::~InlineNode() { }
+InlineNode::~InlineNode()
+{
+  if(_container)
+    _container->decrRef();
+}
 
 void InlineNode::accept(Visitor *visitor)
 {
@@ -48,9 +52,7 @@ void InlineNode::setScript(const std::string& script)
 
 
 InlineFuncNode::~InlineFuncNode()
-{ 
-  if(_container)
-    _container->decrRef();
+{
 }
 
 void InlineFuncNode::accept(Visitor *visitor)
@@ -58,6 +60,9 @@ void InlineFuncNode::accept(Visitor *visitor)
   visitor->visitInlineFuncNode(this);
 }
 
+/*!
+ * \param fname: name of the function contained in the script to execute
+ */
 void InlineFuncNode::setFname(const std::string& fname)
 {
   _fname=fname;
index f6f15c02f269a3fef80a01b40e0c037140a95740..402eafe0e242552f3cdd55eabc86598d5f893797 100644 (file)
@@ -91,15 +91,12 @@ namespace YACS
         :InlineNode(other,father),_fname(other._fname) { }
       InlineFuncNode(const std::string& name):InlineNode(name) { }
     public:
-//! Set the function name to use in node execution
-/*!
- * \param fname: name of the function contained in the script to execute
- */
+      //! Set the function name to use in node execution
       virtual void setFname(const std::string& fname);
       virtual std::string getFname() { return _fname; }
       void accept(Visitor *visitor);
       virtual ~InlineFuncNode();
-      virtual std::string typeName() {return "YACS__ENGINE__InlineFuncNode";}
+      virtual std::string typeName() { return "YACS__ENGINE__InlineFuncNode"; }
       virtual void checkBasicConsistency() const throw(Exception);
     protected:
       std::string _fname;
index 7c53eccf04bcc92dc1c48fe02ff09f320973d8c6..1d8e735b00e31750bd261e2bd7cbbcf3d7de5455 100644 (file)
@@ -36,7 +36,7 @@ namespace YACS
 
       virtual void setProperty(const std::string& name,const std::string& value);
       virtual std::string getProperty(const std::string& name);
-      std::map<std::string,std::string> getProperties() { return _propertyMap; };
+      std::map<std::string,std::string> getProperties() const { return _propertyMap; };
       virtual void setProperties(std::map<std::string,std::string> properties);
     protected:
       std::map<std::string,std::string> _propertyMap;
index 8f9f312f3797159e3cbdb7f6e528f5b36d7774e0..89e23e872bb306e4e4684c73b77cb3c791717dc4 100644 (file)
@@ -113,6 +113,11 @@ ComponentInstance *ServiceNode::getComponent()
   return _component;
 }
 
+const ComponentInstance *ServiceNode::getComponent() const
+{
+  return _component;
+}
+
 //! Return the associated container
 Container *ServiceNode::getContainer()
 {
index a079a9288aa47b24f5f19268a6d490a1ca9120c0..99bf25ee34c792ddea2b0c729d097157ccecc5cf 100644 (file)
@@ -42,6 +42,7 @@ namespace YACS
       virtual bool isDeployable() const;
       virtual void setComponent(ComponentInstance* compo) throw(Exception);
       virtual ComponentInstance *getComponent();
+      virtual const ComponentInstance *getComponent() const;
       virtual Container *getContainer();
       virtual void setRef(const std::string& ref);
       virtual std::string getRef();
index 4f9d0ba54d85e179aafe43631babfed66776d749..65f56b8eece2b94c0e105f404a605c1dcedb29ef 100644 (file)
@@ -46,6 +46,7 @@ namespace YACS
       virtual void getCoupledTasks(std::set<Task*>& coupledSet) = 0;
       virtual bool isDeployable() const = 0;
       virtual ComponentInstance *getComponent() = 0;
+      virtual const ComponentInstance *getComponent() const = 0;
       virtual Container *getContainer() = 0;
       virtual YACS::StatesForNode getState() const = 0;
       virtual void finished() = 0;
index 6cc6b79f5295f8ba0d64c3fe996f0781d4e0dfbb..c18e738e321068caaae503177cafbfd54617c32b 100644 (file)
@@ -31,17 +31,17 @@ ComponentInstanceTest1::ComponentInstanceTest1(const std::string& name):Componen
 {
 }
 
-void ComponentInstanceTest1::load(ServiceNode *askingNode)
+void ComponentInstanceTest1::load(Task *askingNode)
 {
   _loaded=true;
 }
 
-void ComponentInstanceTest1::unload(ServiceNode *askingNode)
+void ComponentInstanceTest1::unload(Task *askingNode)
 {
   _loaded=false;
 }
 
-bool ComponentInstanceTest1::isLoaded(ServiceNode *askingNode)
+bool ComponentInstanceTest1::isLoaded(Task *askingNode) const
 {
   return _loaded;
 }
@@ -77,17 +77,17 @@ ComponentInstanceTest2::ComponentInstanceTest2(const std::string& name):Componen
 {
 }
 
-void ComponentInstanceTest2::load(ServiceNode *askingNode)
+void ComponentInstanceTest2::load(Task *askingNode)
 {
   _loaded=true;
 }
 
-void ComponentInstanceTest2::unload(ServiceNode *askingNode)
+void ComponentInstanceTest2::unload(Task *askingNode)
 {
   _loaded=false;
 }
 
-bool ComponentInstanceTest2::isLoaded(ServiceNode *askingNode)
+bool ComponentInstanceTest2::isLoaded(Task *askingNode) const
 {
   return _loaded;
 }
index 503867f2d203463f9298561d31d390de2ba60d36..71fef605ba921b42383385ef743a1e5fc93604fe 100644 (file)
@@ -31,9 +31,9 @@ namespace YACS
     public:
       ComponentInstanceTest1(const ComponentInstanceTest1& other);
       ComponentInstanceTest1(const std::string& name);
-      void load(ServiceNode *askingNode);
-      void unload(ServiceNode *askingNode);
-      bool isLoaded(ServiceNode *askingNode);
+      void load(Task *askingNode);
+      void unload(Task *askingNode);
+      bool isLoaded(Task *askingNode) const;
       std::string getKind() const;
       ServiceNode* createNode(const std::string& name);
       ComponentInstance *clone() const;
@@ -46,9 +46,9 @@ namespace YACS
     public:
       ComponentInstanceTest2(const ComponentInstanceTest2& other);
       ComponentInstanceTest2(const std::string& name);
-      void load(ServiceNode *askingNode);
-      void unload(ServiceNode *askingNode);
-      bool isLoaded(ServiceNode *askingNode);
+      void load(Task *askingNode);
+      void unload(Task *askingNode);
+      bool isLoaded(Task *askingNode) const;
       std::string getKind() const;
       ServiceNode* createNode(const std::string& name);
       ComponentInstance *clone() const;
index fbad9fa718922047dc91fa2bbe8f94a4e1910225..f1450843e9dddf00d6726311ab6c063d30a4af5e 100644 (file)
@@ -44,12 +44,12 @@ std::string ContainerTest::getPlacementInfo() const
   return stream.str();
 }
 
-bool ContainerTest::isAlreadyStarted(const ComponentInstance *inst) const
+bool ContainerTest::isAlreadyStarted(const Task *askingNode) const
 {
   return _alreadyStarted;
 }
 
-void ContainerTest::start(const ComponentInstance *inst) throw(YACS::Exception)
+void ContainerTest::start(const Task *askingNode) throw(YACS::Exception)
 {
   if(_alreadyStarted)
     throw Exception("ContainerTest already started !!!!");
@@ -87,12 +87,12 @@ ContainerTest2::ContainerTest2():_alreadyStarted(false),_myCounter(_counter++)
 {
 }
 
-bool ContainerTest2::isAlreadyStarted(const ComponentInstance *inst) const
+bool ContainerTest2::isAlreadyStarted(const Task *askingNode) const
 {
   return _alreadyStarted;
 }
 
-void ContainerTest2::start(const ComponentInstance *inst) throw(YACS::Exception)
+void ContainerTest2::start(const Task *askingNode) throw(YACS::Exception)
 {
   if(_alreadyStarted)
     throw Exception("ContainerTest already started !!!!");
index d77edcce2aecfe451247833e22db0c23b67bb0b4..bfd49a872754c6576d0b4a20394ed7822a178851 100644 (file)
@@ -32,21 +32,22 @@ namespace YACS
       ContainerTest();
       std::string getPlacementInfo() const;
       // implementation of compulsary methods
-      bool isAlreadyStarted(const ComponentInstance *inst) const;
-      void start(const ComponentInstance *inst) throw(Exception);
+      bool isAlreadyStarted(const Task *askingNode) const;
+      void start(const Task *askingNode) throw(Exception);
       Container *clone() const;
       Container *cloneAlways() const;
       //
       void lock() { }
       void unLock() { }
       void clearProperties() { }
+      void shutdown(int level) { }
       void setProperty(const std::string& name,const std::string& value) { }
       std::string getProperty(const std::string& name) const { }
       std::map<std::string,std::string> getResourceProperties(const std::string& name) const { return std::map<std::string,std::string>(); }
       std::map<std::string,std::string> getProperties() const { return std::map<std::string,std::string>(); }
       //
-      std::string getPlacementId(const ComponentInstance *inst) const { return ""; }
-      std::string getFullPlacementId(const ComponentInstance *inst) const { return ""; }
+      std::string getPlacementId(const Task *askingNode) const { return ""; }
+      std::string getFullPlacementId(const Task *askingNode) const { return ""; }
       static void initAllContainers();
     protected:
       void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception);
@@ -62,21 +63,22 @@ namespace YACS
     public:
       ContainerTest2();
       // implementation of compulsary methods
-      bool isAlreadyStarted(const ComponentInstance *inst) const;
-      void start(const ComponentInstance *inst) throw(Exception);
+      bool isAlreadyStarted(const Task *askingNode) const;
+      void start(const Task *askingNode) throw(Exception);
       Container *clone() const;
       Container *cloneAlways() const;
       //
       void lock() { }
       void unLock() { }
       void clearProperties() { }
+      void shutdown(int level) { }
       void setProperty(const std::string& name,const std::string& value) { }
       std::string getProperty(const std::string& name) const { }
       std::map<std::string,std::string> getResourceProperties(const std::string& name) const { return std::map<std::string,std::string>(); }
       std::map<std::string,std::string> getProperties() const { return std::map<std::string,std::string>(); }
       //
-      std::string getPlacementId(const ComponentInstance *inst) const { return ""; }
-      std::string getFullPlacementId(const ComponentInstance *inst) const { return ""; }
+      std::string getPlacementId(const Task *askingNode) const { return ""; }
+      std::string getFullPlacementId(const Task *askingNode) const { return ""; }
       static void initAllContainers();
     protected:
       void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(Exception);
index f2ffcb3f06f5e10c3557cef84348647571d0640e..01bc22dc139749ee3d719ed7c978931cd67bdaa5 100644 (file)
@@ -53,6 +53,7 @@
 #include "ExecutorSwig.hxx"
 #include "Dispatcher.hxx"
 #include "Container.hxx"
+#include "HomogeneousPoolContainer.hxx"
 #include "Logger.hxx"
 #include "DeploymentTree.hxx"
 #include "ComponentInstance.hxx"
@@ -247,6 +248,7 @@ EXCEPTION(YACS::ENGINE::ExecutorSwig::waitPause)
 
 %include <ComponentInstance.hxx>
 %include <Container.hxx>
+%include <HomogeneousPoolContainer.hxx>
 %include <InputPort.hxx>
 %extend YACS::ENGINE::InputPort
 {
index bb8e6299bb1da0c0dd5dde198f6746c040001b20..42f0956f7ffc3b29d9871746352f80cb7689e07a 100644 (file)
@@ -120,6 +120,7 @@ SET(YACSRuntimeSALOME_HEADERS
   SalomeContainerTools.hxx
   SalomeContainerHelper.hxx
   SalomeHPContainer.hxx
+  SalomeHPContainerTools.hxx
   SALOMEDispatcher.hxx
   SalomeProc.hxx
   SalomePythonComponent.hxx
@@ -172,6 +173,7 @@ SET(YACSRuntimeSALOME_SOURCES
   SalomeContainer.cxx            
   SalomeContainerTools.cxx
   SalomeHPContainer.cxx
+  SalomeHPContainerTools.cxx
   SalomeContainerHelper.cxx
   PythonPorts.cxx                
   XMLNode.cxx                    
index 538eebe146b9cd048ebfde1a03d3dcadbd1eed2c..09132ebe994dc0c0786474130da120f2e8de7bea 100644 (file)
@@ -69,7 +69,7 @@ std::string CORBAComponent::getKind() const
 }
 
 //! Unload the component 
-void CORBAComponent::unload(ServiceNode *askingNode)
+void CORBAComponent::unload(Task *askingNode)
 {
   //Not implemented
   std::cerr << "CORBAComponent::unload : not implemented " << std::endl;
@@ -84,7 +84,7 @@ CORBA::Object_ptr CORBAComponent::getCompoPtr()
 }
 
 //! Is the component instance already loaded ?
-bool CORBAComponent::isLoaded(ServiceNode *askingNode)
+bool CORBAComponent::isLoaded(Task *askingNode) const
 {
   if(CORBA::is_nil(_objComponent))
     return false;
@@ -93,7 +93,7 @@ bool CORBAComponent::isLoaded(ServiceNode *askingNode)
 }
 
 //! Load the component 
-void CORBAComponent::load(ServiceNode *askingNode)
+void CORBAComponent::load(Task *askingNode)
 {
   DEBTRACE( "CORBAComponent::load" );
   CORBA::ORB_ptr orb;
index 1b93f69d2f867365824f511bd1a04aaefba8fc60..c6b4222ba62542a2f47f68ca7201dbd71b3441d5 100644 (file)
@@ -39,9 +39,9 @@ namespace YACS
       CORBAComponent(const std::string& name);
       CORBAComponent(const CORBAComponent& other);
       virtual ~CORBAComponent();
-      virtual void load(ServiceNode *askingNode);
-      virtual void unload(ServiceNode *askingNode);
-      virtual bool isLoaded(ServiceNode *askingNode);
+      virtual void load(Task *askingNode);
+      virtual void unload(Task *askingNode);
+      virtual bool isLoaded(Task *askingNode) const;
       virtual ServiceNode* createNode(const std::string& name);
       virtual ComponentInstance* clone() const;
       virtual std::string getFileRepr() const;
index fb877df382bb811207b9ec5abc24b127a00f0a00..fb3b1b8c82531117106fe8115f209c0328167f31 100644 (file)
@@ -78,34 +78,33 @@ std::string CppComponent::getKind() const
 }
 
 //! CppComponent constructor
-CppComponent::CppComponent(const std::string &name) : ComponentInstance(name)
+CppComponent::CppComponent(const std::string &name) : ComponentInstance(name), __obj(0), __run(0),__terminate(0)
 {
   _container = getRuntime()->createContainer(CppNode::KIND);
-  if (!_container->isAlreadyStarted(this))
-    _container->start(this);
-  
+  /* This part of code has been commented because the load part is supposed to do that !
+  if (!_container->isAlreadyStarted(0))
+    _container->start(0);
   CppContainer * _containerC = dynamic_cast<CppContainer *> (_container);
-  _containerC->createInternalInstance(name, __obj, __run, __terminate);
+  _containerC->createInternalInstance(name, __obj, __run, __terminate);*/
 }
 
 //! CppComponent copy constructor
-CppComponent::CppComponent(const CppComponent& other) : ComponentInstance(other._compoName), __run(other.__run),
-                                                        __terminate(other.__terminate), __obj(0)
+CppComponent::CppComponent(const CppComponent& other) : ComponentInstance(other._compoName), __obj(0), __run(0),__terminate(0)
 {
   _container = getRuntime()->createContainer(CppNode::KIND);
-  if (!_container->isAlreadyStarted(this))
-    _container->start(this);
-
+  /* This part of code has been commented because the load part is supposed to do that !
+  if (!_container->isAlreadyStarted(0))
+    _container->start(0);
   CppContainer * _containerC = dynamic_cast<CppContainer *> (_container);  
-   _containerC->createInternalInstance(_compoName, __obj, __run, __terminate);
+   _containerC->createInternalInstance(_compoName, __obj, __run, __terminate);*/
 }
 
 CppComponent::~CppComponent()
 {
-    DEBTRACE("CppComponent::~CppComponent()");
-    if (__terminate) __terminate(&__obj);
-    if (_container)
-      ((CppContainer *) _container)->unregisterComponentInstance(this);
+  DEBTRACE("CppComponent::~CppComponent()");
+  if (__terminate) __terminate(&__obj);
+  if (_container)
+    ((CppContainer *) _container)->unregisterComponentInstance(this);
 }
 
 void CppComponent::run (const char * service, int nbIn, int nbOut,
@@ -146,48 +145,50 @@ void CppComponent::run (const char * service, int nbIn, int nbOut,
 }
 
 //! Unload the component 
-void CppComponent::unload(ServiceNode *askingNode)
+void CppComponent::unload(Task *askingNode)
 {
   //Not implemented
   DEBTRACE("CppComponent::unload : not implemented ");
 }
 
 //! Is the component instance already loaded ?
-bool CppComponent::isLoaded(ServiceNode *askingNode)
+bool CppComponent::isLoaded(Task *askingNode) const
 {
   return NULL != __obj;
 }
  
-void CppComponent::load(ServiceNode *askingNode)
+void CppComponent::load(Task *askingNode)
 {
-   if (!_container) {
-     _container = getRuntime()->createContainer(CppNode::KIND);
-   }
-   
-   if(_container) {
-
-      CppContainer * containerC= dynamic_cast< CppContainer *> (_container);
-      
+  if (!_container)
+    {
+      _container = getRuntime()->createContainer(CppNode::KIND);
+    }
+
+  if(_container)
+    {
+      CppContainer *containerC(dynamic_cast< CppContainer *> (_container));
+      if(!containerC)
+        throw Exception("The type of container should be CPP for component CPP !");
       containerC->lock();//To be sure
-      if(!_container->isAlreadyStarted(this))
+      if(!_container->isAlreadyStarted(askingNode))
         {
           try
-            {
-              _container->start(this);
-            }
+          {
+              _container->start(askingNode);
+          }
           catch(Exception& e)
-            {
+          {
               containerC->unLock();
               throw e;
-            }
+          }
         }
       containerC->unLock();
       containerC->lock();//To be sure
-      
-      bool isLoadable = containerC->loadComponentLibrary(_compoName);
+
+      bool isLoadable(containerC->loadComponentLibrary(_compoName));
       if (isLoadable) 
         containerC->createInternalInstance(_compoName, __obj, __run, __terminate);
-        
+
       if(NULL == __obj)
         {
           containerC->unLock();
@@ -196,7 +197,6 @@ void CppComponent::load(ServiceNode *askingNode)
       containerC->unLock();
       return;
     }
-
 }
 
 ServiceNode* CppComponent::createNode(const std::string& name)
index b02a8e468948a8c3d4156cd7a61a4cabd1399d4b..50d32d5c52ebf341d30233c6c4fa4085dddb8baa 100644 (file)
@@ -56,9 +56,9 @@ namespace YACS
 
         static const char KIND[];
         virtual std::string getKind() const;
-        virtual void load(ServiceNode *askingNode);
-        virtual void unload(ServiceNode *askingNode);
-        virtual bool isLoaded(ServiceNode *askingNode);
+        virtual void load(Task *askingNode);
+        virtual void unload(Task *askingNode);
+        virtual bool isLoaded(Task *askingNode) const;
         virtual ServiceNode* createNode(const std::string& name);
         virtual YACS::ENGINE::ComponentInstance* clone() const;
         
index 1711814b052f66b5e43af5c83b7db4ca8f217bba..54bcc1d512f7988fc7954e3275e25698fe2d8757 100644 (file)
@@ -73,16 +73,21 @@ void CppContainer::unLock()
   _mutex.unlock();
 }
 
-bool CppContainer::isAlreadyStarted(const ComponentInstance *inst) const
+bool CppContainer::isAlreadyStarted(const Task *askingNode) const
 {
   return NULL != _trueCont;
 }
 
-void CppContainer::start(const ComponentInstance *inst) throw (YACS::Exception)
+void CppContainer::start(const Task *askingNode) throw (YACS::Exception)
 {
   _trueCont = LocalContainer::get();
 }
 
+void CppContainer::shutdown(int level)
+{
+
+}
+
 Container *CppContainer::clone() const
 {
   if(_isAttachedOnCloning)
@@ -100,60 +105,58 @@ Container *CppContainer::cloneAlways() const
 }
 
 bool CppContainer::loadComponentLibrary(const std::string & componentName) throw (YACS::Exception)
-{
-    if (_trueCont) 
     {
-       LocalLibrary L = _trueCont->loadComponentLibrary(componentName);
-       return L.good();
+  if (_trueCont)
+    {
+      LocalLibrary L = _trueCont->loadComponentLibrary(componentName);
+      return L.good();
     }
-    else 
+  else
     {
-       std::string mesg = "CppContainer not started";
-       throw YACS::Exception(mesg);
+      std::string mesg = "CppContainer not started";
+      throw YACS::Exception(mesg);
+    }
+  return false;
     }
-    return false;
-}
 
 CppComponent * CppContainer::createComponentInstance(const std::string & componentName, int /* studyID */)
 {
-    DEBTRACE("CppContainer::createComponentInstance");
-    if (_trueCont)
-       return _trueCont->createComponentInstance(componentName.c_str());
-    else 
+  DEBTRACE("CppContainer::createComponentInstance");
+  if (_trueCont)
+    return _trueCont->createComponentInstance(componentName.c_str());
+  else
     {
-       std::string mesg = "CppContainer not started";
-       throw YACS::Exception(mesg);
+      std::string mesg = "CppContainer not started";
+      throw YACS::Exception(mesg);
     }
 }
 
 void CppContainer::createInternalInstance(const std::string & name, void *&obj, 
                                           RunFunction &r, TerminateFunction &t)
 {
-   DEBTRACE("CppContainer::createInternalInstance");
-   if (_trueCont)
-      _trueCont->createInternalInstance(name.c_str(), obj, r, t);
-   else 
-   {
-     std::string mesg = "CppContainer not started";
-     throw YACS::Exception(mesg);
-   }
+  DEBTRACE("CppContainer::createInternalInstance");
+  if (_trueCont)
+    _trueCont->createInternalInstance(name.c_str(), obj, r, t);
+  else
+    {
+      std::string mesg = "CppContainer not started";
+      throw YACS::Exception(mesg);
+    }
 }
 
-void CppContainer::unregisterComponentInstance(CppComponent * C)
+void CppContainer::unregisterComponentInstance(CppComponent *compo)
 {
-    if (_trueCont) 
-    {
-       _trueCont->unregisterComponentInstance(C);
-    }
+  if (_trueCont)
+    _trueCont->unregisterComponentInstance(compo);
 }
 
 
-std::string CppContainer::getPlacementId(const ComponentInstance *inst) const
+std::string CppContainer::getPlacementId(const Task *askingNode) const
 {
   return "/";
 }
 
-std::string CppContainer::getFullPlacementId(const ComponentInstance *inst) const
+std::string CppContainer::getFullPlacementId(const Task *askingNode) const
 {
   return "/";
 }
@@ -189,31 +192,31 @@ LocalContainer * LocalContainer::get()
 
 void LocalContainer::destroy()
 {
-    if (NULL == _singleton)
-      return;
-    
-    // destroy all component instances
-    _instance_mapMutex.lock(); // lock
-    std::multimap<std::string, CppComponent *>::iterator iI, iJ;
-    for (iI=_instance_map.begin(); iI != _instance_map.end(); iI = iJ)
+  if (NULL == _singleton)
+    return;
+
+  // destroy all component instances
+  _instance_mapMutex.lock(); // lock
+  std::multimap<std::string, CppComponent *>::iterator iI, iJ;
+  for (iI=_instance_map.begin(); iI != _instance_map.end(); iI = iJ)
     {
       iJ = iI++;
       iI->second->setContainer(NULL);
       delete iI->second;
     }
-    _instance_map.clear();
-    _instance_mapMutex.unlock(); // unlock
-    
-    // unload all dynamic libraries
-    _library_mapMutex.lock();
-    std::map<std::string, LocalLibrary>::iterator iL;
-    for (iL=_library_map.begin(); iL != _library_map.end(); iL++)
-        dlclose(iL->second.handle);
-    _library_map.clear();
-    _library_mapMutex.unlock();
-    
-    delete _singleton;
-    _singleton = NULL;
+  _instance_map.clear();
+  _instance_mapMutex.unlock(); // unlock
+
+  // unload all dynamic libraries
+  _library_mapMutex.lock();
+  std::map<std::string, LocalLibrary>::iterator iL;
+  for (iL=_library_map.begin(); iL != _library_map.end(); iL++)
+    dlclose(iL->second.handle);
+  _library_map.clear();
+  _library_mapMutex.unlock();
+
+  delete _singleton;
+  _singleton = NULL;
 }
 
 
@@ -270,14 +273,14 @@ void LocalContainer::createInternalInstance(const char *name, void *&obj,
 
 void LocalContainer::unregisterComponentInstance(CppComponent * C)
 {
-    _instance_mapMutex.lock(); // lock to be alone 
-    _instance_map.erase(C->getCompoName());
-    _instance_mapMutex.unlock(); // unlock
+  _instance_mapMutex.lock(); // lock to be alone
+  _instance_map.erase(C->getCompoName());
+  _instance_mapMutex.unlock(); // unlock
 }
 
 inline void toupper (std::string & s)
 {
-   transform (s.begin (), s.end (), s.begin (), (int(*)(int)) toupper);
+  transform (s.begin (), s.end (), s.begin (), (int(*)(int)) toupper);
 }
 
 LocalLibrary  LocalContainer::loadComponentLibrary(const std::string & aCompName, const char * prefix, bool forcedLoad)
index 012e8d17a81a7dd42e7b6238ba17e59e0510358c..03ee0eb8e5dcf25f38a6985604864ade2490861e 100644 (file)
@@ -107,10 +107,11 @@ namespace YACS
     public:
       CppContainer();
       virtual ~CppContainer();
-      bool isAlreadyStarted(const ComponentInstance *inst) const;
-      void start(const ComponentInstance *inst) throw (YACS::Exception);
-      std::string getPlacementId(const ComponentInstance *inst) const;
-      std::string getFullPlacementId(const ComponentInstance *inst) const;
+      bool isAlreadyStarted(const Task *askingNode) const;
+      void start(const Task *askingNode) throw (YACS::Exception);
+      void shutdown(int level);
+      std::string getPlacementId(const Task *askingNode) const;
+      std::string getFullPlacementId(const Task *askingNode) const;
       YACS::ENGINE::Container *clone() const;
       Container *cloneAlways() const;
       void lock();
index 7150a6bd98d728b4b32fd3d230ec54525bbb7926..cb65eb18608d9d3a8d404c43894c80a96760d2ea 100644 (file)
@@ -117,7 +117,7 @@ void DistributedPythonNode::execute()
 {
   YACSTRACE(1,"+++++++++++++++++ DistributedPythonNode::execute: " << getName() << " " << getFname() << " +++++++++++++++++" );
   {
-    Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+    Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(this);
     Engines::PyNode_var pn=objContainer->createPyNode(getName().c_str(),getScript().c_str());
     //////
     int pos=0;
index bfd3b3a6814aa482658b581a9ea1b68f9c2f6b9d..bd33fbd14b6b1b952222d363c2a4368afe037f65 100644 (file)
@@ -132,11 +132,11 @@ void PythonNode::loadRemote()
   DEBTRACE( "---------------PyNode::loadRemote function---------------" );
   if(_container)
     {
-      if(!_container->isAlreadyStarted(0))
+      if(!_container->isAlreadyStarted(this))
         {
           try
             {
-              _container->start(0);
+              _container->start(this);
             }
           catch(Exception& e)
             {
@@ -153,7 +153,7 @@ void PythonNode::loadRemote()
       throw Exception(what);
     }
 
-  Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+  Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(this);
 
   try
     {
@@ -494,7 +494,7 @@ std::string PythonNode::getContainerLog()
   std::string msg;
   try
     {
-      Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+      Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(this);
       CORBA::String_var logname = objContainer->logfilename();
       DEBTRACE(logname);
       msg=logname;
@@ -637,11 +637,11 @@ void PyFuncNode::loadRemote()
   DEBTRACE( "---------------PyfuncNode::loadRemote function---------------" );
   if(_container)
     {
-      if(!_container->isAlreadyStarted(0))
+      if(!_container->isAlreadyStarted(this))
         {
           try
             {
-              _container->start(0);
+              _container->start(this);
             }
           catch(Exception& e)
             {
@@ -658,7 +658,7 @@ void PyFuncNode::loadRemote()
       throw Exception(what);
     }
 
-  Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+  Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(this);
   try
     {
       _pynode = objContainer->createPyNode(getName().c_str(),getScript().c_str());
@@ -1089,7 +1089,7 @@ std::string PyFuncNode::getContainerLog()
   std::string msg;
   try
     {
-      Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(0);
+      Engines::Container_var objContainer=((SalomeContainer*)_container)->getContainerPtr(this);
       CORBA::String_var logname = objContainer->logfilename();
       DEBTRACE(logname);
       msg=logname;
index da74e14ca31396bc5da1f979dabe445071f8007b..7134266dc2d6ab2d44e3a6b3fb3e3e63d756bb48 100644 (file)
@@ -55,6 +55,7 @@
 
 #include "SalomeContainer.hxx"
 #include "CppContainer.hxx"
+#include "SalomeHPContainer.hxx"
 
 //Nodes
 #include "PythonNode.hxx"
@@ -595,6 +596,8 @@ Container *RuntimeSALOME::createContainer(const std::string& kind)
 {
   if(kind == "" || kind == SalomeComponent::KIND)
     return new SalomeContainer;
+  if(kind==SalomeHPContainer::KIND)
+    return new SalomeHPContainer;
   else if (kind == CppComponent::KIND)
     return new CppContainer;
   std::string msg="Container kind ("+kind+") unknown";
index 37add9536396e41c51987211831c47131688cf2f..2a53981c55951668ab5b4f6f75a77a0f4c4de3a9 100644 (file)
@@ -61,14 +61,14 @@ std::string SalomeComponent::getKind() const
 }
 
 //! Unload the component 
-void SalomeComponent::unload(ServiceNode *askingNode)
+void SalomeComponent::unload(Task *askingNode)
 {
   //Not implemented
   std::cerr << "SalomeComponent::unload : not implemented " << std::endl;
 }
 
 //! Is the component instance already loaded ?
-bool SalomeComponent::isLoaded(ServiceNode *askingNode)
+bool SalomeComponent::isLoaded(Task *askingNode) const
 {
   if(CORBA::is_nil(_objComponent))
     return false;
@@ -78,7 +78,7 @@ bool SalomeComponent::isLoaded(ServiceNode *askingNode)
 
 #ifdef SALOME_KERNEL
 //! Load the component 
-void SalomeComponent::load(ServiceNode *askingNode)
+void SalomeComponent::load(Task *askingNode)
 {
   if(_container)
     {
@@ -96,7 +96,7 @@ void SalomeComponent::load(ServiceNode *askingNode)
   _objComponent=LCC.LoadComponent(params,_compoName.c_str());
 }
 #else
-void SalomeComponent::load(ServiceNode *askingNode)
+void SalomeComponent::load(Task *askingNode)
 {
   throw Exception("YACS has been built without SALOME support");
 }
index f28da09744143013ec4e5d50c6cd40a8f8c55319..743b5afcb1748558fb49542d819c0032d9670230 100644 (file)
@@ -28,8 +28,6 @@ namespace YACS
 {
   namespace ENGINE
   {
-    class ServiceNode;
-
 /*! \brief Class for Salome component instance
  *
  *
@@ -40,9 +38,9 @@ namespace YACS
       SalomeComponent(const std::string& name);
       SalomeComponent(const SalomeComponent& other);
       virtual ~SalomeComponent();
-      virtual void load(ServiceNode *askingNode);
-      virtual void unload(ServiceNode *askingNode);
-      virtual bool isLoaded(ServiceNode *askingNode);
+      virtual void load(Task *askingNode);
+      virtual void unload(Task *askingNode);
+      virtual bool isLoaded(Task *askingNode) const;
       virtual void setContainer(Container *cont);
       virtual ServiceNode* createNode(const std::string& name);
       virtual ComponentInstance* clone() const;
index 4dd6f719ec31a92d4ab0cd813f9c8d7f8d153b25..38ec232357b5274e0f2199b8d7900c4123c295ac 100644 (file)
@@ -57,7 +57,7 @@ SalomeContainer::SalomeContainer():_launchModeType(new SalomeContainerMonoHelper
 }
 
 SalomeContainer::SalomeContainer(const SalomeContainer& other)
-: Container(other),
+: Container(other),_componentNames(other._componentNames),
   _launchModeType(other._launchModeType->deepCpyOnlyStaticInfo()),
   _shutdownLevel(other._shutdownLevel),
   _sct(other._sct)
@@ -146,9 +146,9 @@ void SalomeContainer::addToResourceList(const std::string& name)
 /*!
  * \param inst the component instance to load
  */
-CORBA::Object_ptr SalomeContainer::loadComponent(ServiceNode *inst)
+CORBA::Object_ptr SalomeContainer::loadComponent(Task *askingNode)
 {
-  return SalomeContainerTools::LoadComponent(_launchModeType,this,inst->getComponent());
+  return SalomeContainerTools::LoadComponent(_launchModeType,this,askingNode);
 }
 
 //! Get the container placement id for a component instance
@@ -156,9 +156,9 @@ CORBA::Object_ptr SalomeContainer::loadComponent(ServiceNode *inst)
  * \param inst the component instance
  * \return the placement id
  */
-std::string SalomeContainer::getPlacementId(const ComponentInstance *inst) const
+std::string SalomeContainer::getPlacementId(const Task *askingNode) const
 {
-  return SalomeContainerTools::GetPlacementId(_launchModeType,this,inst);
+  return SalomeContainerTools::GetPlacementId(_launchModeType,this,askingNode);
 }
 
 //! Get the container full path for a component instance
@@ -166,9 +166,9 @@ std::string SalomeContainer::getPlacementId(const ComponentInstance *inst) const
  * \param inst the component instance
  * \return the full placement id
  */
-std::string SalomeContainer::getFullPlacementId(const ComponentInstance *inst) const
+std::string SalomeContainer::getFullPlacementId(const Task *askingNode) const
 {
-  return SalomeContainerTools::GetFullPlacementId(_launchModeType,this,inst);
+  return SalomeContainerTools::GetFullPlacementId(_launchModeType,this,askingNode);
 }
 
 //! Check if the component instance container is already started
@@ -176,23 +176,23 @@ std::string SalomeContainer::getFullPlacementId(const ComponentInstance *inst) c
  * \param inst the component instance
  * \return true, if the container is already started, else false
  */
-bool SalomeContainer::isAlreadyStarted(const ComponentInstance *inst) const
+bool SalomeContainer::isAlreadyStarted(const Task *askingNode) const
 {
-  return _launchModeType->isAlreadyStarted(inst);
+  return _launchModeType->isAlreadyStarted(askingNode);
 }
 
-Engines::Container_ptr SalomeContainer::getContainerPtr(const ComponentInstance *inst) const
+Engines::Container_ptr SalomeContainer::getContainerPtr(const Task *askingNode) const
 {
-  return Engines::Container::_duplicate(_launchModeType->getContainer(inst));
+  return Engines::Container::_duplicate(_launchModeType->getContainer(askingNode));
 }
 
 //! Start a salome container (true salome container not yacs one) with given ContainerParameters (_params)
 /*!
  * \param inst the component instance
  */
-void SalomeContainer::start(const ComponentInstance *inst) throw(YACS::Exception)
+void SalomeContainer::start(const Task *askingNode) throw(YACS::Exception)
 {
-  SalomeContainerTools::Start(_componentNames,_launchModeType,_sct,_shutdownLevel,this,inst);
+  SalomeContainerTools::Start(_componentNames,_launchModeType,_sct,_shutdownLevel,this,askingNode);
 }
 
 void SalomeContainer::shutdown(int level)
index 1c87e1156bbe291bd9635a790312cf8e0275a57c..5553e946e1ace8c50d1a7e06fe0e4f55cc9da387 100644 (file)
@@ -45,20 +45,20 @@ namespace YACS
       void lock();
       //! For thread safety for concurrent load operation on same Container.
       void unLock();
-      bool isAlreadyStarted(const ComponentInstance *inst) const;
-      Engines::Container_ptr getContainerPtr(const ComponentInstance *inst) const;
-      void start(const ComponentInstance *inst) throw (Exception);
+      bool isAlreadyStarted(const Task *askingNode) const;
+      Engines::Container_ptr getContainerPtr(const Task *askingNode) const;
+      void start(const Task *askingNode) throw (Exception);
       Container *clone() const;
       Container *cloneAlways() const;
-      std::string getPlacementId(const ComponentInstance *inst) const;
-      std::string getFullPlacementId(const ComponentInstance *inst) const;
+      std::string getPlacementId(const Task *askingNode) const;
+      std::string getFullPlacementId(const Task *askingNode) const;
       void checkCapabilityToDealWith(const ComponentInstance *inst) const throw (Exception);
       void setProperty(const std::string& name, const std::string& value);
       std::string getProperty(const std::string& name) const;
       void clearProperties();
       void addComponentName(const std::string& name);
       void addToResourceList(const std::string& name);
-      virtual CORBA::Object_ptr loadComponent(ServiceNode *inst);
+      virtual CORBA::Object_ptr loadComponent(Task *inst);
       void shutdown(int level);
       // Helper methods
       std::map<std::string,std::string> getResourceProperties(const std::string& name) const;
index 3afa30894d6449ef61e80c1111377b8aafd2cd23..9a9056863ca8da2db47cbdc9cee31229589e71e4 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "SalomeContainerHelper.hxx"
 
+#include "ServiceNode.hxx"
 #include "YacsTrace.hxx"
 
 #include <sstream>
@@ -54,12 +55,12 @@ SalomeContainerMonoHelper *SalomeContainerMonoHelper::deepCpyOnlyStaticInfo() co
   return new SalomeContainerMonoHelper;
 }
 
-Engines::Container_var SalomeContainerMonoHelper::getContainer(const ComponentInstance *inst) const
+Engines::Container_var SalomeContainerMonoHelper::getContainer(const Task *askingNode) const
 {
   return _trueCont;
 }
 
-bool SalomeContainerMonoHelper::isAlreadyStarted(const ComponentInstance *inst) const
+bool SalomeContainerMonoHelper::isAlreadyStarted(const Task *askingNode) const
 {
   if(CORBA::is_nil(_trueCont))
     return false;
@@ -67,7 +68,7 @@ bool SalomeContainerMonoHelper::isAlreadyStarted(const ComponentInstance *inst)
     return true;
 }
 
-void SalomeContainerMonoHelper::setContainer(const ComponentInstance *inst, Engines::Container_var cont)
+void SalomeContainerMonoHelper::setContainer(const Task *askingNode, Engines::Container_var cont)
 {
   _trueCont=cont;
 #ifdef REFCNT
@@ -106,8 +107,9 @@ SalomeContainerMultiHelper *SalomeContainerMultiHelper::deepCpyOnlyStaticInfo()
   return new SalomeContainerMultiHelper;
 }
 
-Engines::Container_var SalomeContainerMultiHelper::getContainer(const ComponentInstance *inst) const
+Engines::Container_var SalomeContainerMultiHelper::getContainer(const Task *askingNode) const
 {
+  const ComponentInstance *inst(askingNode?askingNode->getComponent():0);
   std::map<const ComponentInstance *,Engines::Container_var>::const_iterator it(_trueContainers.find(inst));
   if(it!=_trueContainers.end())
     return (*it).second;
@@ -115,16 +117,18 @@ Engines::Container_var SalomeContainerMultiHelper::getContainer(const ComponentI
     return Engines::Container::_nil();
 }
 
-bool SalomeContainerMultiHelper::isAlreadyStarted(const ComponentInstance *inst) const
+bool SalomeContainerMultiHelper::isAlreadyStarted(const Task *askingNode) const
 {
+  const ComponentInstance *inst(askingNode?askingNode->getComponent():0);
   if(_trueContainers.count(inst)==0)
     return false;
   else
     return true;
 }
 
-void SalomeContainerMultiHelper::setContainer(const ComponentInstance *inst, Engines::Container_var cont)
+void SalomeContainerMultiHelper::setContainer(const Task *askingNode, Engines::Container_var cont)
 {
+  const ComponentInstance *inst(askingNode?askingNode->getComponent():0);
   _trueContainers[inst]=cont;
 #ifdef REFCNT
     std::map<const ComponentInstance *, Engines::Container_var >::const_iterator it;
index 1ae0601eef016c38f3ce18bd5ac74e2635b88c6e..aa301a90b800afd6dff8d9794578c4c1a75db5ad 100644 (file)
@@ -32,6 +32,7 @@ namespace YACS
 {
   namespace ENGINE
   {
+    class Task;
     class ComponentInstance;
 
     class SalomeContainerHelper
@@ -39,9 +40,9 @@ namespace YACS
     public:
       virtual std::string getType() const = 0;
       virtual SalomeContainerHelper *deepCpyOnlyStaticInfo() const = 0;
-      virtual Engines::Container_var getContainer(const ComponentInstance *inst) const = 0;
-      virtual bool isAlreadyStarted(const ComponentInstance *inst) const = 0;
-      virtual void setContainer(const ComponentInstance *inst, Engines::Container_var cont) = 0;
+      virtual Engines::Container_var getContainer(const Task *askingNode) const = 0;
+      virtual bool isAlreadyStarted(const Task *askingNode) const = 0;
+      virtual void setContainer(const Task *askingNode, Engines::Container_var cont) = 0;
       virtual void shutdown() = 0;
       virtual ~SalomeContainerHelper();
     };
@@ -52,9 +53,9 @@ namespace YACS
       SalomeContainerMonoHelper();
       std::string getType() const;
       SalomeContainerMonoHelper *deepCpyOnlyStaticInfo() const;
-      Engines::Container_var getContainer(const ComponentInstance *inst) const;
-      bool isAlreadyStarted(const ComponentInstance *inst) const;
-      void setContainer(const ComponentInstance *inst, Engines::Container_var cont);
+      Engines::Container_var getContainer(const Task *askingNode) const;
+      bool isAlreadyStarted(const Task *askingNode) const;
+      void setContainer(const Task *askingNode, Engines::Container_var cont);
       void shutdown();
       ~SalomeContainerMonoHelper();
     public:
@@ -69,9 +70,9 @@ namespace YACS
     public:
       std::string getType() const;
       SalomeContainerMultiHelper *deepCpyOnlyStaticInfo() const;
-      Engines::Container_var getContainer(const ComponentInstance *inst) const;
-      bool isAlreadyStarted(const ComponentInstance *inst) const;
-      void setContainer(const ComponentInstance *inst, Engines::Container_var cont);
+      Engines::Container_var getContainer(const Task *askingNode) const;
+      bool isAlreadyStarted(const Task *askingNode) const;
+      void setContainer(const Task *askingNode, Engines::Container_var cont);
       void shutdown();
       ~SalomeContainerMultiHelper();
     public:
index fd3336efdd89e71a86ad7e769796312b91dc5caf..1976a9679476da65d075bccb85fdaff0df531c41 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "YacsTrace.hxx"
 #include "Proc.hxx"
+#include "ServiceNode.hxx"
 #include "ComponentInstance.hxx"
 #include "SalomeContainerHelper.hxx"
 #include "RuntimeSALOME.hxx"
@@ -299,7 +300,7 @@ std::map<std::string,std::string> SalomeContainerTools::getResourceProperties(co
  * \param [in] compoNames
  * \param [in,out] shutdownLevel
  */
-void SalomeContainerTools::Start(const std::vector<std::string>& compoNames, SalomeContainerHelper *schelp, SalomeContainerTools& sct, int& shutdownLevel, const Container *cont, const ComponentInstance *inst)
+void SalomeContainerTools::Start(const std::vector<std::string>& compoNames, SalomeContainerHelper *schelp, SalomeContainerTools& sct, int& shutdownLevel, const Container *cont, const Task *askingNode)
 {
   CORBA::ORB_ptr orb(getSALOMERuntime()->getOrb());
   SALOME_NamingService ns;
@@ -399,21 +400,22 @@ void SalomeContainerTools::Start(const std::vector<std::string>& compoNames, Sal
   if(CORBA::is_nil(trueCont))
     throw Exception("SalomeContainer::start : Unable to launch container in Salome. Check your CatalogResources.xml file");
 
-  schelp->setContainer(inst,trueCont);
+  schelp->setContainer(askingNode,trueCont);
 
   CORBA::String_var containerName(trueCont->name()),hostName(trueCont->getHostName());
   std::cerr << "SalomeContainer launched : " << containerName << " " << hostName << " " << trueCont->getPID() << std::endl;
 }
 
-CORBA::Object_ptr SalomeContainerTools::LoadComponent(SalomeContainerHelper *launchModeType, Container *cont, ComponentInstance *inst)
+CORBA::Object_ptr SalomeContainerTools::LoadComponent(SalomeContainerHelper *launchModeType, Container *cont, Task *askingNode)
 {
   DEBTRACE("SalomeContainer::loadComponent ");
   cont->lock();//To be sure
-  if(!cont->isAlreadyStarted(inst))
+  const ComponentInstance *inst(askingNode?askingNode->getComponent():0);
+  if(!cont->isAlreadyStarted(askingNode))
     {
       try
         {
-          cont->start(inst);
+          cont->start(askingNode);
         }
       catch(Exception& e)
         {
@@ -426,7 +428,7 @@ CORBA::Object_ptr SalomeContainerTools::LoadComponent(SalomeContainerHelper *lau
   CORBA::Object_ptr objComponent=CORBA::Object::_nil();
   std::string compoName(inst->getCompoName());
   const char* componentName=compoName.c_str();
-  Engines::Container_var container(launchModeType->getContainer(inst));
+  Engines::Container_var container(launchModeType->getContainer(askingNode));
 
   char* reason;
 
@@ -478,11 +480,11 @@ CORBA::Object_ptr SalomeContainerTools::LoadComponent(SalomeContainerHelper *lau
   return objComponent;
 }
 
-std::string SalomeContainerTools::GetPlacementId(SalomeContainerHelper *launchModeType, const Container *cont, const ComponentInstance *inst)
+std::string SalomeContainerTools::GetPlacementId(const SalomeContainerHelper *launchModeType, const Container *cont, const Task *askingNode)
 {
-  if(cont->isAlreadyStarted(inst))
+  if(cont->isAlreadyStarted(askingNode))
     {
-      Engines::Container_var container(launchModeType->getContainer(inst));
+      Engines::Container_var container(launchModeType->getContainer(askingNode));
       const char *what="/";
       CORBA::String_var corbaStr(container->name());
       std::string ret(corbaStr);
@@ -498,11 +500,11 @@ std::string SalomeContainerTools::GetPlacementId(SalomeContainerHelper *launchMo
     return "Not placed yet !!!";
 }
 
-std::string SalomeContainerTools::GetFullPlacementId(SalomeContainerHelper *launchModeType, const Container *cont, const ComponentInstance *inst)
+std::string SalomeContainerTools::GetFullPlacementId(const SalomeContainerHelper *launchModeType, const Container *cont, const Task *askingNode)
 {
-  if(cont->isAlreadyStarted(inst))
+  if(cont->isAlreadyStarted(askingNode))
     {
-      Engines::Container_var container(launchModeType->getContainer(inst));
+      Engines::Container_var container(launchModeType->getContainer(askingNode));
       try
       {
           CORBA::String_var corbaStr(container->name());
index 1ef95fb6166ac36c8e47ee70eaa9133d317f1727..deb6cdb5b3bedb477d3383fd6659a263c0ce91cb 100644 (file)
@@ -32,6 +32,7 @@ namespace YACS
 {
   namespace ENGINE
   {
+    class Task;
     class Container;
     class ComponentInstance;
     class SalomeContainerHelper;
@@ -55,10 +56,10 @@ namespace YACS
       std::string getHostName() const;
       Engines::ContainerParameters getParameters() const { return _params; }
     public:
-      static void Start(const std::vector<std::string>& compoNames, SalomeContainerHelper *schelp, SalomeContainerTools& sct, int& shutdownLevel, const Container *cont, const ComponentInstance *inst);
-      static CORBA::Object_ptr LoadComponent(SalomeContainerHelper *launchModeType, Container *cont, ComponentInstance *inst);
-      static std::string GetPlacementId(SalomeContainerHelper *launchModeType, const Container *cont, const ComponentInstance *inst);
-      static std::string GetFullPlacementId(SalomeContainerHelper *launchModeType, const Container *cont, const ComponentInstance *inst);
+      static void Start(const std::vector<std::string>& compoNames, SalomeContainerHelper *schelp, SalomeContainerTools& sct, int& shutdownLevel, const Container *cont, const Task *askingNode);
+      static CORBA::Object_ptr LoadComponent(SalomeContainerHelper *launchModeType, Container *cont, Task *askingNode);
+      static std::string GetPlacementId(const SalomeContainerHelper *launchModeType, const Container *cont, const Task *askingNode);
+      static std::string GetFullPlacementId(const SalomeContainerHelper *launchModeType, const Container *cont, const Task *askingNode);
     protected:
       std::map<std::string,std::string> _propertyMap;
       Engines::ContainerParameters _params;
index aee80db77a4d4487a1f1776907bcf036f28fa0d6..91c9f9d605389831c5cde87b14fff65c75be5693 100644 (file)
 //
 
 #include "SalomeHPContainer.hxx"
+#include "SalomeComponent.hxx"
+
+#include <algorithm>
 
 using namespace YACS::ENGINE;
 
+const char SalomeHPContainer::KIND[]="HPSalome";
+
 SalomeHPContainer::SalomeHPContainer():_shutdownLevel(999)
 {
 }
 
-SalomeHPContainer::SalomeHPContainer(const SalomeHPContainer& other):_shutdownLevel(999)
+SalomeHPContainer::SalomeHPContainer(const SalomeHPContainer& other):_componentNames(other._componentNames),_shutdownLevel(999),_sct(other._sct)
 {
 }
 
@@ -34,6 +39,112 @@ void SalomeHPContainer::setSizeOfPool(int sz)
   _launchModeType.resize(sz);
 }
 
+std::size_t SalomeHPContainer::getNumberOfFreePlace() const
+{
+  return _launchModeType.getNumberOfFreePlace();
+}
+
+void SalomeHPContainer::allocateFor(const std::vector<const Task *>& nodes)
+{
+  _launchModeType.allocateFor(nodes);
+}
+
+void SalomeHPContainer::release(Task *node)
+{
+  _launchModeType.release(node);
+}
+
 SalomeHPContainer::~SalomeHPContainer()
 {
 }
+
+void SalomeHPContainer::lock()
+{
+  _mutex.lock();
+}
+
+void SalomeHPContainer::unLock()
+{
+  _mutex.unlock();
+}
+
+bool SalomeHPContainer::isAlreadyStarted(const Task *askingNode) const
+{
+  const SalomeContainerMonoHelper& helper(_launchModeType.getHelperOfTask(askingNode));
+  return helper.isAlreadyStarted(askingNode);
+}
+
+void SalomeHPContainer::start(const Task *askingNode) throw(Exception)
+{
+  SalomeContainerMonoHelper& helper(_launchModeType.getHelperOfTask(askingNode));
+  SalomeContainerTools::Start(_componentNames,&helper,_sct,_shutdownLevel,this,askingNode);
+}
+
+void SalomeHPContainer::shutdown(int level)
+{
+  if(level < _shutdownLevel)
+      return;
+  _shutdownLevel=999;
+  for(std::size_t i=0;_launchModeType.size();i++)
+    {
+      SalomeContainerMonoHelper& helper(_launchModeType.at(i));
+      helper.shutdown();
+    }
+}
+
+std::string SalomeHPContainer::getPlacementId(const Task *askingNode) const
+{
+  const SalomeContainerMonoHelper& helper(_launchModeType.getHelperOfTask(askingNode));
+  return SalomeContainerTools::GetPlacementId(&helper,this,askingNode);
+}
+
+std::string SalomeHPContainer::getFullPlacementId(const Task *askingNode) const
+{
+  const SalomeContainerMonoHelper& helper(_launchModeType.getHelperOfTask(askingNode));
+  return SalomeContainerTools::GetFullPlacementId(&helper,this,askingNode);
+}
+
+/*!
+ * It is not a bug here ! clone for homogeneous container is not supposed to be copied !
+ */
+Container *SalomeHPContainer::clone() const
+{
+  incrRef();
+  return const_cast<SalomeHPContainer*>(this);
+}
+
+Container *SalomeHPContainer::cloneAlways() const
+{
+  return new SalomeHPContainer(*this);
+}
+
+void SalomeHPContainer::setProperty(const std::string& name,const std::string& value)
+{
+  _sct.setProperty(name,value);
+}
+
+std::string SalomeHPContainer::getProperty(const std::string& name) const
+{
+  return _sct.getProperty(name);
+}
+
+void SalomeHPContainer::clearProperties()
+{
+  _sct.clearProperties();
+}
+
+std::map<std::string,std::string> SalomeHPContainer::getProperties() const
+{
+  return _sct.getProperties();
+}
+
+std::map<std::string,std::string> SalomeHPContainer::getResourceProperties(const std::string& name) const
+{
+  return _sct.getResourceProperties(name);
+}
+
+void SalomeHPContainer::checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception)
+{
+  if(inst->getKind()!=SalomeComponent::KIND)
+    throw Exception("SalomeHPContainer::checkCapabilityToDealWith : SalomeContainer is not able to deal with this type of ComponentInstance.");
+}
index 53033cd26219227c488ac4089f03f9cc4cc156c8..28e8f563c1500c474e289be16747ff0702988239 100644 (file)
 #include "HomogeneousPoolContainer.hxx"
 #include "SalomeContainerHelper.hxx"
 #include "SalomeContainerTools.hxx"
+#include "SalomeHPContainerTools.hxx"
 #include "Mutex.hxx"
 #include <string>
 #include <vector>
+#include <map>
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_Component)
 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
@@ -35,6 +37,7 @@ namespace YACS
 {
   namespace ENGINE
   {
+    class Task;
     class SalomeComponent;
 
     class YACSRUNTIMESALOME_EXPORT SalomeHPContainer : public HomogeneousPoolContainer
@@ -42,17 +45,42 @@ namespace YACS
     public:
       SalomeHPContainer();
       SalomeHPContainer(const SalomeHPContainer& other);
+      //HP specific part
       void setSizeOfPool(int sz);
+      std::size_t getNumberOfFreePlace() const;
+      void allocateFor(const std::vector<const Task *>& nodes);
+      void release(Task *node);
+      //! For thread safety for concurrent load operation on same Container.
+      void lock();
+      //! For thread safety for concurrent load operation on same Container.
+      void unLock();
+      //
+      bool isAlreadyStarted(const Task *askingNode) const;
+      void start(const Task *askingNode) throw(Exception);
+      void shutdown(int level);
+      std::string getPlacementId(const Task *askingNode) const;
+      std::string getFullPlacementId(const Task *askingNode) const;
+      Container *clone() const;
+      Container *cloneAlways() const;
+      void setProperty(const std::string& name,const std::string& value);
+      std::string getProperty(const std::string& name) const;
+      void clearProperties();
+      std::map<std::string,std::string> getProperties() const;
+      std::map<std::string,std::string> getResourceProperties(const std::string& name) const;
+      void checkCapabilityToDealWith(const ComponentInstance *inst) const throw(YACS::Exception);
+    public:
+      static const char KIND[];
     protected:
 #ifndef SWIG
       ~SalomeHPContainer();
 #endif
     protected:
-      YACS::BASES::Mutex _mutex;
-      std::vector<std::string> _componentNames;
-      std::vector<SalomeContainerMonoHelper> _launchModeType;
       int _shutdownLevel;
       SalomeContainerTools _sct;
+      YACS::BASES::Mutex _mutex;
+      std::vector<std::string> _componentNames;
+      //
+      SalomeHPContainerVectOfHelper _launchModeType;
     };
   }
 }
diff --git a/src/runtime/SalomeHPContainerTools.cxx b/src/runtime/SalomeHPContainerTools.cxx
new file mode 100644 (file)
index 0000000..59e45fd
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright (C) 2006-2014  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "SalomeHPContainerTools.hxx"
+#include "Exception.hxx"
+
+#include <algorithm>
+
+using namespace YACS::ENGINE;
+
+void SalomeHPContainerVectOfHelper::resize(std::size_t sz)
+{
+  checkNoCurrentWork();
+  _whichOccupied.resize(sz); std::fill(_whichOccupied.begin(),_whichOccupied.end(),false);
+  _launchModeType.clear(); _launchModeType.resize(sz);
+  _currentlyWorking.clear();
+}
+
+std::size_t SalomeHPContainerVectOfHelper::getNumberOfFreePlace() const
+{
+  return std::count(_whichOccupied.begin(),_whichOccupied.end(),false);
+}
+
+void SalomeHPContainerVectOfHelper::allocateFor(const std::vector<const Task *>& nodes)
+{
+  for(std::vector<const Task *>::const_iterator it=nodes.begin();it!=nodes.end();it++)
+    {
+      if(!(*it))
+        continue;
+      if(_currentlyWorking.find(*it)!=_currentlyWorking.end())
+        throw Exception("Searching to allocate for a ServiceNode instance already declared as allocated !");
+      std::vector<bool>::iterator it2(std::find(_whichOccupied.begin(),_whichOccupied.end(),false));
+      if(it2==_whichOccupied.end())
+        throw Exception("All ressources are already occupied ! You are expected to wait for released resources !");
+      std::size_t pos(std::distance(_whichOccupied.begin(),it2));
+      _currentlyWorking[*it]=pos; _whichOccupied[pos]=true;
+    }
+}
+
+void SalomeHPContainerVectOfHelper::release(const Task *node)
+{
+  if(!node)
+    return ;
+  std::map< const Task *,std::size_t >::iterator it(_currentlyWorking.find(node));
+  if(it==_currentlyWorking.end())
+    throw Exception("Request to release a resource not declared as working !");
+  _whichOccupied[(*it).second]=false;
+  _currentlyWorking.erase(it);
+}
+
+const SalomeContainerMonoHelper& SalomeHPContainerVectOfHelper::getHelperOfTask(const Task *node) const
+{
+  return _launchModeType[locateTask(node)];
+}
+
+SalomeContainerMonoHelper& SalomeHPContainerVectOfHelper::getHelperOfTask(const Task *node)
+{
+  return _launchModeType[locateTask(node)];
+}
+
+std::size_t SalomeHPContainerVectOfHelper::locateTask(const Task *node) const
+{
+  std::map< const Task *,std::size_t >::const_iterator it(_currentlyWorking.find(node));
+  if(it==_currentlyWorking.end())
+    throw Exception("current Node to be located is not marked as launched !");
+  std::size_t ret((*it).second);
+  checkPosInVec(ret);
+  return ret;
+}
+
+void SalomeHPContainerVectOfHelper::checkNoCurrentWork() const
+{
+  for(std::map<const Task *,std::size_t >::const_iterator it=_currentlyWorking.begin();it!=_currentlyWorking.end();it++)
+    if((*it).first)
+      throw Exception("Something wrong a node is still declared to be using the ressource !");
+  for(std::vector<SalomeContainerMonoHelper>::const_iterator it=_launchModeType.begin();it!=_launchModeType.end();it++)
+    if((*it).isAlreadyStarted(0))
+      throw Exception("Some of the containers have be started ! Please shutdown them before !");
+}
+
+void SalomeHPContainerVectOfHelper::checkPosInVec(std::size_t pos) const
+{
+  if(pos<0 || pos>=_launchModeType.size())
+    throw Exception("The task has been found, but its id is not in the correct range ! resize of of container size during run ?");
+}
diff --git a/src/runtime/SalomeHPContainerTools.hxx b/src/runtime/SalomeHPContainerTools.hxx
new file mode 100644 (file)
index 0000000..c052cbe
--- /dev/null
@@ -0,0 +1,60 @@
+// Copyright (C) 2006-2014  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
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __SALOMEHPCONTAINERTOOLS_HXX__
+#define __SALOMEHPCONTAINERTOOLS_HXX__
+
+#include "YACSRuntimeSALOMEExport.hxx"
+#include "SalomeContainerHelper.hxx"
+
+#include <map>
+#include <vector>
+
+namespace YACS
+{
+  namespace ENGINE
+  {
+    class Task;
+    class SalomeComponent;
+
+    class SalomeHPContainerVectOfHelper
+    {
+    public:
+      std::size_t size() const { return _launchModeType.size(); }
+      void resize(std::size_t sz);
+      std::size_t getNumberOfFreePlace() const;
+      void allocateFor(const std::vector<const Task *>& nodes);
+      void release(const Task *node);
+      const SalomeContainerMonoHelper& at(std::size_t pos) const { checkPosInVec(pos); return _launchModeType[pos]; }
+      SalomeContainerMonoHelper& at(std::size_t pos) { checkPosInVec(pos); return _launchModeType[pos]; }
+      const SalomeContainerMonoHelper& getHelperOfTask(const Task *node) const;
+      SalomeContainerMonoHelper& getHelperOfTask(const Task *node);
+    private:
+      std::size_t locateTask(const Task *node) const;
+      void checkNoCurrentWork() const;
+      void checkPosInVec(std::size_t pos) const;
+    private:
+      std::vector<bool> _whichOccupied;
+      std::vector<SalomeContainerMonoHelper> _launchModeType;
+      std::map<const Task *,std::size_t > _currentlyWorking;
+    };
+  }
+}
+
+#endif
index fc6912fdeff0c77153fa39f88f58085f60c319ea..4ece848522f15c223760bf8958b0a54dc1bcca01 100644 (file)
@@ -44,11 +44,11 @@ SalomePythonComponent::~SalomePythonComponent()
 {
 }
 
-void SalomePythonComponent::load(ServiceNode *askingNode)
+void SalomePythonComponent::load(Task *askingNode)
 {
   if(_container)
     {
-      _container->start(this);
+      _container->start(askingNode);
       return;
     }
   //This component has no specified container : use default container policy
@@ -56,16 +56,16 @@ void SalomePythonComponent::load(ServiceNode *askingNode)
   //throw Exception("SalomePythonComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
 }
 
-void SalomePythonComponent::unload(ServiceNode *askingNode)
+void SalomePythonComponent::unload(Task *askingNode)
 {
 }
 
-bool SalomePythonComponent::isLoaded(ServiceNode *askingNode)
+bool SalomePythonComponent::isLoaded(Task *askingNode) const
 {
   if(!_container)
     return false;
   else
-    return _container->isAlreadyStarted(this);
+    return _container->isAlreadyStarted(askingNode);
 }
 
 std::string SalomePythonComponent::getKind() const
@@ -99,10 +99,10 @@ std::string SalomePythonComponent::getFileRepr() const
   return stream.str();
 }
 
-std::string SalomePythonComponent::getStringValueToExportInInterp() const
+std::string SalomePythonComponent::getStringValueToExportInInterp(const Task *askingNode) const
 {
   if(!_container)
     return "localhost/FactoryServer";
   else
-    return _container->getPlacementId(this);
+    return _container->getPlacementId(askingNode);
 }
index d7701c383a3378d14e9c2cecb17cad34ed10c19c..58bf7287a0dd25e46c3dccf3a92d264d4f8f7605 100644 (file)
@@ -33,15 +33,15 @@ namespace YACS
       SalomePythonComponent(const SalomePythonComponent& other);
       std::string getPlacementId() const;
       virtual ~SalomePythonComponent();
-      virtual void load(ServiceNode *askingNode);
-      virtual void unload(ServiceNode *askingNode);
-      virtual bool isLoaded(ServiceNode *askingNode);
+      virtual void load(Task *askingNode);
+      virtual void unload(Task *askingNode);
+      virtual bool isLoaded(Task *askingNode) const;
       virtual std::string getKind() const;
       virtual ComponentInstance* clone() const;
       virtual std::string getFileRepr() const;
       virtual ServiceNode *createNode(const std::string &name);
       //! The specific method that justified SalomePythonComponent class.
-      std::string getStringValueToExportInInterp() const;
+      std::string getStringValueToExportInInterp(const Task *askingNode) const;
     public:
       unsigned _cntForRepr;
       static unsigned _cntForReprS;
index 4f3b55d102a0d918a6b309743dba8e8c369a21fa..773efe7addb08c23108def53bab38683661224e6 100644 (file)
@@ -71,7 +71,7 @@ void SalomePythonNode::load()
   ServiceInlineNode::load();
   cerr << "---------------SalomePythonNode::load function---------------" << endl;
   list<OutputPort *>::iterator iter;
-  string value2Export=((SalomePythonComponent*)_component)->getStringValueToExportInInterp();
+  string value2Export=((SalomePythonComponent*)_component)->getStringValueToExportInInterp(this);
   PyObject* ob=PyString_FromString(value2Export.c_str());
   PyDict_SetItemString(_context,PLACEMENT_VAR_NAME_IN_INTERP,ob);
   for(iter = _setOfOutputPort.begin(); iter != _setOfOutputPort.end(); iter++)
index b7eb87f44a8f501a92d276db985e90fce43d09d8..b06663b1946abd5a86623b275d166d938ec73106 100644 (file)
@@ -44,6 +44,7 @@
 
 %{
 #include "SalomeContainer.hxx"
+#include "SalomeHPContainer.hxx"
 #include "RuntimeSALOME.hxx"
 #include "SALOMEDispatcher.hxx"
 #include "SalomeProc.hxx"
 
 %include <YACSRuntimeSALOMEExport.hxx>
 %include "SalomeContainer.hxx"
+%include "SalomeHPContainer.hxx"
 %include "RuntimeSALOME.hxx"
 %include "SALOMEDispatcher.hxx"
 %include "SalomeProc.hxx"