Version: 9.12.0
YACS::ENGINE::Proc Class Reference

Base class for all schema objects. More...

#include <Proc.hxx>

Inheritance diagram for YACS::ENGINE::Proc:
Collaboration diagram for YACS::ENGINE::Proc:

Public Types

typedef std::map< std::string, Logger * > LoggerMap
 

Public Member Functions

 Proc (const std::string &name)
 
virtual ~Proc ()
 
virtual TypeCodecreateType (const std::string &name, const std::string &kind)
 
virtual TypeCodecreateInterfaceTc (const std::string &id, const std::string &name, std::list< TypeCodeObjref * > ltc)
 Create an object reference TypeCode. More...
 
virtual TypeCodecreateSequenceTc (const std::string &id, const std::string &name, TypeCode *content)
 Create a sequence TypeCode. More...
 
virtual TypeCodecreateStructTc (const std::string &id, const std::string &name)
 
virtual TypeCodegetTypeCode (const std::string &name)
 
virtual void setTypeCode (const std::string &name, TypeCode *t)
 
virtual ContainercreateContainer (const std::string &name, const std::string &kind="")
 Create a new Container and store it in containerMap. More...
 
virtual ComponentInstancecreateComponentInstance (const std::string &componame, const std::string &name="", const std::string &kind="")
 Create a new ComponentInstance and add it into componentInstanceMap. More...
 
virtual void addComponentInstance (ComponentInstance *inst, const std::string &name="", bool resetCtr=false)
 Add a ComponentInstance into componentInstanceMap. More...
 
virtual void removeComponentInstance (ComponentInstance *inst)
 Remove a componentInstance from the componentInstanceMap. More...
 
virtual void removeContainer (Container *cont)
 Remove a container from the containerMap. More...
 
virtual void accept (Visitor *visitor)
 
virtual ProcgetProc ()
 Return the proc (this) More...
 
virtual const ProcgetProc () const
 Return the proc (this) More...
 
virtual void updateContainersAndComponents ()
 
YACS::StatesForNode getNodeState (int numId)
 
std::string getNodeProgress (int numId)
 
int getGlobalProgressPercent ()
 
std::string getInPortValue (int nodeNumId, std::string portName)
 
std::string setInPortValue (std::string nodeName, std::string portName, std::string value)
 
std::string getOutPortValue (int nodeNumId, std::string portName)
 
std::string getNodeErrorDetails (int nodeNumId)
 
std::string getNodeErrorReport (int nodeNumId)
 
std::string getNodeContainerLog (int nodeNumId)
 
std::string getXMLState (int numId)
 
std::list< int > getNumIds ()
 
std::list< std::string > getIds ()
 
virtual LoggergetLogger (const std::string &name)
 
virtual void writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
void setName (const std::string &name)
 
virtual std::string typeName ()
 
virtual bool getEdition ()
 
virtual void setEdition (bool edition)
 
virtual void modified ()
 Sets Proc in modified state and update state if in edition mode. More...
 
virtual void saveSchema (const std::string &xmlSchemaFile)
 Save Proc in XML schema file. More...
 
virtual void saveState (const std::string &xmlStateFile)
 Save Proc state in XML state file. More...
 
- Public Member Functions inherited from YACS::ENGINE::Bloc
 Bloc (const Bloc &other, ComposedNode *father, bool editionOnly)
 
 Bloc (const std::string &name)
 Create a Bloc node with a given name. More...
 
virtual ~Bloc ()
 
bool isFinished ()
 Indicate if the bloc execution is finished. More...
 
int getNumberOfCFLinks () const
 
void init (bool start=true)
 Initialize the bloc. More...
 
void getReadyTasks (std::vector< Task * > &tasks)
 Collect all nodes that are ready to execute. More...
 
void exUpdateState ()
 Update the bloc state. More...
 
bool edAddChild (Node *DISOWNnode)
 Add a child node to the bloc. More...
 
void edRemoveChild (Node *node)
 
std::list< Node * > getChildren () const
 
std::list< Node * > edGetDirectDescendants () const
 
std::vector< std::list< Node * > > splitIntoIndependantGraph () const
 
NodegetChildByShortName (const std::string &name) const
 
template<bool direction>
void findAllPathsStartingFrom (Node *start, std::list< std::vector< Node * > > &vec, std::map< Node *, std::set< Node * > > &accelStr) const
 
template<bool direction>
void findAllNodesStartingFrom (Node *start, std::set< Node * > &result, std::map< Node *, std::set< Node * > > &accelStr, LinkInfo &info) const
 
int getMaxLevelOfParallelism () const
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
void removeRecursivelyRedundantCL ()
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
void fitToPlayGround (const PlayGround *pg)
 
void propagePlayGround (const PlayGround *pg)
 
- Public Member Functions inherited from YACS::ENGINE::StaticDefinedComposedNode
bool isPlacementPredictableB4Run () const
 
bool isMultiplicitySpecified (unsigned &value) const
 
void forceMultiplicity (unsigned value)
 
void selectRunnableTasks (std::vector< Task * > &tasks)
 
- Public Member Functions inherited from YACS::ENGINE::ComposedNode
virtual ~ComposedNode ()
 
bool isFinished ()
 
void init (bool start=true)
 
virtual void shutdown (int level)
 Stop all pending activities of the composed node. More...
 
virtual void resetState (int level)
 Reset the state of the node and its children depending on the parameter level. More...
 
std::string getName () const
 
std::string getTaskName (Task *task) const
 
DeploymentTree getDeploymentTree () const
 Essentially for test. Use checkDeploymentTree instead to be sure that returned DeploymentTree is consistent. More...
 
DeploymentTree checkDeploymentTree (bool deep) const
 Perform check of deployment consistency of the current graph. More...
 
std::vector< Task * > getNextTasks (bool &isMore)
 
void notifyFrom (const Task *sender, YACS::Event event, const Executor *execInst)
 Notify the node a task has emitted an event. More...
 
bool edAddLink (OutPort *start, InPort *end)
 Add a dataflow link between two data ports. More...
 
virtual bool edAddDFLink (OutPort *start, InPort *end)
 Connect an OutPort to an InPort and add the necessary control link. More...
 
bool edAddLink (OutGate *start, InGate *end)
 Add a controlflow link between two control ports. More...
 
bool edAddCFLink (Node *nodeS, Node *nodeE)
 Add a controlflow link between two nodes. More...
 
void edRemoveCFLink (Node *nodeS, Node *nodeE)
 Remove a controlflow link. More...
 
void edRemoveLink (OutPort *start, InPort *end)
 Remove a dataflow link. More...
 
void edRemoveLink (OutGate *start, InGate *end)
 Remove a controlflow link. More...
 
virtual bool isRepeatedUnpredictablySeveralTimes () const
 
virtual bool isLoop () const
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< Node * > getAllRecursiveNodes ()
 Get all children nodes elementary and composed including this node. More...
 
virtual std::list< Node * > getAllRecursiveConstituents ()
 Idem getAllRecursiveNodes, but this node is NOT included. More...
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
std::string getInPortName (const InPort *) const
 Get the input port name. More...
 
std::string getOutPortName (const OutPort *) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::list< InputPort * > getSetOfInputPort () const
 
std::list< OutputPort * > getSetOfOutputPort () const
 
std::list< InputPort * > getLocalInputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
std::list< OutputPort * > getLocalOutputPorts () const
 redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself More...
 
std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const
 List all output ports of children nodes that are linked to out of scope input ports. More...
 
std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const
 List all input ports that are linked to out of scope ports. More...
 
std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const
 
std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const
 
OutPortgetOutPort (const std::string &name) const
 
