Version: 9.16.0
YACS::ENGINE::SalomeComponent Class Reference

Class for Salome component instance. More...

#include <SalomeComponent.hxx>

Inheritance diagram for YACS::ENGINE::SalomeComponent:
Collaboration diagram for YACS::ENGINE::SalomeComponent:

Public Member Functions

 SalomeComponent (const std::string &name)
 SalomeComponent constructor. More...
 
 SalomeComponent (const SalomeComponent &other)
 SalomeComponent copy constructor. More...
 
virtual ~SalomeComponent ()
 
virtual void load (Task *askingNode)
 Load the component. More...
 
virtual void unload (Task *askingNode)
 Unload the component. More...
 
virtual bool isLoaded (Task *askingNode) const
 Is the component instance already loaded ? More...
 
virtual bool setContainer (Container *cont)
 
virtual ServiceNodecreateNode (const std::string &name)
 Create a ServiceNode with this component instance and no input or output port. More...
 
virtual ComponentInstanceclone () const
 Clone the component instance. More...
 
virtual ComponentInstancecloneAlways () const
 
virtual std::string getFileRepr () const
 For dump in file. More...
 
virtual CORBA::Object_ptr getCompoPtr ()
 
virtual void shutdown (int level)
 
virtual std::string getKind () const
 Return the component kind. More...
 
virtual std::string getKindForNode () const
 
- Public Member Functions inherited from YACS::ENGINE::ComponentInstance
 ComponentInstance (const std::string &name)
 
 ComponentInstance (const ComponentInstance &other)
 
const std::string & getCompoName () const
 
const std::string & getInstanceName () const
 
void setName (const std::string &name)
 
virtual void setAnonymous (bool anon)
 
virtual bool isAnonymous ()
 
int getNumId () const
 
virtual bool setContainer (Container *cont)
 
ContainergetContainer () const
 
virtual void load (Task *askingNode)=0
 Load the component instance. More...
 
virtual void unload (Task *askingNode)=0
 Unload the component instance. More...
 
virtual bool isLoaded (Task *askingNode) const =0
 Indicate if the component instance is loaded (true) or not. More...
 
virtual void attachOnCloning () const
 
virtual void dettachOnCloning () const
 
bool isAttachedOnCloning () const
 
virtual std::string getFileRepr () const
 For dump in file. More...
 
virtual ServiceNodecreateNode (const std::string &name)=0
 
virtual ComponentInstanceclone () const =0
 
virtual ComponentInstancecloneAlways () const =0
 
virtual std::string getKind () const
 Return the component kind. More...
 
virtual std::string getKindForNode () const
 
virtual void shutdown (int level)
 
- Public Member Functions inherited from YACS::ENGINE::PropertyInterface
virtual ~PropertyInterface ()
 
virtual void setProperty (const std::string &name, const std::string &value)
 
virtual std::string getProperty (const std::string &name)
 Get a property value given its name. More...
 
std::map< std::string, std::string > getProperties () const
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
- Public Member Functions inherited from YACS::ENGINE::RefCounter
unsigned int getRefCnt () const
 
void incrRef () const
 
bool decrRef () const
 

Static Public Attributes

static const char KIND [] ="Salome"
 
- Static Public Attributes inherited from YACS::ENGINE::ComponentInstance
static const char KIND [] =""
 
- Static Public Attributes inherited from YACS::ENGINE::RefCounter
static unsigned int _totalCnt =0
 

Protected Attributes

CORBA::Object_var _objComponent
 
- Protected Attributes inherited from YACS::ENGINE::ComponentInstance
std::string _compoName
 WARNING : _compoName identify only the component type. More...
 
std::string _instanceName
 WARNING : _InstanceName has a strong semantic. It discriminates ComponentInstance instances each other. More...
 
int _numId
 
Container_container
 
bool _isAttachedOnCloning
 
bool _anonymous
 
- Protected Attributes inherited from YACS::ENGINE::PropertyInterface
std::map< std::string, std::string > _propertyMap
 
- Protected Attributes inherited from YACS::ENGINE::RefCounter
unsigned int _cnt
 

