Version: 9.16.0
YACS::ENGINE::XmlNode Class Reference

#include <XMLNode.hxx>

Inheritance diagram for YACS::ENGINE::XmlNode:
Collaboration diagram for YACS::ENGINE::XmlNode:

Public Member Functions

 XmlNode (const XmlNode &other, ComposedNode *father)
 
 XmlNode (const std::string &name)
 
virtual void execute ()
 
virtual void load ()
 DISTRIBUTION NOT YET implemented for XMLNode. More...
 
virtual void setRef (const std::string &ref)
 Associate a new component instance to this service node. More...
 
virtual void setScript (const std::string &script)
 
virtual std::string getScript () const
 
virtual ServiceNodecreateNode (const std::string &name)
 
virtual std::string getKind () const
 Return the service node kind. More...
 
- Public Member Functions inherited from YACS::ENGINE::ServiceNode
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)
 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)
 
bool isDeployable () const
 
ComponentInstancegetComponent ()
 
const ComponentInstancegetComponent () const
 
ContainergetContainer ()
 
YACS::StatesForNode getState () const
 
void getReadyTasks (std::vector< Task * > &tasks)
 
void edRemovePort (Port *port)
 
std::list< ElementaryNode * > getRecursiveConstituents () const
 
std::list< ProgressWeightgetProgressWeight () const
 Get the progress weight for all elementary nodes. More...
 
NodegetChildByName (const std::string &name) const
 
virtual void checkBasicConsistency () const
 
ComposedNodegetDynClonerIfExists (const ComposedNode *levelToStop) const
 
int getNumberOfInputPorts () const
 
int getNumberOfOutputPorts () const
 
std::string getInPortName (const InPort *) const
 
std::string getOutPortName (const OutPort *) const
 
InputPortgetInputPort (const std::string &name) const
 
OutputPortgetOutputPort (const std::string &name) const
 
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
 
OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const
 
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)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual void edOrderInputPorts (const std::list< InputPort * > &ports)
 
virtual void edOrderOutputPorts (const std::list< OutputPort * > &ports)
 
virtual std::string typeName ()
 
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
 
ComplexWeightgetWeight ()
 
void setWeight (double elementaryWeight)
 
void getWeightRegardingDPL (ComplexWeight *weight)
 
void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)
 
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...
 
void accept (Visitor *visitor)
 
virtual void addDatastreamPortToInitMultiService (const std::string &port_name, int number)
 
- Public Member Functions inherited from YACS::ENGINE::Node
virtual ~Node ()
 
virtual void init (bool start=true)
 
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 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 writeDot (std::ostream &os) const
 Dump to the input stream a dot representation of the node. More...
 
void writeDotInFile (const std::string &fileName) const
 
virtual void exUpdateState ()
 Update the node state. 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...
 
virtual void getReadyTasks (std::vector< Task * > &tasks)=0
 
virtual std::list< ElementaryNode * > getRecursiveConstituents () const =0
 
virtual std::list< ProgressWeightgetProgressWeight () const =0
 
virtual int getNumberOfInputPorts () const =0
 
virtual int getNumberOfOutputPorts () const =0
 
std::list< InPort * > getSetOfInPort () const
 
std::list< OutPort * > getSetOfOutPort () const
 
virtual std::list< InputPort * > getSetOfInputPort () const =0
 
virtual std::list< OutputPort * > getSetOfOutputPort () const =0
 
virtual std::list< InputPort * > getLocalInputPorts () const =0
 
virtual std::list< OutputPort * > getLocalOutputPorts () const =0
 
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...
 
virtual std::string getInPortName (const InPort *) const =0
 
virtual std::string getOutPortName (const OutPort *) const =0
 
virtual std::list< InputDataStreamPort * > getSetOfInputDataStreamPort () const =0
 
virtual std::list< OutputDataStreamPort * > getSetOfOutputDataStreamPort () const =0
 
InPortgetInPort (const std::string &name) const
 
InPropertyPortgetInPropertyPort () const
 
virtual OutPortgetOutPort (const std::string &name) const
 
virtual std::set< OutPort * > getAllOutPortsLeavingCurrentScope () const =0
 
virtual std::set< InPort * > getAllInPortsComingFromOutsideOfCurrentScope () const =0
 
