Version: 8.3.0
YACS::ENGINE::ServiceNode Class Referenceabstract

Class for calculation node associated with a component service. More...

#include <ServiceNode.hxx>

Inheritance diagram for YACS::ENGINE::ServiceNode:
Collaboration diagram for YACS::ENGINE::ServiceNode:

Public Member Functions

virtual void load ()
 Load the component associated to the node. More...
 
virtual bool isDeployable () const
 By definition of ServiceNode class. More...
 
virtual void setComponent (ComponentInstance *compo) throw (Exception)
 Associate an existing component instance to this service node AND check the consistency regarding the deployment from root node point of view. More...
 
virtual ComponentInstancegetComponent ()
 Return the associated component instance. More...
 
virtual const ComponentInstancegetComponent () const
 
virtual ContainergetContainer ()
 Return the associated container. More...
 
virtual void setRef (const std::string &ref)
 Associate a new component instance to this service node. More...
 
virtual std::string getRef ()
 
virtual void setMethod (const std::string &method)
 
virtual std::string getMethod ()
 
virtual ServiceNodecreateNode (const std::string &name)=0
 
virtual ~ServiceNode ()
 
virtual void accept (Visitor *visitor)
 
virtual std::string getKind () const
 Return the service node kind. More...
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::ElementaryNode
virtual ~ElementaryNode ()
 
void exUpdateState ()
 Update the node state. More...
 
void init (bool start=true)
 
YACS::StatesForNode getState () const
 
void getReadyTasks (std::vector< Task * > &tasks)
 
void edRemovePort (Port *port) throw (Exception)
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
NodegetChildByName (const std::string &name) const throw (Exception)
 
virtual void checkBasicConsistency () const throw (Exception)
 
ComposedNodegetDynClonerIfExists (const ComposedNode *levelToStop) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::string getInPortName (const InPort *) const throw (Exception)
 
std::string getOutPortName (const OutPort *) const throw (Exception)
 
InputPortgetInputPort (const std::string &name) const throw (Exception)
 
OutputPortgetOutputPort (const std::string &name) const throw (Exception)
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 
std::list< OutputPort * > getLocalOutputPorts () const
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 
virtual std::vector< std::pair
< OutPort *, InPort * > > 
getSetOfLinksLeavingCurrentScope () const
 
virtual std::vector< std::pair
< InPort *, OutPort * > > 
getSetOfLinksComingInCurrentScope () const
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const throw (Exception)
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const throw (Exception)
 
virtual InputPortcreateInputPort (const std::string &inputPortName, TypeCode *type)
 
virtual OutputPortcreateOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortcreateInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortcreateOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual InputPortedAddInputPort (const std::string &inputPortName, TypeCode *type) throw (Exception)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type) throw (Exception)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type) throw (Exception)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type) throw (Exception)
 
virtual void edOrderInputPorts (const std::list< InputPort * > &ports)
 
virtual void edOrderOutputPorts (const std::list< OutputPort * > &ports)
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
int getMaxLevelOfParallelism () const
 
void begin ()
 
bool isReady ()
 
void finished ()
 
void aborted ()
 
void loaded ()
 Notify this node that it is loaded. More...
 
void connected ()
 Notify this node that it is connected. More...
 
virtual std::string getErrorDetails ()
 Give a description of error when node status is ERROR. More...
 
virtual void initService ()
 
virtual void connectService ()
 
virtual void disconnectService ()
 
virtual void getCoupledTasks (std::set< Task * > &coupledSet)
 Calls getCoupledNodes for Task interface. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledSet)
 Put all nodes that are coupled to this node in coupledSet. More...
 
virtual void addDatastreamPortToInitMultiService (const std::string &port_name, int number)
 
template<class PORT >
void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts) throw (Exception)
 
template<class PORT >
bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
virtual void shutdown (int level)
 Stop all pending activities of the node. More...
 
virtual void resetState (int level)
 Reset the node state depending on the parameter level. More...
 