InputPortgetInputPort (const std::string &name) const
 Get an input port given its name. More...
 
OutputPortgetOutputPort (const std::string &name) const
 Get an output port given its name. More...
 
InputDataStreamPortgetInputDataStreamPort (const std::string &name) const
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const
 
std::vector< std::pair< OutPort *, InPort * > > getSetOfInternalLinks () const
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const
 
void checkConsistency (LinkInfo &info) const
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void checkBasicConsistency () const
 
virtual std::string getErrorReport ()
 returns a string that contains an error report if the node is in error More...
 
ComposedNodegetRootNode () const
 
bool isNodeAlreadyAggregated (const Node *node) const
 Check that Node 'node' is already a direct son of this. More...
 
NodeisInMyDescendance (Node *nodeToTest) const
 Returns the parent of a node that is the direct child of this node. More...
 
std::string getChildName (const Node *node) const
 
virtual std::string getMyQualifiedName (const Node *directSon) const
 
NodegetChildByName (const std::string &name) const
 
void loaded ()
 
void connected ()
 
virtual void cleanNodes ()
 Clean the composed node in case of not clean exit. More...
 
virtual std::string getProgress () const
 
void setProperty (const std::string &name, const std::string &value) override
 
std::string getProperty (const std::string &name) override
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
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 getState () const
 
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 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
 
InPropertyPortgetInPropertyPort () const
 
std::list< ComposedNode * > getAllAscendanceOf (ComposedNode *levelToStop=0) const
 
bool operator> (const Node &other) const
 
bool operator< (const Node &other) const
 
std::string getImplementation () const
 
DynParaLoopgetClosestDPLAmongAncestors () const
 
std::map< std::string, std::string > getProperties ()
 
std::map< std::string, std::string > getPropertyMap ()
 
virtual void setProperties (std::map< std::string, std::string > properties)
 
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 int isModified ()
 
virtual int isValid ()
 indicates if the node is valid (returns 1) or not (returns 0) More...
 
virtual std::string getContainerLog ()
 returns a string that contains the name of the container log file if it exists More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledNodes)
 
- Public Member Functions inherited from YACS::ENGINE::Scheduler
virtual ~Scheduler ()
 

Public Attributes

std::map< std::string, Node * > nodeMap
 
std::map< std::string, ServiceNode * > serviceMap
 
std::map< std::string, InlineNode * > inlineMap
 
std::map< std::string, TypeCode * > typeMap
 
std::map< std::string, Container * > containerMap
 
std::map< std::string, ComponentInstance * > componentInstanceMap
 
std::vector< std::string > names
 
LoggerMap _loggers
 
- Public Attributes inherited from YACS::ENGINE::Node
YACS::Colour _colour
 

Protected Member Functions

void removeContainers ()
 
- Protected Member Functions inherited from YACS::ENGINE::Bloc
NodesimpleClone (ComposedNode *father, bool editionOnly=true) const
 
bool areAllSubNodesFinished () const
 
bool areAllSubNodesDone () const
 
bool isNameAlreadyUsed (const std::string &name) const
 
void checkNoCyclePassingThrough (Node *node)
 
std::vector< std::pair< OutGate *, InGate * > > getSetOfInternalCFLinks () const
 
YACS::Event updateStateOnFinishedEventFrom (Node *node)
 
YACS::Event updateStateOnFailedEventFrom (Node *node, const Executor *execInst)
 Notify this bloc that a node has failed. More...
 
void initComputation () const
 
void performCFComputationsOnlyOneLevel (LinkInfo &info) const
 
void performCFComputations (LinkInfo &info) const
 
void destructCFComputations (LinkInfo &info) const
 destroy recursively all results of initial computations. More...
 
