Salome HOME
Modification of API of ComponentInstance::load to give information of which node...
authorAnthony Geay <anthony.geay@edf.fr>
Thu, 31 Jul 2014 14:34:13 +0000 (16:34 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Thu, 31 Jul 2014 14:34:13 +0000 (16:34 +0200)
14 files changed:
src/engine/ComponentInstance.hxx
src/engine/ServiceNode.cxx
src/engine/Test/ComponentInstanceTest.cxx
src/engine/Test/ComponentInstanceTest.hxx
src/runtime/CORBAComponent.cxx
src/runtime/CORBAComponent.hxx
src/runtime/CppComponent.cxx
src/runtime/CppComponent.hxx
src/runtime/SalomeComponent.cxx
src/runtime/SalomeComponent.hxx
src/runtime/SalomeContainer.cxx
src/runtime/SalomeContainer.hxx
src/runtime/SalomePythonComponent.cxx
src/runtime/SalomePythonComponent.hxx

index c56a13131480d3a4d5520dcaae2670f6f86f21cd..d3caef620ffb8ae13e91d379b2dae4b5d9106aa7 100644 (file)
@@ -50,11 +50,11 @@ namespace YACS
       virtual void setContainer(Container *cont);
       Container *getContainer() const { return _container; }
 //! Load the component instance
-      virtual void load() = 0;
+      virtual void load(ServiceNode *askingNode) = 0;
 //! Unload the component instance
-      virtual void unload() = 0;
+      virtual void unload(ServiceNode *askingNode) = 0;
 //! Indicate if the component instance is loaded (true) or not
-      virtual bool isLoaded() = 0;
+      virtual bool isLoaded(ServiceNode *askingNode) = 0;
       virtual void attachOnCloning() const;
       virtual void dettachOnCloning() const;
       bool isAttachedOnCloning() const;
index f150939ade7d036ae9d21d2ade9814ad9e4fd7bf..8f9f312f3797159e3cbdb7f6e528f5b36d7774e0 100644 (file)
@@ -80,11 +80,11 @@ void ServiceNode::load()
 {
   if(_component)
     {
-      if(!_component->isLoaded())
+      if(!_component->isLoaded(this))
         {
           try
             {
-              _component->load();
+              _component->load(this);
             }
           catch(Exception& e)
             {
index 97821be31bdab1d8c917b909ff7d12c7fd5f7525..6cc6b79f5295f8ba0d64c3fe996f0781d4e0dfbb 100644 (file)
@@ -31,17 +31,17 @@ ComponentInstanceTest1::ComponentInstanceTest1(const std::string& name):Componen
 {
 }
 
-void ComponentInstanceTest1::load()
+void ComponentInstanceTest1::load(ServiceNode *askingNode)
 {
   _loaded=true;
 }
 
-void ComponentInstanceTest1::unload()
+void ComponentInstanceTest1::unload(ServiceNode *askingNode)
 {
   _loaded=false;
 }
 
-bool ComponentInstanceTest1::isLoaded()
+bool ComponentInstanceTest1::isLoaded(ServiceNode *askingNode)
 {
   return _loaded;
 }
@@ -77,17 +77,17 @@ ComponentInstanceTest2::ComponentInstanceTest2(const std::string& name):Componen
 {
 }
 
-void ComponentInstanceTest2::load()
+void ComponentInstanceTest2::load(ServiceNode *askingNode)
 {
   _loaded=true;
 }
 
-void ComponentInstanceTest2::unload()
+void ComponentInstanceTest2::unload(ServiceNode *askingNode)
 {
   _loaded=false;
 }
 
-bool ComponentInstanceTest2::isLoaded()
+bool ComponentInstanceTest2::isLoaded(ServiceNode *askingNode)
 {
   return _loaded;
 }
index de03d9c1f065325d8a882864f9c35d086477da43..503867f2d203463f9298561d31d390de2ba60d36 100644 (file)
@@ -31,9 +31,9 @@ namespace YACS
     public:
       ComponentInstanceTest1(const ComponentInstanceTest1& other);
       ComponentInstanceTest1(const std::string& name);
-      void load();
-      void unload();
-      bool isLoaded();
+      void load(ServiceNode *askingNode);
+      void unload(ServiceNode *askingNode);
+      bool isLoaded(ServiceNode *askingNode);
       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();
-      void unload();
-      bool isLoaded();
+      void load(ServiceNode *askingNode);
+      void unload(ServiceNode *askingNode);
+      bool isLoaded(ServiceNode *askingNode);
       std::string getKind() const;
       ServiceNode* createNode(const std::string& name);
       ComponentInstance *clone() const;
index 93c265121fbafd0cc92136b4c7ed025b22d70eb4..538eebe146b9cd048ebfde1a03d3dcadbd1eed2c 100644 (file)
@@ -69,7 +69,7 @@ std::string CORBAComponent::getKind() const
 }
 
 //! Unload the component 
-void CORBAComponent::unload()
+void CORBAComponent::unload(ServiceNode *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()
+bool CORBAComponent::isLoaded(ServiceNode *askingNode)
 {
   if(CORBA::is_nil(_objComponent))
     return false;
@@ -93,7 +93,7 @@ bool CORBAComponent::isLoaded()
 }
 
 //! Load the component 
-void CORBAComponent::load()
+void CORBAComponent::load(ServiceNode *askingNode)
 {
   DEBTRACE( "CORBAComponent::load" );
   CORBA::ORB_ptr orb;
index 869202e0e02fdbb06fcd9a5d68384a6e12a544f4..1b93f69d2f867365824f511bd1a04aaefba8fc60 100644 (file)
@@ -39,9 +39,9 @@ namespace YACS
       CORBAComponent(const std::string& name);
       CORBAComponent(const CORBAComponent& other);
       virtual ~CORBAComponent();
-      virtual void load();
-      virtual void unload();
-      virtual bool isLoaded();
+      virtual void load(ServiceNode *askingNode);
+      virtual void unload(ServiceNode *askingNode);
+      virtual bool isLoaded(ServiceNode *askingNode);
       virtual ServiceNode* createNode(const std::string& name);
       virtual ComponentInstance* clone() const;
       virtual std::string getFileRepr() const;
index 42e2878294981eab7e97780710269584241639f1..fb877df382bb811207b9ec5abc24b127a00f0a00 100644 (file)
@@ -146,19 +146,19 @@ void CppComponent::run (const char * service, int nbIn, int nbOut,
 }
 
 //! Unload the component 
-void CppComponent::unload()
+void CppComponent::unload(ServiceNode *askingNode)
 {
   //Not implemented
   DEBTRACE("CppComponent::unload : not implemented ");
 }
 
 //! Is the component instance already loaded ?
-bool CppComponent::isLoaded()
+bool CppComponent::isLoaded(ServiceNode *askingNode)
 {
   return NULL != __obj;
 }
  
-void CppComponent::load()
+void CppComponent::load(ServiceNode *askingNode)
 {
    if (!_container) {
      _container = getRuntime()->createContainer(CppNode::KIND);
index 56cfa1ff691ca5f94ccb7120ff25adbad80e85d7..b02a8e468948a8c3d4156cd7a61a4cabd1399d4b 100644 (file)
@@ -56,9 +56,9 @@ namespace YACS
 
         static const char KIND[];
         virtual std::string getKind() const;
-        virtual void load();
-        virtual void unload();
-        virtual bool isLoaded();
+        virtual void load(ServiceNode *askingNode);
+        virtual void unload(ServiceNode *askingNode);
+        virtual bool isLoaded(ServiceNode *askingNode);
         virtual ServiceNode* createNode(const std::string& name);
         virtual YACS::ENGINE::ComponentInstance* clone() const;
         
index ad344b9f9c27243c9c8f08a26b396c6ef69c53be..37add9536396e41c51987211831c47131688cf2f 100644 (file)
@@ -61,14 +61,14 @@ std::string SalomeComponent::getKind() const
 }
 
 //! Unload the component 
-void SalomeComponent::unload()
+void SalomeComponent::unload(ServiceNode *askingNode)
 {
   //Not implemented
   std::cerr << "SalomeComponent::unload : not implemented " << std::endl;
 }
 
 //! Is the component instance already loaded ?
-bool SalomeComponent::isLoaded()
+bool SalomeComponent::isLoaded(ServiceNode *askingNode)
 {
   if(CORBA::is_nil(_objComponent))
     return false;
@@ -78,11 +78,11 @@ bool SalomeComponent::isLoaded()
 
 #ifdef SALOME_KERNEL
 //! Load the component 
-void SalomeComponent::load()
+void SalomeComponent::load(ServiceNode *askingNode)
 {
   if(_container)
     {
-      _objComponent=((SalomeContainer*)_container)->loadComponent(this);
+      _objComponent=((SalomeContainer*)_container)->loadComponent(askingNode);
       return;
     }
   //throw Exception("SalomeComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
@@ -96,7 +96,7 @@ void SalomeComponent::load()
   _objComponent=LCC.LoadComponent(params,_compoName.c_str());
 }
 #else
-void SalomeComponent::load()
+void SalomeComponent::load(ServiceNode *askingNode)
 {
   throw Exception("YACS has been built without SALOME support");
 }
index 9b76ea7c164eca98e66b3a8185e2af11fd33ca0a..f28da09744143013ec4e5d50c6cd40a8f8c55319 100644 (file)
@@ -40,9 +40,9 @@ namespace YACS
       SalomeComponent(const std::string& name);
       SalomeComponent(const SalomeComponent& other);
       virtual ~SalomeComponent();
-      virtual void load();
-      virtual void unload();
-      virtual bool isLoaded();
+      virtual void load(ServiceNode *askingNode);
+      virtual void unload(ServiceNode *askingNode);
+      virtual bool isLoaded(ServiceNode *askingNode);
       virtual void setContainer(Container *cont);
       virtual ServiceNode* createNode(const std::string& name);
       virtual ComponentInstance* clone() const;
index ef67c063149b2a1a3f852cfb7b047c650c0dfd5b..4dd6f719ec31a92d4ab0cd813f9c8d7f8d153b25 100644 (file)
@@ -29,6 +29,7 @@
 #include "RuntimeSALOME.hxx"
 #include "SalomeContainer.hxx"
 #include "SalomeComponent.hxx"
+#include "ServiceNode.hxx"
 #include "Proc.hxx"
 
 #include "SALOME_NamingService.hxx"
@@ -145,9 +146,9 @@ void SalomeContainer::addToResourceList(const std::string& name)
 /*!
  * \param inst the component instance to load
  */
-CORBA::Object_ptr SalomeContainer::loadComponent(ComponentInstance *inst)
+CORBA::Object_ptr SalomeContainer::loadComponent(ServiceNode *inst)
 {
-  return SalomeContainerTools::LoadComponent(_launchModeType,this,inst);
+  return SalomeContainerTools::LoadComponent(_launchModeType,this,inst->getComponent());
 }
 
 //! Get the container placement id for a component instance
index 8fd377c9f002cdabed18d0096f6f75274bdc6023..1c87e1156bbe291bd9635a790312cf8e0275a57c 100644 (file)
@@ -58,7 +58,7 @@ namespace YACS
       void clearProperties();
       void addComponentName(const std::string& name);
       void addToResourceList(const std::string& name);
-      virtual CORBA::Object_ptr loadComponent(ComponentInstance *inst);
+      virtual CORBA::Object_ptr loadComponent(ServiceNode *inst);
       void shutdown(int level);
       // Helper methods
       std::map<std::string,std::string> getResourceProperties(const std::string& name) const;
index 7e79c081ea02f68b8bec697b5952af3116ef99d8..fc6912fdeff0c77153fa39f88f58085f60c319ea 100644 (file)
@@ -44,7 +44,7 @@ SalomePythonComponent::~SalomePythonComponent()
 {
 }
 
-void SalomePythonComponent::load()
+void SalomePythonComponent::load(ServiceNode *askingNode)
 {
   if(_container)
     {
@@ -56,11 +56,11 @@ void SalomePythonComponent::load()
   //throw Exception("SalomePythonComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
 }
 
-void SalomePythonComponent::unload()
+void SalomePythonComponent::unload(ServiceNode *askingNode)
 {
 }
 
-bool SalomePythonComponent::isLoaded()
+bool SalomePythonComponent::isLoaded(ServiceNode *askingNode)
 {
   if(!_container)
     return false;
index ec1246a24e95122dc86952cf362e6af04a7a9439..d7701c383a3378d14e9c2cecb17cad34ed10c19c 100644 (file)
@@ -33,9 +33,9 @@ namespace YACS
       SalomePythonComponent(const SalomePythonComponent& other);
       std::string getPlacementId() const;
       virtual ~SalomePythonComponent();
-      virtual void load();
-      virtual void unload();
-      virtual bool isLoaded();
+      virtual void load(ServiceNode *askingNode);
+      virtual void unload(ServiceNode *askingNode);
+      virtual bool isLoaded(ServiceNode *askingNode);
       virtual std::string getKind() const;
       virtual ComponentInstance* clone() const;
       virtual std::string getFileRepr() const;