virtual std::vector< std::pair< OutPort *, InPort * > > getSetOfLinksLeavingCurrentScope () const =0
 
virtual std::vector< std::pair< InPort *, OutPort * > > getSetOfLinksComingInCurrentScope () const =0
 
virtual InputPortgetInputPort (const std::string &name) const
 
virtual OutputPortgetOutputPort (const std::string &name) const =0
 
virtual InputDataStreamPortgetInputDataStreamPort (const std::string &name) const =0
 
virtual OutputDataStreamPortgetOutputDataStreamPort (const std::string &name) const =0
 
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
 
virtual ComposedNodegetRootNode () const
 
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 NodegetChildByName (const std::string &name) const =0
 
virtual ProcgetProc ()
 
virtual const ProcgetProc () const
 
virtual void accept (Visitor *visitor)=0
 
virtual int getMaxLevelOfParallelism () const =0
 
virtual void getWeightRegardingDPL (ComplexWeight *weight)=0
 
virtual void partitionRegardingDPL (const PartDefinition *pd, std::map< ComposedNode *, YACS::BASES::AutoRefCnt< PartDefinition > > &zeMap)=0
 
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 typeName ()
 
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 void edUpdateState ()
 update the status of the node 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 ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
virtual void getCoupledNodes (std::set< Task * > &coupledNodes)
 
virtual void cleanNodes ()
 Clean the node in case of not clean exit. More...
 
- Public Member Functions inherited from YACS::ENGINE::Task
virtual void begin ()=0
 
virtual bool isReady ()=0
 
virtual void execute ()=0
 
virtual void load ()=0
 
virtual void loaded ()=0
 
virtual void connected ()=0
 
virtual void initService ()=0
 
virtual void connectService ()=0
 
virtual void disconnectService ()=0
 
virtual void getCoupledTasks (std::set< Task * > &coupledSet)=0
 
virtual bool isDeployable () const =0
 
virtual ComponentInstancegetComponent ()=0
 
virtual const ComponentInstancegetComponent () const =0
 
virtual ContainergetContainer ()=0
 
virtual YACS::StatesForNode getState () const =0
 
virtual void finished ()=0
 
virtual void aborted ()=0
 
virtual void imposeResource (const std::string &resource_name, const std::string &container_name)
 
virtual bool canAcceptImposedResource ()
 
virtual bool hasImposedResource () const
 
virtual ~Task ()
 

Static Public Attributes

static const char IMPL_NAME [] ="XML"
 
static const char KIND [] ="xmlsh"
 
- Static Public Attributes inherited from YACS::ENGINE::ServiceNode
static const char KIND [] =""
 
- Static Public Attributes inherited from YACS::ENGINE::Node
static std::map< int, Node * > idMap
 

Protected Member Functions

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

Protected Attributes

std::string _script
 
- Protected Attributes inherited from YACS::ENGINE::ServiceNode
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
 
ComplexWeight _weight
 
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
 
Node_eventReceiver =nullptr
 

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...
 
static void checkValidityOfNodeName (const std::string &name)
 
- 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)
 
template<class PORT >
static bool isPortNameAlreadyExist (const std::string &portName, const std::list< PORT * > &setOfPorts)
 
- 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::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Definition at line 29 of file XMLNode.hxx.

Constructor & Destructor Documentation

◆ XmlNode() [1/2]

XmlNode::XmlNode ( const XmlNode other,
ComposedNode father 
)

Definition at line 54 of file XMLNode.cxx.

55 : _script(other._script), ServiceNode(other, father)
56{
58 _ref = other._ref;
59}
std::string _implementation
Definition: Node.hxx:97
ServiceNode(const std::string &name)
Definition: ServiceNode.cxx:55
static const char IMPL_NAME[]
Definition: XMLNode.hxx:46
std::string _script
Definition: XMLNode.hxx:49

References YACS::ENGINE::Node::_implementation, YACS::ENGINE::ServiceNode::_ref, and IMPL_NAME.

Referenced by simpleClone().

◆ XmlNode() [2/2]

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

Definition at line 61 of file XMLNode.cxx.

62 : ServiceNode(name)
63{
65}