void checkControlDependancy (OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const
 
bool areLinked (Node *start, Node *end, bool fw) const
 Check if two nodes are linked. More...
 
bool arePossiblyRunnableAtSameTime (Node *start, Node *end) const
 Check if two nodes can run in parallel. More...
 
void checkCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 Check control flow links. More...
 
void seekOkAndUseless1 (std::vector< Node * > &okAndUseless1, std::set< Node * > &allNodes) const
 
void seekUseless2 (std::vector< Node * > &useless2, std::set< Node * > &allNodes) const
 
- Protected Member Functions inherited from YACS::ENGINE::StaticDefinedComposedNode
 StaticDefinedComposedNode (const std::string &name)
 
 StaticDefinedComposedNode (const StaticDefinedComposedNode &other, ComposedNode *father)
 
void checkControlDependancy (OutPort *start, InPort *end, bool cross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &fw, std::vector< OutPort * > &fwCross, std::map< ComposedNode *, std::list< OutPort * >, SortHierarc > &bw, LinkInfo &info) const
 
- Protected Member Functions inherited from YACS::ENGINE::ComposedNode
 ComposedNode (const std::string &name)
 
 ComposedNode (const ComposedNode &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...
 
void edDisconnectAllLinksWithMe ()
 
YACS::Event updateStateFrom (Node *node, YACS::Event event, const Executor *execInst)
 Update node state on receiving event from a node. More...
 
virtual YACS::Event updateStateOnStartEventFrom (Node *node)
 Method used to notify the node that a child node has started. More...
 
virtual void checkLinkPossibility (OutPort *start, const std::list< ComposedNode * > &pointsOfViewStart, InPort *end, const std::list< ComposedNode * > &pointsOfViewEnd)
 
virtual void buildDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void buildDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void getDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void getDelegateOf (std::pair< OutPort *, OutPort * > &port, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
virtual void releaseDelegateOf (InPort *&port, OutPort *initialStart, const std::list< ComposedNode * > &pointsOfView)
 
virtual void releaseDelegateOf (OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list< ComposedNode * > &pointsOfView)
 
void checkInMyDescendance (Node *nodeToTest) const
 Check if a node is in the descendance of this node. More...
 
template<class PORT >
std::string getPortName (const PORT *port) const
 
void checkNoCrossHierachyWith (Node *node) const
 
NodegetLowestNodeDealingAll (const std::list< OutPort * > &ports) const
 
void checkLinksCoherenceRegardingControl (const std::vector< OutPort * > &starts, InputPort *end, LinkInfo &info) const
 
void solveObviousOrDelegateCFLinks (const std::list< OutPort * > &starts, InputPort *end, unsigned char &alreadyFed, bool direction, LinkInfo &info) const
 
- Protected Member Functions inherited from YACS::ENGINE::Node
 Node (const std::string &name)
 
 Node (const Node &other, ComposedNode *father)
 
virtual void exForwardFailed ()
 
virtual void exForwardFinished ()
 

Protected Attributes

bool _edition
 
int _compoinstctr
 
- Protected Attributes inherited from YACS::ENGINE::Bloc
std::list< Node * > _setOfNode
 
std::map< Node *, std::set< Node * > > * _fwLinks
 For internal calculations. More...
 
std::map< Node *, std::set< Node * > > * _bwLinks
 For internal calculations. More...
 
- 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
 
Node_eventReceiver =nullptr
 

Friends

std::ostream & operator<< (std::ostream &os, const Proc &p)
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::ComposedNode
static ComposedNodegetLowestCommonAncestor (Node *node1, Node *node2)
 Retrieves the lowest common ancestor of 2 nodes. More...
 
static std::string getLowestCommonAncestorStr (const std::string &node1, const std::string &node2)
 
- Static Public Member Functions inherited from YACS::ENGINE::Node
static std::string getStateName (YACS::StatesForNode state)
 Return the name of a state. More...
 
static void checkValidityOfNodeName (const std::string &name)
 
- Static Public Attributes inherited from YACS::ENGINE::ComposedNode
static const char SEP_CHAR_BTW_LEVEL [] ="."
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 
- Static Protected Member Functions inherited from YACS::ENGINE::Bloc
static void verdictForOkAndUseless1 (const std::map< Node *, std::list< OutPort * > > &pool, InputPort *end, const std::vector< Node * > &candidates, unsigned char &alreadyFed, bool direction, LinkInfo &info)
 
static void verdictForCollapses (const std::map< Node *, std::list< OutPort * > > &pool, InputPort *end, const std::set< Node * > &candidates, unsigned char &alreadyFed, bool direction, LinkInfo &info)
 
- Static Protected Member Functions inherited from YACS::ENGINE::ComposedNode
static bool splitNamesBySep (const std::string &globalName, const char separator[], std::string &firstPart, std::string &lastPart, bool priority)
 Splits name globalName in 2 parts using separator. More...
 
- Static Protected Member Functions inherited from YACS::ENGINE::Node
static void checkValidityOfPortName (const std::string &name)
 
static ComposedNodecheckHavingCommonFather (Node *node1, Node *node2)
 
- Static Protected Attributes inherited from YACS::ENGINE::ComposedNode
static const unsigned char FED_ST = 2
 
static const unsigned char FREE_ST = 0
 
static const unsigned char FED_DS_ST = 1
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Base class for all schema objects.

This is an abstract class that must be specialized in runtime.

Definition at line 43 of file Proc.hxx.

Member Typedef Documentation

◆ LoggerMap

typedef std::map<std::string, Logger*> YACS::ENGINE::Proc::LoggerMap

Definition at line 95 of file Proc.hxx.

Constructor & Destructor Documentation

◆ Proc()

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

Definition at line 48 of file Proc.cxx.

48  :Bloc(name),_edition(false),_compoinstctr(0)
49 {
51  DEBTRACE("theRuntime->_tc_double->ref: " << theRuntime->_tc_double->getRefCnt());
52  DEBTRACE("theRuntime->_tc_int->ref: " << theRuntime->_tc_int->getRefCnt());
53  DEBTRACE("theRuntime->_tc_string->ref: " << theRuntime->_tc_string->getRefCnt());
54  DEBTRACE("theRuntime->_tc_bool->ref: " << theRuntime->_tc_bool->getRefCnt());
55  DEBTRACE("theRuntime->_tc_file->ref: " << theRuntime->_tc_file->getRefCnt());
61  typeMap["double"]=theRuntime->_tc_double;
62  typeMap["string"]=theRuntime->_tc_string;
63  typeMap["int"]=theRuntime->_tc_int;
64  typeMap["bool"]=theRuntime->_tc_bool;
65  typeMap["file"]=theRuntime->_tc_file;
66 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:32
YACS::ENGINE::Runtime * theRuntime
Definition: parsers.cxx:40
std::map< std::string, TypeCode * > typeMap
Definition: Proc.hxx:90
unsigned int getRefCnt() const
Definition: RefCounter.hxx:32
static YACS::ENGINE::TypeCode * _tc_double
Definition: Runtime.hxx:136
static YACS::ENGINE::TypeCode * _tc_bool
Definition: Runtime.hxx:138
static YACS::ENGINE::TypeCode * _tc_file
Definition: Runtime.hxx:140
static YACS::ENGINE::TypeCode * _tc_int
Definition: Runtime.hxx:137
static YACS::ENGINE::TypeCode * _tc_string
Definition: Runtime.hxx:139
YACSLIBENGINE_EXPORT Runtime * getRuntime()
Definition: Runtime.cxx:61

References YACS::ENGINE::Runtime::_tc_bool, YACS::ENGINE::Runtime::_tc_double, YACS::ENGINE::Runtime::_tc_file, YACS::ENGINE::Runtime::_tc_int, YACS::ENGINE::Runtime::_tc_string, DEBTRACE, YACS::ENGINE::RefCounter::getRefCnt(), YACS::ENGINE::getRuntime(), YACS::ENGINE::RefCounter::incrRef(), theRuntime, and typeMap.

◆ ~Proc()

Proc::~Proc ( )
virtual

Definition at line 68 of file Proc.cxx.

69 {
70  DEBTRACE("Proc::~Proc");
71  //for the moment all nodes are owned, so no need to manage their destruction
72  //nodeMap, inlineMap, serviceMap will be cleared automatically
73  //but we need to destroy TypeCodes
74  std::map<std::string, TypeCode *>::iterator pt;
75  for(pt=typeMap.begin();pt!=typeMap.end();pt++)
76  ((*pt).second)->decrRef();
77 
79 
80  //get rid of loggers in logger map
81  std::map<std::string, Logger*>::const_iterator lt;
82  for(lt=_loggers.begin();lt!=_loggers.end();lt++)
83  delete (*lt).second;
84 }
void removeContainers()
Definition: Proc.cxx:491
LoggerMap _loggers
Definition: Proc.hxx:96

References _loggers, DEBTRACE, removeContainers(), and typeMap.

Member Function Documentation

◆ accept()

void Proc::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::Bloc.

Definition at line 199 of file Proc.cxx.

200 {
201  visitor->visitProc(this);
202 }
virtual void visitProc(Proc *node)=0

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

Referenced by dumpState(), Handler(), main(), YACS::ENGINE::SchemaSave::save(), saveSchema(), YACS::ENGINE::SalomeProc::saveSchema(), saveState(), and YACS::ENGINE::schemaSaveState().

◆ addComponentInstance()

void Proc::addComponentInstance ( ComponentInstance inst,
const std::string &  name = "",
bool  resetCtr = false 
)
virtual

Add a ComponentInstance into componentInstanceMap.

If the name == "", the component instance is automatically named with a unique (in the Proc) name

Parameters
instthe component instance
namethe component instance name
resetCtrtry to reuse instance number previously released, false by default

Definition at line 526 of file Proc.cxx.

527 {
528  if(name != "")
529  {
530  inst->setName(name);
531  inst->setAnonymous(false);
532  if(componentInstanceMap.count(name)!=0)
533  componentInstanceMap[name]->decrRef();
534  componentInstanceMap[name]=inst;
535  inst->incrRef();
536  }
537  else
538  {
539  //automatic naming : componame_<_compoinstctr>
540  std::string instname;
541  std::string componame=inst->getCompoName();
542  if (resetCtr)
543  _compoinstctr = 0;
544  while(1)
545  {
546  std::ostringstream buffer;
547  buffer << ++_compoinstctr;
548  instname=componame+"_"+buffer.str();
549  if(componentInstanceMap.count(instname)==0)
550  {
551  inst->setName(instname);
552  componentInstanceMap[instname]=inst;
553  inst->incrRef();
554  break;
555  }
556  }
557  }
558 }
void setName(const std::string &name)
virtual void setAnonymous(bool anon)
const std::string & getCompoName() const
std::map< std::string, ComponentInstance * > componentInstanceMap
Definition: Proc.hxx:92

References _compoinstctr, componentInstanceMap, YACS::ENGINE::ComponentInstance::getCompoName(), YACS::ENGINE::RefCounter::incrRef(), YACS::ENGINE::ComponentInstance::setAnonymous(), and YACS::ENGINE::ComponentInstance::setName().

Referenced by createComponentInstance(), YACS::HMI::CommandAddComponentInstance::localExecute(), YACS::HMI::CommandAddComponentFromCatalog::localExecute(), and YACS::HMI::CommandAssociateServiceToComponent::localReverse().

◆ createComponentInstance()

ComponentInstance * Proc::createComponentInstance ( const std::string &  componame,
const std::string &  name = "",
const std::string &  kind = "" 
)
virtual

Create a new ComponentInstance and add it into componentInstanceMap.

If the name == "", the component instance is automatically named with a unique (in the Proc) name

Parameters
componamethe component name
namethe component instance name
kindthe component instance kind (depends on runtime)
Returns
the created ComponentInstance

Definition at line 599 of file Proc.cxx.

600 {
601  ComponentInstance* inst= getRuntime()->createComponentInstance(componame,kind);
602  addComponentInstance(inst,name);
603  return inst;
604 }
Base class for all component instances.
virtual void addComponentInstance(ComponentInstance *inst, const std::string &name="", bool resetCtr=false)
Add a ComponentInstance into componentInstanceMap.
Definition: Proc.cxx:526
virtual ComponentInstance * createComponentInstance(const std::string &name, const std::string &kind="")
Definition: Runtime.cxx:215

References addComponentInstance(), YACS::ENGINE::Runtime::createComponentInstance(), and YACS::ENGINE::getRuntime().

Referenced by YACS::servicetypeParser< T >::component(), and YACS::proctypeParser< T >::componentinstance().

◆ createContainer()

Container * Proc::createContainer ( const std::string &  name,
const std::string &  kind = "" 
)
virtual

Create a new Container and store it in containerMap.

Parameters
namethe container name and key in containerMap
kindthe container kind (depends on runtime)
Returns
the created Container

Definition at line 506 of file Proc.cxx.

507 {
508  Container *co(getRuntime()->createContainer(kind));
509  co->setName(name);
510  if(containerMap.count(name)!=0)
511  containerMap[name]->decrRef();
512  containerMap[name]=co;
513  co->incrRef();
514  co->setProc(this);
515  return co;
516 }
virtual Container * createContainer(const std::string &name, const std::string &kind="")
Create a new Container and store it in containerMap.
Definition: Proc.cxx:506
std::map< std::string, Container * > containerMap
Definition: Proc.hxx:91

References containerMap, YACS::ENGINE::getRuntime(), YACS::ENGINE::RefCounter::incrRef(), YACS::ENGINE::Container::setName(), and YACS::ENGINE::Container::setProc().

Referenced by YACS::proctypeParser< T >::container(), YACS::servertypeParser< T >::loadcontainer(), and YACS::ENGINE::SalomeProc::SalomeProc().

◆ createInterfaceTc()

TypeCode * Proc::createInterfaceTc ( const std::string &  id,
const std::string &  name,
std::list< TypeCodeObjref * >  ltc 
)
virtual

Create an object reference TypeCode.

Parameters
idthe TypeCode repository id
namethe TypeCode name
ltca liste of object reference TypeCode to use as base types for this type
Returns
the created TypeCode

Reimplemented in YACS::ENGINE::SalomeProc.

Definition at line 132 of file Proc.cxx.

134 {
135  TypeCode* t = TypeCode::interfaceTc(id.c_str(),name.c_str(),ltc);
136  if(typeMap.count(name)!=0)
137  typeMap[name]->decrRef();
138  typeMap[name]=t;
139  t->incrRef();
140  return t;
141 }
Base class for all type objects.
Definition: TypeCode.hxx:68
static TypeCode * interfaceTc(const char *id, const char *name)
static factory of object reference type given an id and a name
Definition: TypeCode.cxx:229

References YACS::ENGINE::TypeCode::interfaceTc(), gui.Appli::t, and typeMap.

Referenced by YACS::ENGINE::SalomeProc::createInterfaceTc(), and YACS::objtypeParser::post().

◆ createSequenceTc()

TypeCode * Proc::createSequenceTc ( const std::string &  id,
const std::string &  name,
TypeCode content 
)
virtual

Create a sequence TypeCode.

Parameters
idthe TypeCode repository id ("" for normal use)
namethe TypeCode name
contentthe element TypeCode
Returns
the created TypeCode

Definition at line 150 of file Proc.cxx.

152 {
153  TypeCode* t = TypeCode::sequenceTc(id.c_str(),name.c_str(),content);
154  if(typeMap.count(name)!=0)
155  typeMap[name]->decrRef();
156  typeMap[name]=t;
157  t->incrRef();
158  return t;
159 }
static TypeCode * sequenceTc(const char *id, const char *name, TypeCode *content)
static factory of sequence type given an id, a name and a content type
Definition: TypeCode.cxx:254

References YACS::ENGINE::TypeCode::sequenceTc(), gui.Appli::t, and typeMap.

Referenced by YACS::seqtypeParser::post().

◆ createStructTc()

TypeCode * Proc::createStructTc ( const std::string &  id,
const std::string &  name 
)
virtual

Reimplemented in YACS::ENGINE::SalomeProc.

Definition at line 161 of file Proc.cxx.

162 {
163  TypeCode* t = TypeCode::structTc(id.c_str(),name.c_str());
164  if(typeMap.count(name)!=0)
165  typeMap[name]->decrRef();
166  typeMap[name]=t;
167  t->incrRef();
168  return t;
169 }
static TypeCode * structTc(const char *id, const char *name)
static factory of struct type given an id and a name
Definition: TypeCode.cxx:269

References YACS::ENGINE::TypeCode::structTc(), gui.Appli::t, and typeMap.

Referenced by YACS::ENGINE::SalomeProc::createStructTc(), and YACS::structtypeParser::post().

◆ createType()

TypeCode * Proc::createType ( const std::string &  name,
const std::string &  kind 
)
virtual

Definition at line 103 of file Proc.cxx.

104 {
105  TypeCode* t;
106  if(kind=="double")
108  else if(kind=="string")
110  else if(kind=="int")
111  t=getRuntime()->_tc_int;
112  else if(kind=="bool")
113  t=getRuntime()->_tc_bool;
114  else
115  throw Exception("Unknown kind");
116 
117  if(typeMap.count(name)!=0)
118  typeMap[name]->decrRef();
119  t->incrRef();
120  typeMap[name]=t;
121  t->incrRef();
122  return t;
123 }

References YACS::ENGINE::Runtime::_tc_bool, YACS::ENGINE::Runtime::_tc_double, YACS::ENGINE::Runtime::_tc_int, YACS::ENGINE::Runtime::_tc_string, YACS::ENGINE::getRuntime(), gui.Appli::t, and typeMap.

Referenced by YACS::proctypeParser< T >::type().

◆ getEdition()

virtual bool YACS::ENGINE::Proc::getEdition ( )
inlinevirtual

Definition at line 97 of file Proc.hxx.

97 {return _edition;}

◆ getGlobalProgressPercent()

int Proc::getGlobalProgressPercent ( )

Definition at line 234 of file Proc.cxx.

235 {
236  list<ProgressWeight> weightList = getProgressWeight();
237  int weightDone = 0;
238  int weightTotal = 0;
239  int progressPercent = 0;
240  for(list<ProgressWeight>::const_iterator iter=weightList.begin();iter!=weightList.end();iter++)
241  {
242  weightDone += (*iter).weightDone;
243  weightTotal += (*iter).weightTotal;
244  }
245  if (weightTotal > 0)
246  progressPercent = int(float(weightDone) / float(weightTotal) * 100);
247  return progressPercent;
248 }
std::list< ProgressWeight > getProgressWeight() const
Get the progress weight for all elementary nodes.

References YACS::ENGINE::ComposedNode::getProgressWeight().

◆ getIds()

std::list< std::string > Proc::getIds ( )

Definition at line 417 of file Proc.cxx.

418 {
419  list<YACS::ENGINE::Node *> nodes = getAllRecursiveConstituents();
420  int len = nodes.size();
421  list<string> ids;
422  for( list<YACS::ENGINE::Node *>::const_iterator iter = nodes.begin();
423  iter != nodes.end(); iter++)
424  {
425  ids.push_back(getChildName(*iter));
426  }
427  ids.push_back("_root_");
428  return ids;
429 }
std::string getChildName(const Node *node) const
virtual std::list< Node * > getAllRecursiveConstituents()
Idem getAllRecursiveNodes, but this node is NOT included.

References YACS::ENGINE::ComposedNode::getAllRecursiveConstituents(), and YACS::ENGINE::ComposedNode::getChildName().

◆ getInPortValue()

std::string Proc::getInPortValue ( int  nodeNumId,
std::string  portName 
)

Definition at line 265 of file Proc.cxx.

266 {
267  DEBTRACE("Proc::getInPortValue " << nodeNumId << " " << portName);
268  stringstream msg;
269  if(YACS::ENGINE::Node::idMap.count(nodeNumId) == 0)
270  {
271  msg << "<value><error>unknown node id: " << nodeNumId << "</error></value>";
272  return msg.str();
273  }
274  try
275  {
277  InputPort * inputPort = node->getInputPort(portName);
278  return inputPort->getAsString();
279  }
280  catch(YACS::Exception& ex)
281  {
282  DEBTRACE("Proc::getInPortValue " << ex.what());
283  msg << "<value><error>" << ex.what() << "</error></value>";
284  return msg.str();
285  }
286 }
virtual std::string getAsString()
returns port value as a string that can be used in a GUI for example
Definition: DataPort.cxx:84
Base class for Input Ports.
Definition: InputPort.hxx:44
Base class for all nodes.
Definition: Node.hxx:70
static std::map< int, Node * > idMap
Definition: Node.hxx:187
virtual InputPort * getInputPort(const std::string &name) const
Definition: Node.cxx:259

References DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::DataPort::getAsString(), YACS::ENGINE::Node::getInputPort(), and YACS::ENGINE::Node::idMap.

◆ getLogger()

Logger * Proc::getLogger ( const std::string &  name)
virtual

Definition at line 431 of file Proc.cxx.

432 {
433  Logger* logger;
434  LoggerMap::const_iterator it = _loggers.find(name);
435 
436  if (it != _loggers.end())
437  {
438  logger = it->second;
439  }
440  else
441  {
442  logger = new Logger(name);
443  _loggers[name]=logger;
444  }
445  return logger;
446 }
Class for logging error messages.
Definition: Logger.hxx:38

References _loggers.

Referenced by YACS::YACSLoader::load(), YACS::ENGINE::ProcCataLoader::loadCata(), YACS::HMI::GenericGui::loadSchema(), YACS::parser::logError(), main(), YACS::HMI::GenericGui::onImportSchema(), YACS::HMI::GenericGui::onImportSupervSchema(), YACS::HMI::GenericGui::onLoadAndRunSchema(), YACS::HMI::EditionProc::synchronize(), and YACS::HMI::BatchJobsListDialog::userOK().

◆ getNodeContainerLog()

std::string Proc::getNodeContainerLog ( int  nodeNumId)

Definition at line 390 of file Proc.cxx.

391 {
392  DEBTRACE("Proc::getNodeContainerLog " << nodeNumId);
393  stringstream msg;
394  if(YACS::ENGINE::Node::idMap.count(nodeNumId) == 0)
395  {
396  msg << "Unknown node id " << nodeNumId;
397  return msg.str();
398  }
400  return node->getContainerLog();
401 }
virtual std::string getContainerLog()
returns a string that contains the name of the container log file if it exists
Definition: Node.cxx:789

References DEBTRACE, YACS::ENGINE::Node::getContainerLog(), and YACS::ENGINE::Node::idMap.

◆ getNodeErrorDetails()

std::string Proc::getNodeErrorDetails ( int  nodeNumId)

Definition at line 364 of file Proc.cxx.

365 {
366  DEBTRACE("Proc::getNodeErrorDetails " << nodeNumId);
367  stringstream msg;
368  if(YACS::ENGINE::Node::idMap.count(nodeNumId) == 0)
369  {
370  msg << "Unknown node id " << nodeNumId;
371  return msg.str();
372  }
374  return node->getErrorDetails();
375 }
virtual std::string getErrorDetails() const
Definition: Node.hxx:189

References DEBTRACE, YACS::ENGINE::Node::getErrorDetails(), and YACS::ENGINE::Node::idMap.

◆ getNodeErrorReport()

std::string Proc::getNodeErrorReport ( int  nodeNumId)

Definition at line 377 of file Proc.cxx.

378 {
379  DEBTRACE("Proc::getNodeErrorReport " << nodeNumId);
380  stringstream msg;
381  if(YACS::ENGINE::Node::idMap.count(nodeNumId) == 0)
382  {
383  msg << "Unknown node id " << nodeNumId;
384  return msg.str();
385  }
387  return node->getErrorReport();
388 }
virtual std::string getErrorReport()
returns a string that contains an error report if the node is in error
Definition: Node.cxx:748

References DEBTRACE, YACS::ENGINE::Node::getErrorReport(), and YACS::ENGINE::Node::idMap.

◆ getNodeProgress()

std::string Proc::getNodeProgress ( int  numId)

Definition at line 222 of file Proc.cxx.

223 {
224  std::string progress = "0";
225  if(YACS::ENGINE::Node::idMap.count(numId) == 0)
226  {
227  cerr << "Unknown node id " << numId << endl;
228  }
230  progress = node->getProgress();
231  return progress;
232 }
Base class for all composed nodes.

References YACS::ENGINE::Node::idMap.

◆ getNodeState()

YACS::StatesForNode Proc::getNodeState ( int  numId)

Definition at line 210 of file Proc.cxx.

211 {
212  if(YACS::ENGINE::Node::idMap.count(numId) == 0)
213  {
214  cerr << "Unknown node id " << numId << endl;
215  return YACS::UNDEFINED;
216  }
219  return state;
220 }
virtual YACS::StatesForNode getEffectiveState() const
Return the node state in the context of its father.
Definition: Node.cxx:537
StatesForNode
Definition: define.hxx:34
@ UNDEFINED
Definition: define.hxx:35

References YACS::ENGINE::Node::getEffectiveState(), YACS::ENGINE::Node::idMap, yacsorb.CORBAEngineTest::state, and YACS::UNDEFINED.

◆ getNumIds()

std::list< int > Proc::getNumIds ( )

Definition at line 403 of file Proc.cxx.

404 {
405  list<YACS::ENGINE::Node *> nodes = getAllRecursiveConstituents();
406  int len = nodes.size();
407  list<int> numids;
408  for( list<YACS::ENGINE::Node *>::const_iterator iter = nodes.begin();
409  iter != nodes.end(); iter++)
410  {
411  numids.push_back((*iter)->getNumId());
412  }
413  numids.push_back(this->getNumId());
414  return numids;
415 }
int getNumId()
return node instance identifiant, unique for each node instance
Definition: Node.cxx:636

References YACS::ENGINE::ComposedNode::getAllRecursiveConstituents(), YACS::ENGINE::Node::getNumId(), and yacsorb.CORBAEngineTest::numids.

◆ getOutPortValue()

std::string Proc::getOutPortValue ( int  nodeNumId,
std::string  portName 
)

Definition at line 341 of file Proc.cxx.

342 {
343  DEBTRACE("Proc::getOutPortValue " << nodeNumId << " " << portName);
344  stringstream msg;
345  if(YACS::ENGINE::Node::idMap.count(nodeNumId) == 0)
346  {
347  msg << "<value><error>unknown node id: " << nodeNumId << "</error></value>";
348  return msg.str();
349  }
350  try
351  {
353  OutputPort * outputPort = node->getOutputPort(portName);
354  return outputPort->getAsString();
355  }
356  catch(YACS::Exception& ex)
357  {
358  DEBTRACE("Proc::getOutPortValue " << ex.what());
359  msg << "<value><error>" << ex.what() << "</error></value>";
360  return msg.str();
361  }
362 }
virtual OutputPort * getOutputPort(const std::string &name) const =0

References DEBTRACE, testCppPluginInvokation::ex, YACS::ENGINE::DataPort::getAsString(), YACS::ENGINE::Node::getOutputPort(), and YACS::ENGINE::Node::idMap.

◆ getProc() [1/2]

◆ getProc() [2/2]

const Proc * Proc::getProc ( ) const
virtual

Return the proc (this)

Reimplemented from YACS::ENGINE::Node.

Definition at line 613 of file Proc.cxx.

614 {
615  return this;
616 }

◆ getTypeCode()

TypeCode * Proc::getTypeCode ( const std::string &  name)
virtual

Definition at line 171 of file Proc.cxx.

172 {
173  TypeCode* aTC=0;
174  if(typeMap.count(name)==0)
175  aTC=getRuntime()->getTypeCode(name);
176  else
177  aTC=typeMap[name];
178 
179  if(!aTC)
180  {
181  std::stringstream msg;
182  msg << "Type " << name << " does not exist" ;
183  msg << " (" <<__FILE__ << ":" << __LINE__ << ")";
184  throw Exception(msg.str());
185  }
186 
187  return aTC;
188 }
virtual TypeCode * getTypeCode(const std::string &name)
Get a typecode by its name from runtime catalogs.
Definition: Runtime.cxx:333

References YACS::ENGINE::getRuntime(), YACS::ENGINE::Runtime::getTypeCode(), and typeMap.

◆ getXMLState()

std::string Proc::getXMLState ( int  numId)

Definition at line 250 of file Proc.cxx.

251 {
252  if(YACS::ENGINE::Node::idMap.count(numId) == 0)
253  {
254  cerr << "Unknown node id " << numId << endl;
255  return "<state>unknown</state>";
256  }
258  stringstream msg;
259  msg << "<state>" << node->getEffectiveState() << "</state>";
260  msg << "<name>" << node->getQualifiedName() << "</name>";
261  msg << "<id>" << numId << "</id>";
262  return msg.str();
263 }
std::string getQualifiedName() const
same as Node::getName() in most cases, but differs for children of switch
Definition: Node.cxx:625

References YACS::ENGINE::Node::getEffectiveState(), YACS::ENGINE::Node::getQualifiedName(), and YACS::ENGINE::Node::idMap.

◆ modified()

void Proc::modified ( )
virtual

Sets Proc in modified state and update state if in edition mode.

Reimplemented from YACS::ENGINE::Node.

Definition at line 459 of file Proc.cxx.

460 {
461  DEBTRACE("Proc::modified() " << _edition);
462  _modified=1;
463  if(_edition)
464  edUpdateState();
465 }
virtual void edUpdateState()
update the status of the node

References _edition, YACS::ENGINE::Node::_modified, DEBTRACE, and YACS::ENGINE::ComposedNode::edUpdateState().

◆ removeComponentInstance()

void Proc::removeComponentInstance ( ComponentInstance inst)
virtual

Remove a componentInstance from the componentInstanceMap.

To be used for a componentInstance with no service nodes referenced.

Parameters
instthe component instance

Definition at line 566 of file Proc.cxx.

567 {
568  if (componentInstanceMap.count(inst->getInstanceName()))
569  {
570  componentInstanceMap.erase(inst->getInstanceName());
571  inst->decrRef();
572  }
573 }
const std::string & getInstanceName() const

References componentInstanceMap, YACS::ENGINE::RefCounter::decrRef(), and YACS::ENGINE::ComponentInstance::getInstanceName().

Referenced by YACS::HMI::CommandAddComponentInstance::localReverse(), and YACS::HMI::CommandAddComponentFromCatalog::localReverse().

◆ removeContainer()

void Proc::removeContainer ( Container cont)
virtual

Remove a container from the containerMap.

To be used for a container with no componentInstance referenced.

Parameters
contthe container

Definition at line 581 of file Proc.cxx.

582 {
583  if (containerMap.count(cont->getName()))
584  {
585  containerMap.erase(cont->getName());
586  cont->decrRef();
587  }
588 }
virtual std::string getName() const
Definition: Container.hxx:81

References containerMap, YACS::ENGINE::RefCounter::decrRef(), and YACS::ENGINE::Container::getName().

Referenced by YACS::HMI::SubjectContainerBase::~SubjectContainerBase().

◆ removeContainers()

void Proc::removeContainers ( )
protected

Definition at line 491 of file Proc.cxx.

492 {
493  //get rid of containers in container map
494  std::map<std::string, Container*>::const_iterator it;
495  for(it=containerMap.begin();it!=containerMap.end();it++)
496  ((*it).second)->decrRef();
497  containerMap.clear();
498 }

References containerMap.

Referenced by updateContainersAndComponents(), and ~Proc().

◆ saveSchema()

void Proc::saveSchema ( const std::string &  xmlSchemaFile)
virtual

Save Proc in XML schema file.

Parameters
xmlSchemaFilethe file name

Definition at line 471 of file Proc.cxx.

472 {
473  VisitorSaveSchema vss(this);
474  vss.openFileSchema(xmlSchemaFile);
475  accept(&vss);
476  vss.closeFileSchema();
477 }
virtual void accept(Visitor *visitor)
Definition: Proc.cxx:199
Base class for all visitors that save a schema.

References accept(), YACS::ENGINE::VisitorSaveSchema::closeFileSchema(), and YACS::ENGINE::VisitorSaveSchema::openFileSchema().

◆ saveState()

void Proc::saveState ( const std::string &  xmlStateFile)
virtual

Save Proc state in XML state file.

deprecated. See VisitorSalomeSaveState and schemaSaveState in order to deal with the execution state of ForEachLoop.

Parameters
xmlStateFilethe file name

Definition at line 483 of file Proc.cxx.

484 {
485  VisitorSaveState vst(this);
486  vst.openFileDump(xmlStateFile);
487  accept(&vst);
488  vst.closeFileDump();
489 }

References accept(), YACS::ENGINE::VisitorSaveState::closeFileDump(), and YACS::ENGINE::VisitorSaveState::openFileDump().

◆ setEdition()

void Proc::setEdition ( bool  edition)
virtual

Definition at line 448 of file Proc.cxx.

449 {
450  DEBTRACE("Proc::setEdition: " << edition);
451  _edition=edition;
452  if(_edition)
453  edUpdateState();
454 }

References _edition, DEBTRACE, and YACS::ENGINE::ComposedNode::edUpdateState().

Referenced by YACS::HMI::GenericGui::createContext(), and YACS::HMI::QtGuiContext::~QtGuiContext().

◆ setInPortValue()

std::string Proc::setInPortValue ( std::string  nodeName,
std::string  portName,
std::string  value 
)

Definition at line 288 of file Proc.cxx.

289 {
290  DEBTRACE("Proc::setInPortValue " << nodeName << " " << portName << " " << value);
291 
292  try
293  {
295  YACS::ENGINE::InputPort* inputPort = node->getInputPort(portName);
296 
297  switch (inputPort->edGetType()->kind())
298  {
299  case Double:
300  {
301  double val = atof(value.c_str());
302  inputPort->edInit(val);
303  }
304  break;
305  case Int:
306  {
307  int val = atoi(value.c_str());
308  inputPort->edInit(val);
309  }
310  break;
311  case String:
312  inputPort->edInit(value.c_str());
313  break;
314  case Bool:
315  {
316  if((!value.compare("False")) || (!value.compare("false")))
317  inputPort->edInit(false);
318  else if ((!value.compare("True")) || (!value.compare("true")))
319  inputPort->edInit(true);
320  else
321  {
322  int val = atoi(value.c_str());
323  inputPort->edInit(val);
324  }
325  }
326  break;
327  default:
328  DEBTRACE("Proc::setInPortValue: filtered type: " << inputPort->edGetType()->kind());
329  }
330  return value;
331  }
332  catch(YACS::Exception& ex)
333  {
334  DEBTRACE("Proc::setInPortValue " << ex.what());
335  stringstream msg;
336  msg << "<value><error>" << ex.what() << "</error></value>";
337  return msg.str();
338  }
339 }
TypeCode * edGetType() const
Definition: DataPort.hxx:53
void edInit(T value)
Definition: InputPort.hxx:129
std::map< std::string, Node * > nodeMap
Definition: Proc.hxx:87
DynType kind() const
Definition: TypeCode.cxx:47

References YACS::ENGINE::Bool, DEBTRACE, YACS::ENGINE::Double, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::InputPort::edInit(), testCppPluginInvokation::ex, YACS::ENGINE::Node::getInputPort(), YACS::ENGINE::Int, YACS::ENGINE::TypeCode::kind(), nodeMap, and YACS::ENGINE::String.

Referenced by main().

◆ setName()

void Proc::setName ( const std::string &  name)

Definition at line 204 of file Proc.cxx.

205 {
207  _name = name;
208 }
std::string _name
Definition: Node.hxx:89
static void checkValidityOfNodeName(const std::string &name)
Definition: Node.cxx:454

References YACS::ENGINE::Node::_name, and YACS::ENGINE::Node::checkValidityOfNodeName().

Referenced by YACS::proctypeParser< T >::name().

◆ setTypeCode()

void Proc::setTypeCode ( const std::string &  name,
TypeCode t 
)
virtual

Definition at line 190 of file Proc.cxx.

191 {
192  if(typeMap.count(name)!=0)
193  typeMap[name]->decrRef();
194  typeMap[name]=t;
195  t->incrRef();
196 }

References gui.Appli::t, and typeMap.

◆ typeName()

virtual std::string YACS::ENGINE::Proc::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::Bloc.

Reimplemented in YACS::ENGINE::SalomeProc.

Definition at line 84 of file Proc.hxx.

84 {return "YACS__ENGINE__Proc";}

Referenced by YACS::ENGINE::DistributedPythonNode::execute().

◆ updateContainersAndComponents()

void Proc::updateContainersAndComponents ( )
virtual

This method is useful if this has been modified recursively and an update is needed between all the containers and components refered by children and little children and maps.

Definition at line 622 of file Proc.cxx.

623 {
624  std::map<std::string, Container*> myContainerMap;
625  std::map<std::string, ComponentInstance*> myComponentInstanceMap;
626  DeploymentTree treeToDup(getDeploymentTree());
627  vector<Container *> conts(treeToDup.getAllContainers());
628  for(vector<Container *>::const_iterator iterCt=conts.begin();iterCt!=conts.end();iterCt++)
629  {
630  Container *tmp(*iterCt);
631  if(tmp)
632  {
633  if(myContainerMap.find(tmp->getName())!=myContainerMap.end())
634  {
635  std::ostringstream oss; oss << "Proc::updateContainersAndComponents : more than one container instance with name \"" << tmp->getName() << "\" !";
636  throw YACS::Exception(oss.str());
637  }
638  myContainerMap[tmp->getName()]=tmp;
639  tmp->incrRef();
640  }
641  vector<ComponentInstance *> comps=treeToDup.getComponentsLinkedToContainer(*iterCt);
642  for(vector<ComponentInstance *>::iterator iterCp=comps.begin();iterCp!=comps.end();iterCp++)
643  {
644  ComponentInstance *tmp2(*iterCp);
645  if(tmp2)
646  {
647  if(myComponentInstanceMap.find(tmp2->getCompoName())!=myComponentInstanceMap.end())
648  {
649  std::ostringstream oss; oss << "Proc::updateContainersAndComponents : more than one component instance with name \"" << tmp2->getCompoName() << "\" !";
650  throw YACS::Exception(oss.str());
651  }
652  }
653  myComponentInstanceMap[tmp2->getCompoName()]=tmp2;
654  tmp2->incrRef();
655  }
656  }
658  containerMap=myContainerMap;
659  componentInstanceMap=myComponentInstanceMap;
660 }
DeploymentTree getDeploymentTree() const
Essentially for test. Use checkDeploymentTree instead to be sure that returned DeploymentTree is cons...

References componentInstanceMap, containerMap, YACS::ENGINE::DeploymentTree::getAllContainers(), YACS::ENGINE::ComponentInstance::getCompoName(), YACS::ENGINE::DeploymentTree::getComponentsLinkedToContainer(), YACS::ENGINE::ComposedNode::getDeploymentTree(), YACS::ENGINE::Container::getName(), YACS::ENGINE::RefCounter::incrRef(), and removeContainers().

◆ writeDot()

void Proc::writeDot ( std::ostream &  os) const
virtual

Dump to the input stream a dot representation of the node.

Parameters
os: the input stream

Reimplemented from YACS::ENGINE::Bloc.

Definition at line 86 of file Proc.cxx.

87 {
88  os << "digraph " << getQualifiedName() << " {\n" ;
89  os << "node [ style=\"filled\" ];\n" ;
90  os << "compound=true;";
91  os << "states [label=< <TABLE> <TR> <TD BGCOLOR=\"pink\" > Ready</TD> <TD BGCOLOR=\"magenta\" > Toload</TD> </TR> <TR> <TD BGCOLOR=\"magenta\" > Loaded</TD> <TD BGCOLOR=\"purple\" > Toactivate</TD> </TR> <TR> <TD BGCOLOR=\"blue\" > Activated</TD> <TD BGCOLOR=\"green\" > Done</TD> </TR> <TR> <TD BGCOLOR=\"red\" > Error</TD> <TD BGCOLOR=\"orange\" > Failed</TD> </TR> <TR> <TD BGCOLOR=\"grey\" > Disabled</TD> <TD BGCOLOR=\"white\" > Pause</TD> </TR> </TABLE>> \n shape = plaintext \n style = invis \n ];\n";
92 
93  Bloc::writeDot(os);
94  os << "}\n" ;
95 }
virtual void writeDot(std::ostream &os) const
Dump to the input stream a dot representation of the node.
Definition: Bloc.cxx:423

References YACS::ENGINE::Node::getQualifiedName(), and YACS::ENGINE::Bloc::writeDot().

Referenced by driverTest(), and main().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const Proc p 
)
friend

Definition at line 97 of file Proc.cxx.

98 {
99  os << "Proc" ;
100  return os;
101 }

Member Data Documentation

◆ _compoinstctr

int YACS::ENGINE::Proc::_compoinstctr
protected

Definition at line 108 of file Proc.hxx.

Referenced by addComponentInstance().

◆ _edition

bool YACS::ENGINE::Proc::_edition
protected

Definition at line 107 of file Proc.hxx.

Referenced by modified(), and setEdition().

◆ _loggers

LoggerMap YACS::ENGINE::Proc::_loggers

Definition at line 96 of file Proc.hxx.

Referenced by getLogger(), and ~Proc().

◆ componentInstanceMap

◆ containerMap

std::map<std::string, Container*> YACS::ENGINE::Proc::containerMap

Definition at line 91 of file Proc.hxx.

Referenced by YACS::HMI::EditionComponent::changeContainer(), YACS::HMI::EditionSalomeNode::changeContainer(), YACS::HMI::EditionScript::changeContainer(), YACS::proctypeParser< T >::componentinstance(), YACS::proctypeParser< T >::container(), createContainer(), YACS::HMI::EditionComponent::fillContainerPanel(), YACS::HMI::EditionSalomeNode::fillContainerPanel(), YACS::HMI::EditionScript::fillContainerPanel(), YACS::ENGINE::Visitor::getContainerMap(), YACS::servertypeParser< T >::loadcontainer(), YACS::HMI::SubjectProc::loadContainers(), YACS::HMI::CommandRenameContainer::localExecute(), YACS::HMI::CommandAddContainerBase::localExecute(), YACS::HMI::CommandSetContainerProperties::localExecute(), YACS::HMI::CommandAddComponentInstance::localExecute(), YACS::HMI::CommandSetContainer::localExecute(), YACS::HMI::CommandAssociateComponentToContainer::localExecute(), YACS::HMI::CommandDestroy::localExecute(), YACS::HMI::CommandRenameContainer::localReverse(), YACS::HMI::CommandAddContainerBase::localReverse(), YACS::HMI::CommandSetContainerProperties::localReverse(), YACS::HMI::CommandSetContainer::localReverse(), YACS::HMI::CommandAssociateComponentToContainer::localReverse(), YACS::HMI::CommandAssociateServiceToComponent::localReverse(), YACS::remotetypeParser< T >::post(), YACS::servertypeParser< T >::post(), YACS::servicetypeParser< T >::post(), YACS::sinlinetypeParser< T >::post(), removeContainer(), removeContainers(), YACS::HMI::SubjectServiceNode::setComponent(), and updateContainersAndComponents().

◆ inlineMap

◆ names

std::vector<std::string> YACS::ENGINE::Proc::names

Definition at line 93 of file Proc.hxx.

Referenced by YACS::looptypeParser< T >::bloc(), YACS::casetypeParser::bloc(), YACS::bloctypeParser< T >::bloc(), YACS::bloctypeParser< T >::control(), YACS::bloctypeParser< T >::datalink(), YACS::looptypeParser< T >::datalink(), YACS::looptypeParser< T >::foreach(), YACS::casetypeParser::foreach(), YACS::bloctypeParser< T >::foreach(), YACS::looptypeParser< T >::forloop(), YACS::casetypeParser::forloop(), YACS::bloctypeParser< T >::forloop(), YACS::casetypeParser::id(), YACS::looptypeParser< T >::inline_(), YACS::casetypeParser::inline_(), YACS::bloctypeParser< T >::inline_(), YACS::bloctypeParser< T >::name(), YACS::whilelooptypeParser< T >::name(), YACS::forlooptypeParser< T >::name(), YACS::foreachlooptypeParser< T >::name(), YACS::optimizerlooptypeParser< T >::name(), YACS::switchtypeParser::name(), YACS::servertypeParser< T >::node(), YACS::servicetypeParser< T >::node(), YACS::looptypeParser< T >::node(), YACS::casetypeParser::node(), YACS::bloctypeParser< T >::node(), YACS::looptypeParser< T >::optimizer(), YACS::casetypeParser::optimizer(), YACS::bloctypeParser< T >::optimizer(), YACS::bloctypeParser< T >::outnode(), YACS::bloctypeParser< T >::parameter(), YACS::bloctypeParser< T >::post(), YACS::whilelooptypeParser< T >::post(), YACS::forlooptypeParser< T >::post(), YACS::foreachlooptypeParser< T >::post(), YACS::optimizerlooptypeParser< T >::post(), YACS::nodetypeParser< T >::post(), YACS::casetypeParser::post(), YACS::switchtypeParser::post(), YACS::foreachlooptypeParser< T >::postAttr(), YACS::optimizerlooptypeParser< T >::postAttr(), YACS::proctypeParser< T >::pre(), YACS::defaultcasetypeParser::pre(), YACS::bloctypeParser< T >::preset(), YACS::looptypeParser< T >::remote(), YACS::casetypeParser::remote(), YACS::bloctypeParser< T >::remote(), YACS::looptypeParser< T >::server(), YACS::casetypeParser::server(), YACS::bloctypeParser< T >::server(), YACS::looptypeParser< T >::service(), YACS::casetypeParser::service(), YACS::bloctypeParser< T >::service(), YACS::looptypeParser< T >::sinline(), YACS::casetypeParser::sinline(), YACS::bloctypeParser< T >::sinline(), YACS::bloctypeParser< T >::stream(), YACS::looptypeParser< T >::switch_(), YACS::casetypeParser::switch_(), YACS::bloctypeParser< T >::switch_(), YACS::looptypeParser< T >::while_(), YACS::casetypeParser::while_(), and YACS::bloctypeParser< T >::while_().

◆ nodeMap

std::map<std::string, Node*> YACS::ENGINE::Proc::nodeMap

Definition at line 87 of file Proc.hxx.

Referenced by YACS::looptypeParser< T >::bloc(), YACS::casetypeParser::bloc(), YACS::bloctypeParser< T >::bloc(), YACS::bloctypeParser< T >::control(), YACS::bloctypeParser< T >::datalink(), YACS::looptypeParser< T >::datalink(), YACS::looptypeParser< T >::foreach(), YACS::casetypeParser::foreach(), YACS::bloctypeParser< T >::foreach(), YACS::looptypeParser< T >::forloop(), YACS::casetypeParser::forloop(), YACS::bloctypeParser< T >::forloop(), YACS::looptypeParser< T >::inline_(), YACS::casetypeParser::inline_(), YACS::bloctypeParser< T >::inline_(), YACS::whilelooptypeParser< T >::name(), YACS::forlooptypeParser< T >::name(), YACS::looptypeParser< T >::node(), YACS::casetypeParser::node(), YACS::bloctypeParser< T >::node(), YACS::looptypeParser< T >::optimizer(), YACS::casetypeParser::optimizer(), YACS::bloctypeParser< T >::optimizer(), YACS::bloctypeParser< T >::outnode(), YACS::bloctypeParser< T >::parameter(), YACS::bloctypeParser< T >::preset(), YACS::looptypeParser< T >::remote(), YACS::casetypeParser::remote(), YACS::bloctypeParser< T >::remote(), YACS::looptypeParser< T >::server(), YACS::casetypeParser::server(), YACS::bloctypeParser< T >::server(), YACS::looptypeParser< T >::service(), YACS::casetypeParser::service(), YACS::bloctypeParser< T >::service(), setInPortValue(), YACS::looptypeParser< T >::sinline(), YACS::casetypeParser::sinline(), YACS::bloctypeParser< T >::sinline(), YACS::bloctypeParser< T >::stream(), YACS::looptypeParser< T >::switch_(), YACS::casetypeParser::switch_(), YACS::bloctypeParser< T >::switch_(), YACSPMMLBasicsTest1::testYACSdriver_LRANN(), YACSPMMLBasicsTest1::testYACSdriver_PmmlDoesNotExist(), YACSPMMLBasicsTest1::testYACSdriverLinearRegression(), YACSPMMLBasicsTest1::testYACSdriverNeuralNetwork(), YACS::looptypeParser< T >::while_(), YACS::casetypeParser::while_(), and YACS::bloctypeParser< T >::while_().

◆ serviceMap

◆ typeMap


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