Additional Inherited Members

- Protected Member Functions inherited from YACS::ENGINE::ComponentInstance
virtual ~ComponentInstance ()
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 
- Static Protected Attributes inherited from YACS::ENGINE::ComponentInstance
static const char NULL_FILE_REPR [] ="No repr specified for ComponentInstance"
 
static int _total = 0
 

Detailed Description

Class for Salome component instance.

Definition at line 35 of file SalomeComponent.hxx.

Constructor & Destructor Documentation

◆ SalomeComponent() [1/2]

SalomeComponent::SalomeComponent ( const std::string &  name)

SalomeComponent constructor.

Definition at line 45 of file SalomeComponent.cxx.

45 : ComponentInstance(name)
46{
47 _objComponent=CORBA::Object::_nil();
48}
ComponentInstance(const std::string &name)

References _objComponent.

Referenced by clone(), and cloneAlways().

◆ SalomeComponent() [2/2]

SalomeComponent::SalomeComponent ( const SalomeComponent other)

SalomeComponent copy constructor.

Definition at line 51 of file SalomeComponent.cxx.

51 :ComponentInstance(other)
52{
53 _objComponent=CORBA::Object::_nil();
54}

References _objComponent.

◆ ~SalomeComponent()

SalomeComponent::~SalomeComponent ( )
virtual

Definition at line 56 of file SalomeComponent.cxx.

57{
58}

Member Function Documentation

◆ clone()

ComponentInstance * SalomeComponent::clone ( ) const
virtual

Clone the component instance.

Implements YACS::ENGINE::ComponentInstance.

Definition at line 130 of file SalomeComponent.cxx.

131{
133 {
134 incrRef();
135 return (ComponentInstance*) (this);
136 }
137 else
138 return new SalomeComponent(*this);
139}
Base class for all component instances.
SalomeComponent(const std::string &name)
SalomeComponent constructor.

References YACS::ENGINE::ComponentInstance::_isAttachedOnCloning, YACS::ENGINE::RefCounter::incrRef(), and SalomeComponent().

◆ cloneAlways()

ComponentInstance * SalomeComponent::cloneAlways ( ) const
virtual

Implements YACS::ENGINE::ComponentInstance.

Definition at line 141 of file SalomeComponent.cxx.

142{
143 return new SalomeComponent(*this);
144}

References SalomeComponent().

◆ createNode()

ServiceNode * SalomeComponent::createNode ( const std::string &  name)
virtual

Create a ServiceNode with this component instance and no input or output port.

Parameters
name: node name
Returns
a new SalomeNode node

Implements YACS::ENGINE::ComponentInstance.

Definition at line 122 of file SalomeComponent.cxx.

123{
124 SalomeNode* node=new SalomeNode(name);
125 node->setComponent(this);
126 return node;
127}
Class for Salome component Service Node.
Definition: CORBANode.hxx:68
virtual void setComponent(ComponentInstance *compo)
Associate an existing component instance to this service node AND check the consistency regarding the...

References YACS::ENGINE::ServiceNode::setComponent().

◆ getCompoPtr()

virtual CORBA::Object_ptr YACS::ENGINE::SalomeComponent::getCompoPtr ( )
inlinevirtual

Definition at line 49 of file SalomeComponent.hxx.

49{return CORBA::Object::_duplicate(_objComponent);}

◆ getFileRepr()

std::string SalomeComponent::getFileRepr ( ) const
virtual

For dump in file.

Reimplemented from YACS::ENGINE::ComponentInstance.

Definition at line 146 of file SalomeComponent.cxx.

147{
148 ostringstream stream;
149 stream << "<component>" << getCompoName() << "</component>";
150 return stream.str();
151}
const std::string & getCompoName() const

References YACS::ENGINE::ComponentInstance::getCompoName().

◆ getKind()

std::string SalomeComponent::getKind ( ) const
virtual

Return the component kind.

A runtime can provide several implementations of a component instance. Each implementation has a different kind. A ComponentInstance can be associated to a ServiceNode is they have the same kind.

Reimplemented from YACS::ENGINE::ComponentInstance.