References YACS::ENGINE::Node::_implementation, and IMPL_NAME.

Member Function Documentation

◆ createNode()

virtual ServiceNode * YACS::ENGINE::XmlNode::createNode ( const std::string &  name)
inlinevirtual

Implements YACS::ENGINE::ServiceNode.

Definition at line 42 of file XMLNode.hxx.

43 { throw Exception("not implemented"); }

◆ execute()

void XmlNode::execute ( )
virtual

Implements YACS::ENGINE::Task.

Definition at line 93 of file XMLNode.cxx.

94{
95 DEBTRACE("execute");
96 char dir[]="yacsXXXXXX";
97 // add a lock around mkdtemp (seems not thread safe)
98 {
100#ifdef WIN32
101#ifdef UNICODE
102wchar_t mdir[512 + 1];
103#else
104 char mdir[512 + 1];
105#endif
106 GetTempPath(MAX_PATH+1, mdir);
107 CreateDirectory(mdir, NULL);
108#else
109 char* mdir=mkdtemp(dir);
110#endif
111 if(mdir==NULL)
112 {
113 perror("mkdtemp failed");
114 std::cerr << "Problem in mkdtemp " << dir << " " << mdir << std::endl;
115 throw Exception("Execution problem in mkdtemp");
116 }
117 }
118 std::string sdir(dir);
119 std::string input=sdir+"/input";
120 std::ofstream f(input.c_str());
121 f<<"<methodCall> <methodName>" << _method << "</methodName> <params>"<<std::endl;
122 DEBTRACE("---------------XmlNode::inputs---------------");
123 list<InputPort *>::iterator iter;
124 for(iter = _setOfInputPort.begin(); iter != _setOfInputPort.end(); iter++)
125 {
126 InputXmlPort *p=(InputXmlPort *)*iter;
127 DEBTRACE("port name: " << p->getName());
128 DEBTRACE("port kind: " << p->edGetType()->kind());
129 const char* ob=p->getXml();
130 DEBTRACE("Xml: " << ob );
131 f<<"<param>" << ob << "</param>"<<std::endl;
132 }
133 f<<"</params>"<<std::endl;
134 f<<"</methodCall>"<<std::endl;
135 f.close();
136 DEBTRACE("--------------XmlNode::calculation---------------" << _ref );
137 std::string call=sdir+"/run.sh";
138 std::ofstream run(call.c_str());
139 run << "#!/bin/sh" << std::endl;
140 run << "cd " << sdir << std::endl;
141 if(_ref[0]=='/' || _ref[0]=='~')
142 run << _ref << "> stdout 2>&1 " << std::endl;
143 else
144 run << "../"<<_ref << "> stdout 2>&1 " << std::endl;
145 //run << "cat stdout" << std::endl;
146 run.close();
147 chmod(call.c_str(),00777);
148
149 std::string call2="/bin/sh "+call;
150 int ret=system(call2.c_str());
151 if(ret)
152 {
153 std::cerr << "Problem: " << ret << std::endl;
154 DEBTRACE("Problem: " << ret);
155 throw Exception("Execution problem");
156 }
157 std::string output=sdir+"/output";
158 xmlDocPtr doc;
159 doc = xmlReadFile(output.c_str(), NULL, 0);
160 if (doc == NULL)
161 {
162 DEBTRACE("Failed to parse " << output);
163 throw Exception("Execution problem");
164 }
165 xmlNodePtr cur;
166 cur = xmlDocGetRootElement(doc);
167 if (cur == NULL)
168 {
169 DEBTRACE("empty document " );
170 xmlFreeDoc(doc);
171 throw Exception("Execution problem");
172 }
173 if (xmlStrcmp(cur->name, (const xmlChar *) "methodResponse"))
174 {
175 DEBTRACE("document of the wrong type, root node != methodResponse");
176 xmlFreeDoc(doc);
177 throw Exception("Execution problem");
178 }
179 cur = cur->xmlChildrenNode;
180 xmlBufferPtr buf=xmlBufferCreate();
181 list<OutputPort *>::iterator iter2;
182 iter2 = _setOfOutputPort.begin();
184 p=(OutputXmlPort *)*iter2;
185 int nres=0;
186
187 while (cur != NULL)
188 {
189 if ((!xmlStrcmp(cur->name, (const xmlChar *)"fault")))
190 {
191 DEBTRACE("exception in shell" );
192 xmlFreeDoc(doc);
193 throw Exception("Execution problem");
194 }
195 if ((!xmlStrcmp(cur->name, (const xmlChar *)"params")))
196 {
197 xmlNodePtr cur0 = cur->xmlChildrenNode;
198 while (cur0 != NULL)
199 {
200 if ((!xmlStrcmp(cur0->name, (const xmlChar *)"param")))
201 {
202 xmlNodePtr cur1 = cur0->xmlChildrenNode;
203 while (cur1 != NULL)
204 {
205 if ((!xmlStrcmp(cur1->name, (const xmlChar *)"value")))
206 {
207 xmlNodePtr cur2=cur1->xmlChildrenNode;
208 while (cur2 != NULL)
209 {
210 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"int")))
211 {
212 //got an int
214 {
215 //mismatch
216 xmlBufferFree(buf);
217 xmlFreeDoc(doc);
218 throw Exception("Execution problem:mismatch in output numbers");
219 }
220 xmlBufferEmpty(buf);
221 xmlNodeDump(buf,doc,cur1,0,0);
222 DEBTRACE(xmlBufferContent(buf));
223 p->put(xmlBufferContent(buf));
224 }
225 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"double")))
226 {
227 //got an double
229 {
230 //mismatch
231 xmlBufferFree(buf);
232 xmlFreeDoc(doc);
233 throw Exception("Execution problem:mismatch in output numbers");
234 }
235 xmlBufferEmpty(buf);
236 xmlNodeDump(buf,doc,cur1,0,0);
237 DEBTRACE(xmlBufferContent(buf));
238 p->put(xmlBufferContent(buf));
239 }
240 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"string")))
241 {
242 //got an string
244 {
245 //mismatch
246 xmlBufferFree(buf);
247 xmlFreeDoc(doc);
248 throw Exception("Execution problem:mismatch in output port numbers");
249 }
250 xmlBufferEmpty(buf);
251 xmlNodeDump(buf,doc,cur1,0,0);
252 DEBTRACE(xmlBufferContent(buf));
253 p->put(xmlBufferContent(buf));
254 }
255 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"boolean")))
256 {
257 //got an boolean
259 {
260 //mismatch
261 xmlBufferFree(buf);
262 xmlFreeDoc(doc);
263 throw Exception("Execution problem:mismatch in output port numbers");
264 }
265 xmlBufferEmpty(buf);
266 xmlNodeDump(buf,doc,cur1,0,0);
267 DEBTRACE(xmlBufferContent(buf));
268 p->put(xmlBufferContent(buf));
269 }
270 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"objref")))
271 {
272 //got an objref
274 {
275 //mismatch
276 xmlBufferFree(buf);
277 xmlFreeDoc(doc);
278 throw Exception("Execution problem:mismatch in output port numbers");
279 }
280 xmlBufferEmpty(buf);
281 xmlNodeDump(buf,doc,cur1,0,0);
282 DEBTRACE(xmlBufferContent(buf));
283 p->put(xmlBufferContent(buf));
284 }
285 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"struct")))
286 {
287 //got an struct
289 {
290 //mismatch
291 xmlBufferFree(buf);
292 xmlFreeDoc(doc);
293 throw Exception("Execution problem:mismatch in output port numbers");
294 }
295 xmlBufferEmpty(buf);
296 xmlNodeDump(buf,doc,cur1,0,0);
297 DEBTRACE(xmlBufferContent(buf));
298 p->put(xmlBufferContent(buf));
299 }
300 if ((!xmlStrcmp(cur2->name, (const xmlChar *)"array")))
301 {
302 //got a tuple of results or only one result (but a list)
304 {
305 //It's a one result list
306 xmlBufferEmpty(buf);
307 xmlNodeDump(buf,doc,cur1,0,0);
308 DEBTRACE(xmlBufferContent(buf));
309 p->put(xmlBufferContent(buf));
310 }
311 else
312 {
313 //It's a list of results
314 xmlNodePtr cur3=cur2->xmlChildrenNode;
315 while (cur3 != NULL)
316 {
317 if ((!xmlStrcmp(cur3->name, (const xmlChar *)"data")))
318 {
319 xmlNodePtr cur4=cur3->xmlChildrenNode;
320 while (cur4 != NULL)
321 {
322 if ((!xmlStrcmp(cur4->name, (const xmlChar *)"value")))
323 {
324 nres++;
325 if(nres > getNumberOfOutputPorts())
326 {
327 //mismatch
328 xmlBufferFree(buf);
329 xmlFreeDoc(doc);
330 throw Exception("Execution problem:mismatch in output port numbers");
331 }
332 xmlBufferEmpty(buf);
333 xmlNodeDump(buf,doc,cur4,0,0);
334 DEBTRACE(xmlBufferContent(buf));
335 p=(OutputXmlPort *)*iter2;
336 p->put(xmlBufferContent(buf));
337 iter2++;
338 }
339 cur4 = cur4->next;
340 } // end while value
341 break;
342 }
343 cur3 = cur3->next;
344 } // end while data
345 }
346 break;
347 }
348 cur2 = cur2->next;
349 } // end while array
350 break;
351 }
352 cur1 = cur1->next;
353 } // end while value
354 }
355 cur0 = cur0->next;
356 }// end while param
357 }
358 cur = cur->next;
359 }
360 xmlBufferFree(buf);
361 xmlFreeDoc(doc);
362}
static YACS::BASES::Mutex MUTEX
Definition: XMLNode.cxx:52
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::string getName() const
std::list< InputPort * > _setOfInputPort
std::list< OutputPort * > _setOfOutputPort
Class for XML Input Ports.
Definition: XMLPorts.hxx:38
Class for XML Output Ports.
Definition: XMLPorts.hxx:68
Proc * p
Definition: driver.cxx:216
static char doc[]
Definition: driver.cxx:63
void * run(void *obj)
Definition: yacs_clt.cxx:54

