Version: 8.3.0
YACS::ENGINE::InlineNode Class Reference

Class for calculation node (script) inlined (and executed) in the schema. More...

#include <InlineNode.hxx>

Inheritance diagram for YACS::ENGINE::InlineNode:
Collaboration diagram for YACS::ENGINE::InlineNode:

Public Member Functions

virtual void setScript (const std::string &script)
 Set the script (as a string) to execute. More...
 
virtual std::string getScript ()
 
virtual InlineNodecloneNode (const std::string &name)
 Return a new InlineNode node by making a copy of this node. More...
 
virtual void accept (Visitor *visitor)
 
virtual ~InlineNode ()
 
virtual std::string typeName ()
 
virtual void setExecutionMode (const std::string &mode)
 
virtual std::string getExecutionMode ()
 
virtual void setContainer (Container *container)
 
virtual ContainergetContainer ()
 
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...
 
bool isDeployable () const
 
int getMaxLevelOfParallelism () const
 
- Public Member Functions inherited from YACS::ENGINE::ElementaryNode
virtual ~ElementaryNode ()
 
void exUpdateState ()
 Update the node state. More...
 
void init (bool start=true)
 
ComponentInstancegetComponent ()
 
const ComponentInstancegetComponent () const
 
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...
 
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 load ()
 
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 LOCAL_STR [] ="local"
 
static const char REMOTE_STR [] ="remote"
 

Protected Member Functions

 InlineNode (const InlineNode &other, ComposedNode *father)
 
 InlineNode (const std::string &name)
 
- 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

std::string _script
 
std::string _mode
 
Container_container
 
- 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 (script) inlined (and executed) in the schema.

This node is like a script. It has no state if it is executed several times. Each execution the string _script is executed within a clean context.

See Also
ServiceNode
ElementaryNode

Definition at line 43 of file InlineNode.hxx.

Constructor & Destructor Documentation

YACS::ENGINE::InlineNode::InlineNode ( const InlineNode other,
ComposedNode father 
)
inlineprotected

Definition at line 46 of file InlineNode.hxx.

47  :ElementaryNode(other,father),_script(other._script),_mode(other._mode),_container(0) { }
YACS::ENGINE::InlineNode::InlineNode ( const std::string &  name)
inlineprotected

Definition at line 48 of file InlineNode.hxx.

InlineNode::~InlineNode ( )
virtual

Definition at line 35 of file InlineNode.cxx.

36 {
37  if(_container)
39 }

Member Function Documentation

void InlineNode::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Reimplemented in YACS::ENGINE::InlineFuncNode, and YACS::ENGINE::ServerNode.

Definition at line 41 of file InlineNode.cxx.

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

42 {
43  visitor->visitInlineNode(this);
44 }
virtual InlineNode* YACS::ENGINE::InlineNode::cloneNode ( const std::string &  name)
inlinevirtual

Return a new InlineNode node by making a copy of this node.

Parameters
name,:name of the new node
Returns
the new node built by cloning.

Reimplemented in YACS::ENGINE::PyFuncNode, and YACS::ENGINE::PythonNode.

Definition at line 58 of file InlineNode.hxx.

Referenced by YACS::nodetypeParser< T >::post().

59  { throw Exception("Not implemented");};
std::string InlineNode::getExecutionMode ( )
virtual
int InlineNode::getMaxLevelOfParallelism ( ) const
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 142 of file InlineNode.cxx.

References PMMLBasicsTestLauncher::ret.

143 {
144  if(!isDeployable())
145  return 1;
146  if(!_container)
147  return 1;
148  std::map<std::string,std::string> props(_container->getProperties());
149  std::map<std::string,std::string>::iterator it(props.find(std::string("nb_proc_per_node")));
150  if(it==props.end())
151  return 1;
152  if((*it).second.empty())
153  return 1;
154  std::istringstream iss((*it).second);
155  int ret(1); iss >> ret;
156  return ret;
157 }
bool InlineNode::isDeployable ( ) const
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Reimplemented in YACS::ENGINE::ServerNode.

Definition at line 134 of file InlineNode.cxx.

135 {
136  if(_mode==REMOTE_STR)
137  return true;
138  else
139  return false;
140 }
void InlineNode::performDuplicationOfPlacement ( const Node other)
virtual

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 115 of file InlineNode.cxx.

References _container, and YACS::ENGINE::Container::clone().

116 {
117  const InlineNode &otherC=*(dynamic_cast<const InlineNode *>(&other));
118  //if other has no container don't clone: this will not have one
119  if(otherC._container)
120  _container=otherC._container->clone();
121 }
void InlineNode::performShallowDuplicationOfPlacement ( const Node other)
virtual

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 123 of file InlineNode.cxx.

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

124 {
125  const InlineNode &otherC=*(dynamic_cast<const InlineNode *>(&other));
126  //if other has no container don't clone: this will not have one
127  if(otherC._container)
128  {
129  _container=otherC._container;
130  _container->incrRef();
131  }
132 }
void InlineNode::setContainer ( Container container)
virtual

Definition at line 105 of file InlineNode.cxx.

References YACS::ENGINE::RefCounter::incrRef().

Referenced by YACS::ENGINE::DynParaLoop::cloneAndPlaceNodesCoherently(), and YACS::ENGINE::DistributedPythonNode::createNode().

106 {
107  if (cont == _container) return;
108  if(_container)
109  _container->decrRef();
110  _container=cont;
111  if(_container)
112  _container->incrRef();
113 }
void InlineNode::setExecutionMode ( const std::string &  mode)
virtual

Definition at line 85 of file InlineNode.cxx.

Referenced by YACS::remotetypeParser< T >::function(), and YACS::remotetypeParser< T >::script().

86 {
87  if(mode == _mode)return;
88  if(mode == LOCAL_STR || mode == REMOTE_STR)
89  {
90  _mode=mode;
91  modified();
92  }
93 }
void InlineNode::setScript ( const std::string &  script)
virtual

Set the script (as a string) to execute.

Parameters
script,:script to execute

Definition at line 50 of file InlineNode.cxx.

Referenced by YACS::ENGINE::PythonNode::cloneNode(), YACS::ENGINE::PyFuncNode::cloneNode(), YACS::remotetypeParser< T >::function(), YACS::inlinetypeParser< T >::function(), YACS::remotetypeParser< T >::script(), and YACS::inlinetypeParser< T >::script().

51 {
52  _script=script;
53  modified();
54 }
virtual std::string YACS::ENGINE::InlineNode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Reimplemented in YACS::ENGINE::PyFuncNode, YACS::ENGINE::InlineFuncNode, YACS::ENGINE::PythonNode, YACS::ENGINE::DistributedPythonNode, and YACS::ENGINE::ServerNode.

Definition at line 62 of file InlineNode.hxx.

62 {return "YACS__ENGINE__InlineNode";}

Member Data Documentation

const char InlineNode::LOCAL_STR ="local"
static
const char InlineNode::REMOTE_STR ="remote"
static

Definition at line 73 of file InlineNode.hxx.


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