Nodeclone (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
NodecloneWithoutCompAndContDeepCpy (ComposedNode *father, bool editionOnly=true) const
 This method MUST NEVER BE VIRTUAL More...
 
void setState (YACS::StatesForNode theState)
 Sets the given state for node. More...
 
virtual YACS::StatesForNode getEffectiveState () const
 Return the node state in the context of its father. More...
 
virtual YACS::StatesForNode getEffectiveState (const Node *) const
 Return the effective state of a node in the context of this one (its father) More...
 
std::string getColorState (YACS::StatesForNode state) const
 Return the color associated to a state. More...
 
InGategetInGate ()
 
OutGategetOutGate ()
 
const std::string & getName () const
 
void setName (const std::string &name)
 Change the name of the node. More...
 
ComposedNodegetFather () const
 
const std::string getId () const
 
bool exIsControlReady () const
 
std::list< Node * > getOutNodes () const
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
virtual void exFailedState ()
 Notify this node that its execution has failed. More...
 
virtual void exDisabledState ()
 Notify this node that it has been disabled. More...
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::set< InputPort * > edGetSetOfUnitializedInputPort () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
virtual bool edAreAllInputPortInitialized () const
 Becomes deprecated soon. Replaced by ComposedNode::CheckConsistency. More...
 
InPortgetInPort (const std::string &name) const throw (Exception)
 
InPropertyPortgetInPropertyPort () const throw (Exception)
 
virtual OutPortgetOutPort (const std::string &name) const throw (Exception)
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
virtual ComposedNodegetRootNode () const throw (Exception)
 
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 ()
 
std::map< std::string,
std::string > 
getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
std::string getQualifiedName () const
 same as Node::getName() in most cases, but differs for children of switch More...
 
int getNumId ()
 return node instance identifiant, unique for each node instance More...
 
std::vector< std::pair
< std::string, int > > 
getDPLScopeInfo (ComposedNode *gfn)
 
virtual void applyDPLScope (ComposedNode *gfn)
 
virtual void sendEvent (const std::string &event)
 emit notification to all observers registered with the dispatcher More...
 
virtual void sendEvent2 (const std::string &event, void *something)
 emit notification to all observers registered with the dispatcher More...
 
virtual std::string getErrorDetails () const
 
virtual void setErrorDetails (const std::string &error)
 
virtual void modified ()
 Sets Node in modified state and its father if it exists. More...
 
virtual int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Task
virtual void execute ()=0
 
virtual ~Task ()
 

Static Public Attributes

static const char KIND [] =""
 

Protected Member Functions

 ServiceNode (const std::string &name)
 
 ServiceNode (const ServiceNode &other, ComposedNode *father)
 
void performDuplicationOfPlacement (const Node &other)
 performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute. More...
 
void performShallowDuplicationOfPlacement (const Node &other)
 performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning. More...
 
- Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
 ElementaryNode (const std::string &name)
 
 ElementaryNode (const ElementaryNode &other, ComposedNode *father)
 
void initCommonPartWithoutStateManagement (bool start)
 
virtual void createMultiDatastreamPorts ()
 
void edDisconnectAllLinksWithMe ()
 
bool areAllInputPortsValid () const
 
template<class PORT >
PORT * getPort (const std::string &name, const std::list< PORT * > &setOfPorts) const throw (Exception)
 
template<class PORT , class ENUMTYPE >
PORT * edAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type) throw (Exception)
 
template<class PORT , class ENUMTYPE >
bool edCheckAddPort (const std::string &portName, std::list< PORT * > &setOfPorts, ENUMTYPE type) throw (Exception)
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual NodesimpleClone (ComposedNode *father, bool editionOnly=true) const =0
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 

Protected Attributes

ComponentInstance_component
 
std::string _method
 
std::string _ref
 
- Protected Attributes inherited from YACS::ENGINE::ElementaryNode
std::list< InputPort * > _setOfInputPort
 
std::list< OutputPort * > _setOfOutputPort
 
std::list< InputDataStreamPort * > _setOfInputDataStreamPort
 
std::list< OutputDataStreamPort * > _setOfOutputDataStreamPort
 
bool _createDatastreamPorts
 
bool _multi_port_node
 
- Protected Attributes inherited from YACS::ENGINE::Node
InGate _inGate
 
OutGate _outGate
 
InPropertyPort_inPropertyPort
 
std::string _name
 
ComposedNode_father
 
YACS::StatesForNode _state
 
int _modified
 
std::string _errorDetails
 
int _numId
 
std::string _implementation
 
std::map< std::string,
std::string > 
_propertyMap
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 
- Static Protected Member Functions inherited from YACS::ENGINE::ElementaryNode
template<class PORT >
static void edRemovePortTypedFromSet (PORT *port, std::list< PORT * > &setOfPorts) throw (Exception)
 