References YACS::ENGINE::ServiceNode::_method, YACS::ENGINE::ServiceNode::_ref, YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, DEBTRACE, doc, gui.CONNECTOR::f(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::ElementaryNode::getNumberOfOutputPorts(), MUTEX, p, and run().

◆ getKind()

std::string XmlNode::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 from YACS::ENGINE::ServiceNode.

Definition at line 88 of file XMLNode.cxx.

89{
90 return KIND;
91}
static const char KIND[]
Definition: XMLNode.hxx:47

References KIND.

◆ getScript()

std::string XmlNode::getScript ( ) const
virtual

Definition at line 83 of file XMLNode.cxx.

84{
85 return _script;
86}

References _script.

◆ load()

virtual void YACS::ENGINE::XmlNode::load ( )
inlinevirtual

DISTRIBUTION NOT YET implemented for XMLNode.

Reimplemented from YACS::ENGINE::ServiceNode.

Definition at line 38 of file XMLNode.hxx.

38{ }

◆ setRef()

void XmlNode::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 from YACS::ENGINE::ServiceNode.

Definition at line 72 of file XMLNode.cxx.

73{
74 //No component instance here
75 _ref=ref;
76}
def ref(target, callback=None)
Definition: CONNECTOR.py:120

References YACS::ENGINE::ServiceNode::_ref, and gui.CONNECTOR::ref().

◆ setScript()

void XmlNode::setScript ( const std::string &  script)
virtual

Definition at line 78 of file XMLNode.cxx.

79{
80 _script=script;
81}

References _script.

◆ simpleClone()

Node * XmlNode::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Implements YACS::ENGINE::Node.

Definition at line 67 of file XMLNode.cxx.

68{
69 return new XmlNode(*this,father);
70}
XmlNode(const XmlNode &other, ComposedNode *father)
Definition: XMLNode.cxx:54

References XmlNode().

Member Data Documentation

◆ _script

std::string YACS::ENGINE::XmlNode::_script
protected

Definition at line 49 of file XMLNode.hxx.

Referenced by getScript(), and setScript().

◆ IMPL_NAME

◆ KIND

const char XmlNode::KIND ="xmlsh"
static

Definition at line 47 of file XMLNode.hxx.

Referenced by YACS::ENGINE::RuntimeSALOME::createRefNode(), and getKind().


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