Definition at line 60 of file SalomeComponent.cxx.

61{
62 return KIND;
63}

References KIND.

◆ getKindForNode()

std::string SalomeComponent::getKindForNode ( ) const
virtual

Reimplemented from YACS::ENGINE::ComponentInstance.

Definition at line 65 of file SalomeComponent.cxx.

66{
67 return KIND;
68}

References KIND.

◆ isLoaded()

bool SalomeComponent::isLoaded ( Task askingNode) const
virtual

Is the component instance already loaded ?

Implements YACS::ENGINE::ComponentInstance.

Definition at line 78 of file SalomeComponent.cxx.

79{
80 if(CORBA::is_nil(_objComponent))
81 return false;
82 else
83 return true;
84}

References _objComponent.

◆ load()

void SalomeComponent::load ( Task askingNode)
virtual

Load the component.

Implements YACS::ENGINE::ComponentInstance.

Definition at line 88 of file SalomeComponent.cxx.

89{
90 if(_container)
91 {
92 SalomeContainer *salomeContainer(dynamic_cast<SalomeContainer *>(_container));
93 if(salomeContainer)
94 {
95 _objComponent=salomeContainer->loadComponent(askingNode);
96 return ;
97 }
98 throw Exception("Unrecognized type of Container ! Only Salome are supported by the Salome components !");
99 }
100 //throw Exception("SalomeComponent::load : no container specified !!! To be implemented in executor to allocate default a Container in case of presenceOfDefaultContainer.");
101 //This component has no specified container : use default container policy
103 SALOME_LifeCycleCORBA LCC(&ns);
104 Engines::ContainerParameters params;
105 LCC.preSet(params);
106 params.resource_params.name = "localhost";
107 params.container_name ="FactoryServer";
108 _objComponent=LCC.LoadComponent(params,_compoName.c_str());
109}
std::string _compoName
WARNING : _compoName identify only the component type.
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()

References YACS::ENGINE::ComponentInstance::_compoName, YACS::ENGINE::ComponentInstance::_container, _objComponent, YACS::ENGINE::getSALOMERuntime(), and YACS::ENGINE::SalomeContainer::loadComponent().

◆ setContainer()

bool SalomeComponent::setContainer ( Container cont)
virtual

Reimplemented from YACS::ENGINE::ComponentInstance.

Definition at line 153 of file SalomeComponent.cxx.

154{
155 if(!dynamic_cast<SalomeContainer *>(cont))
156 throw Exception("SalomeComponent::setContainer : a Salome component must be attached to a Salome container !");
158 {
159 if(_container)
161 return true;
162 }
163 else
164 return false;
165}
virtual bool setContainer(Container *cont)
virtual void addComponentName(const std::string &name)=0

References YACS::ENGINE::ComponentInstance::_compoName, YACS::ENGINE::ComponentInstance::_container, YACS::ENGINE::Container::addComponentName(), and YACS::ENGINE::ComponentInstance::setContainer().

◆ shutdown()

void SalomeComponent::shutdown ( int  level)
virtual

Reimplemented from YACS::ENGINE::ComponentInstance.

Definition at line 167 of file SalomeComponent.cxx.

168{
169 DEBTRACE("SalomeComponent::shutdown " << level);
170 if(_container)
171 _container->shutdown(level);
172}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
virtual void shutdown(int level)=0

References YACS::ENGINE::ComponentInstance::_container, DEBTRACE, and YACS::ENGINE::Container::shutdown().

◆ unload()

void SalomeComponent::unload ( Task askingNode)
virtual

Unload the component.

Implements YACS::ENGINE::ComponentInstance.

Definition at line 71 of file SalomeComponent.cxx.

72{
73 //Not implemented
74 std::cerr << "SalomeComponent::unload : not implemented " << std::endl;
75}

Member Data Documentation

◆ _objComponent

CORBA::Object_var YACS::ENGINE::SalomeComponent::_objComponent
protected

Definition at line 56 of file SalomeComponent.hxx.

Referenced by isLoaded(), load(), and SalomeComponent().

◆ KIND


The documentation for this class was generated from the following files: