Version: 8.3.0
YACS::ENGINE::ComponentInstance Class Referenceabstract

Base class for all component instances. More...

#include <ComponentInstance.hxx>

Inheritance diagram for YACS::ENGINE::ComponentInstance:
Collaboration diagram for YACS::ENGINE::ComponentInstance:

Public Member Functions

 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 ()
 

Static Public Attributes

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

Protected Member Functions

virtual ~ComponentInstance ()
 
- Protected Member Functions inherited from YACS::ENGINE::RefCounter
 RefCounter ()
 
 RefCounter (const RefCounter &other)
 
virtual ~RefCounter ()
 

Protected Attributes

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
 

Static Protected Attributes

static const char NULL_FILE_REPR [] ="No repr specified for ComponentInstance"
 
static int _total = 0
 

Detailed Description

Base class for all component instances.

This is an abstract class that must be specialized in runtime. Specialized classes must provide implementation for loading of a component (load method) unloading (unload method) and an information method (isLoaded) about the state of the component

A component instance is used by one or more ServiceNode to execute services of this component instance

See Also
ServiceNode

Definition at line 38 of file ComponentInstance.hxx.

Constructor & Destructor Documentation

ComponentInstance::~ComponentInstance ( )
protectedvirtual

Definition at line 87 of file ComponentInstance.cxx.

References _container, and YACS::ENGINE::RefCounter::decrRef().

88 {
89  if(_container)
91 }
ComponentInstance::ComponentInstance ( const std::string &  name)

Definition at line 66 of file ComponentInstance.cxx.

References _compoName, _instanceName, _numId, and _total.

67 {
68  _numId = _total++;
69  stringstream instName;
70  instName << _compoName << "_" << _numId;
71  _instanceName = instName.str();
72 }
ComponentInstance::ComponentInstance ( const ComponentInstance other)

Definition at line 74 of file ComponentInstance.cxx.

References _compoName, _container, _instanceName, _numId, _total, and YACS::ENGINE::Container::clone().

74  :_compoName(other._compoName),
75  _container(0),
77  _anonymous(true)
78 {
79  _numId = _total++;
80  stringstream instName;
81  instName << _compoName << "_" << _numId;
82  _instanceName = instName.str();
83  if(other._container)
84  _container=other._container->clone();
85 }

Member Function Documentation

void ComponentInstance::attachOnCloning ( ) const
virtual

By calling this method the current container 'this' is not destined to be deeply copied on clone call.

Definition at line 96 of file ComponentInstance.cxx.

References _isAttachedOnCloning.

97 {
99 }
virtual ServiceNode* YACS::ENGINE::ComponentInstance::createNode ( const std::string &  name)
pure virtual
void ComponentInstance::dettachOnCloning ( ) const
virtual

By calling this method the current container 'this' will be deeply copied on clone call.

Definition at line 110 of file ComponentInstance.cxx.

References _isAttachedOnCloning.

111 {
112  _isAttachedOnCloning=false;
113 }
std::string ComponentInstance::getFileRepr ( ) const
virtual
string ComponentInstance::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 in YACS::ENGINE::CppComponent, YACS::ENGINE::SalomeComponent, YACS::ENGINE::CORBAComponent, YACS::ENGINE::SalomeHPComponent, and YACS::ENGINE::SalomePythonComponent.

Definition at line 126 of file ComponentInstance.cxx.

References KIND.

127 {
128  return KIND;
129 }
std::string ComponentInstance::getKindForNode ( ) const
virtual

Reimplemented in YACS::ENGINE::CppComponent, YACS::ENGINE::SalomeComponent, YACS::ENGINE::CORBAComponent, and YACS::ENGINE::SalomeHPComponent.

Definition at line 131 of file ComponentInstance.cxx.

References KIND.

132 {
133  return KIND;
134 }
int YACS::ENGINE::ComponentInstance::getNumId ( ) const
inline

Definition at line 50 of file ComponentInstance.hxx.

Referenced by YACS::HMI::SubjectComponent::getKey().

50 { return _numId; }
virtual bool YACS::ENGINE::ComponentInstance::isAnonymous ( )
inlinevirtual
bool ComponentInstance::isAttachedOnCloning ( ) const

Definition at line 115 of file ComponentInstance.cxx.

References _isAttachedOnCloning.

116 {
117  return _isAttachedOnCloning;
118 }
virtual bool YACS::ENGINE::ComponentInstance::isLoaded ( Task askingNode) const
pure virtual
virtual void YACS::ENGINE::ComponentInstance::load ( Task askingNode)
pure virtual
virtual void YACS::ENGINE::ComponentInstance::setAnonymous ( bool  anon)
inlinevirtual
void YACS::ENGINE::ComponentInstance::setName ( const std::string &  name)
inline
void ComponentInstance::shutdown ( int  level)
virtual

Reimplemented in YACS::ENGINE::SalomeComponent, and YACS::ENGINE::SalomeHPComponent.

Definition at line 136 of file ComponentInstance.cxx.

Referenced by YACS::ENGINE::SalomeNode::shutdown().

137 {
138 }
virtual void YACS::ENGINE::ComponentInstance::unload ( Task askingNode)
pure virtual

Member Data Documentation

bool YACS::ENGINE::ComponentInstance::_anonymous
protected

Definition at line 81 of file ComponentInstance.hxx.

std::string YACS::ENGINE::ComponentInstance::_compoName
protected
std::string YACS::ENGINE::ComponentInstance::_instanceName
protected

WARNING : _InstanceName has a strong semantic. It discriminates ComponentInstance instances each other.

Definition at line 74 of file ComponentInstance.hxx.

Referenced by ComponentInstance().

int YACS::ENGINE::ComponentInstance::_numId
protected

Definition at line 75 of file ComponentInstance.hxx.

Referenced by ComponentInstance().

int ComponentInstance::_total = 0
staticprotected

Definition at line 80 of file ComponentInstance.hxx.

Referenced by ComponentInstance().

const char ComponentInstance::KIND =""
static

Definition at line 68 of file ComponentInstance.hxx.

Referenced by getKind(), and getKindForNode().

const char ComponentInstance::NULL_FILE_REPR ="No repr specified for ComponentInstance"
staticprotected

Definition at line 79 of file ComponentInstance.hxx.

Referenced by getFileRepr().


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