template<class PORT >
static bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Class for calculation node associated with a component service.

See Also
InlineNode
ElementaryNode

Definition at line 34 of file ServiceNode.hxx.

Constructor & Destructor Documentation

ServiceNode::ServiceNode ( const std::string &  name)
protected

Definition at line 55 of file ServiceNode.cxx.

55  :ElementaryNode(name),_component(0)
56 {
57 }
ServiceNode::ServiceNode ( const ServiceNode other,
ComposedNode father 
)
protected

Definition at line 59 of file ServiceNode.cxx.

60  :ElementaryNode(other,father),_method(other._method),_component(0)
61 {
62 }
ServiceNode::~ServiceNode ( )
virtual

Definition at line 83 of file ServiceNode.cxx.

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

84 {
85  if(_component)
87 }

Member Function Documentation

void ServiceNode::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Reimplemented in YACS::ENGINE::ServiceInlineNode.

Definition at line 116 of file ServiceNode.cxx.

References YACS::ENGINE::Visitor::visitServiceNode().

117 {
118  visitor->visitServiceNode(this);
119 }
virtual ServiceNode* YACS::ENGINE::ServiceNode::createNode ( const std::string &  name)
pure virtual
const ComponentInstance * ServiceNode::getComponent ( ) const
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 127 of file ServiceNode.cxx.

References _component.

128 {
129  return _component;
130 }
Container * ServiceNode::getContainer ( )
virtual

Return the associated container.

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 133 of file ServiceNode.cxx.

References _component, and YACS::ENGINE::ComponentInstance::getContainer().

Referenced by YACS::HMI::EditionSalomeNode::EditionSalomeNode().

134 {
135  if(_component)return _component->getContainer();
136  return 0;
137 }
std::string ServiceNode::getKind ( ) const
virtual

Return the service node kind.

A runtime can provide several implementations of a service node. Each implementation has a different kind. A ComponentInstance can be associated to a ServiceNode with the same kind.

Reimplemented in YACS::ENGINE::SalomeNode, YACS::ENGINE::CppNode, YACS::ENGINE::CORBANode, YACS::ENGINE::SalomePythonNode, and YACS::ENGINE::XmlNode.

Definition at line 50 of file ServiceNode.cxx.

References KIND.

Referenced by setRef(), and YACS::ENGINE::VisitorSaveSchema::visitServiceNode().

51 {
52  return KIND;
53 }
virtual std::string YACS::ENGINE::ServiceNode::getMethod ( )
inlinevirtual
std::string ServiceNode::getRef ( )
virtual

Definition at line 206 of file ServiceNode.cxx.

References _ref.

Referenced by YACS::ENGINE::VisitorSaveSchema::visitServiceNode().

207 {
208  return _ref;
209 }
bool ServiceNode::isDeployable ( ) const
virtual

By definition of ServiceNode class.

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 140 of file ServiceNode.cxx.

141 {
142  return true;
143 }
void ServiceNode::load ( )
virtual

Load the component associated to the node.

Reimplemented from YACS::ENGINE::ElementaryNode.

Reimplemented in YACS::ENGINE::CppNode, YACS::ENGINE::SalomePythonNode, and YACS::ENGINE::XmlNode.

Definition at line 90 of file ServiceNode.cxx.

References _component, YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::Node::_name, YACS::ENGINE::ComponentInstance::isLoaded(), YACS::ENGINE::ComponentInstance::load(), and YACS::Exception::what().

Referenced by YACS::ENGINE::SalomePythonNode::load(), and YACS::ENGINE::CppNode::load().

91 {
92  if(_component)
93  {
94  if(!_component->isLoaded(this))
95  {
96  try
97  {
98  _component->load(this);
99  }
100  catch(Exception& e)
101  {
102  _errorDetails=e.what();
103  throw e;
104  }
105  }
106  }
107  else
108  {
109  std::string what("ServiceNode::load : a load operation requested on ServiceNode called \"");
110  what+=_name; what+="\" with no component specified.";
111  _errorDetails=what;
112  throw Exception(what);
113  }
114 }
void ServiceNode::performDuplicationOfPlacement ( const Node other)
protectedvirtual

performs a duplication of placement using clone method of containers and components. clone behaviour is driven by attachOnCloning attribute.

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 64 of file ServiceNode.cxx.

References _component, and YACS::ENGINE::ComponentInstance::clone().

65 {
66  const ServiceNode &otherC=*(dynamic_cast<const ServiceNode *>(&other));
67  //if other has no component don't clone: this will not have one
68  if(otherC._component)
69  _component=otherC._component->clone();
70 }
void ServiceNode::performShallowDuplicationOfPlacement ( const Node other)
protectedvirtual

performs a also duplication of placement but here containers and components are not copied at all whatever the value of attachedOnCloning.

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 72 of file ServiceNode.cxx.

References _component, and YACS::ENGINE::RefCounter::incrRef().

73 {
74  const ServiceNode &otherC=*(dynamic_cast<const ServiceNode *>(&other));
75  //if other has no component don't clone: this will not have one
76  if(otherC._component)
77  {
78  _component=otherC._component;
80  }
81 }
void ServiceNode::setComponent ( ComponentInstance compo) throw (Exception)
virtual

Associate an existing component instance to this service node AND check the consistency regarding the deployment from root node point of view.

Definition at line 146 of file ServiceNode.cxx.

References DEBTRACE, YACS::ENGINE::RefCounter::decrRef(), and YACS::ENGINE::ComponentInstance::getCompoName().

Referenced by YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), YACS::ENGINE::SalomeHPComponent::createNode(), YACS::ENGINE::SalomePythonComponent::createNode(), YACS::ENGINE::SalomeComponent::createNode(), YACS::ENGINE::SalomePythonNode::createNode(), YACS::ENGINE::CORBAComponent::createNode(), YACS::ENGINE::CORBANode::createNode(), YACS::ENGINE::CppNode::createNode(), YACS::ENGINE::CppComponent::createNode(), YACS::ENGINE::SalomeNode::createNode(), YACS::inlinetypeParser< T >::function(), and YACS::HMI::CommandAddNodeFromCatalog::localExecute().

147 {
148  DEBTRACE("ServiceNode::setComponent " << compo);
149  if(compo)
150  {
151  DEBTRACE(compo->getInstanceName());
152  if(compo->getKindForNode() != this->getKind())
153  {
154  //Not allowed
155  std::string what("ServiceNode::setComponent : component instance kind not allowed ");
156  throw Exception(what);
157  }
158  }
159 
160  ComponentInstance* oldcompo=_component;
161  std::string oldref=_ref;
162 
163  _component=compo;
164  _ref=compo->getCompoName();
166  if(_component)
167  {
168  if(_father)
169  try
170  {
172  }
173  catch(Exception& e)
174  {
175  // Impossible to associate compo to this node. Keep the old component instance and throws exception
176  _component=oldcompo;
177  _ref=oldref;
178  throw e;
179  }
180  _component->incrRef();
181  }
182 
183  if(oldcompo)
184  oldcompo->decrRef();
185 }
virtual void YACS::ENGINE::ServiceNode::setMethod ( const std::string &  method)
inlinevirtual
void ServiceNode::setRef ( const std::string &  ref)
virtual

Associate a new component instance to this service node.

A new component instance with type name ref is created (from runtime factory createComponentInstance) and associated to the node.

Reimplemented in YACS::ENGINE::XmlNode.

Definition at line 193 of file ServiceNode.cxx.

References _component, _ref, YACS::ENGINE::Runtime::createComponentInstance(), YACS::ENGINE::RefCounter::decrRef(), getKind(), YACS::ENGINE::getRuntime(), gui.CONNECTOR::ref(), and YASSERT.

Referenced by YACS::ENGINE::SessionCataLoader::importComponent(), and YACS::ENGINE::CppNode::load().

194 {
195  _ref = ref;
196  if(_component)
197  {
198  //The node is already associated with a component instance
199  _component->decrRef();
200  //Don't forget to unassociate
201  }
204 }
virtual std::string YACS::ENGINE::ServiceNode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Reimplemented in YACS::ENGINE::SalomeNode, YACS::ENGINE::CORBANode, and YACS::ENGINE::ServiceInlineNode.

Definition at line 56 of file ServiceNode.hxx.

56 { return "YACS__ENGINE__ServiceNode"; }

Member Data Documentation

std::string YACS::ENGINE::ServiceNode::_ref
protected
const char ServiceNode::KIND =""
static

Definition at line 58 of file ServiceNode.hxx.

Referenced by getKind().


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