Version: 8.3.0
YACS::ENGINE::StudyOutNode Class Reference

#include <StudyNodes.hxx>

Inheritance diagram for YACS::ENGINE::StudyOutNode:
Collaboration diagram for YACS::ENGINE::StudyOutNode:

Public Member Functions

 StudyOutNode (const std::string &name)
 
 StudyOutNode (const StudyOutNode &other, ComposedNode *father)
 
virtual void execute ()
 
virtual void accept (Visitor *visitor)
 
virtual void checkBasicConsistency () const throw (Exception)
 
virtual void setData (InputPort *port, const std::string &data)
 
virtual InputPortcreateInputPort (const std::string &inputPortName, TypeCode *type)
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::DataNode
virtual void setData (OutputPort *port, const std::string &data)
 
virtual void setRef (const std::string &ref)
 
virtual std::string getRef ()
 
virtual ~DataNode ()
 
- 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) 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)
 
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 OutputPortcreateOutputPort (const std::string &outputPortName, TypeCode *type)
 
virtual InputDataStreamPortcreateInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type)
 
virtual OutputDataStreamPortcreateOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type)
 
virtual InputPortedAddInputPort (const std::string &inputPortName, TypeCode *type) throw (Exception)
 
virtual OutputPortedAddOutputPort (const std::string &outputPortName, TypeCode *type) throw (Exception)
 
virtual InputDataStreamPortedAddInputDataStreamPort (const std::string &inputPortDSName, TypeCode *type) throw (Exception)
 
virtual OutputDataStreamPortedAddOutputDataStreamPort (const std::string &outputPortDSName, TypeCode *type) throw (Exception)
 
virtual void edOrderInputPorts (const std::list< InputPort * > &ports)
 
virtual void edOrderOutputPorts (const std::list< OutputPort * > &ports)
 
virtual void edUpdateState ()
 update the status of the node More...
 
virtual void ensureLoading ()
 Put this node into TOLOAD state when possible. More...
 
int getMaxLevelOfParallelism () const
 
void begin ()
 
bool isReady ()
 
void finished ()
 
void aborted ()
 
void loaded ()
 Notify this node that it is loaded. More...
 
void connected ()
 Notify this node that it is connected. More...
 
virtual std::string getErrorDetails ()
 Give a description of error when node status is ERROR. More...
 
virtual void initService ()
 
virtual void connectService ()
 
virtual void disconnectService ()
 
virtual void 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 ~Task ()
 

Static Public Attributes

static const char IMPL_NAME [] ="XML"
 

Protected Member Functions

NodesimpleClone (ComposedNode *father, bool editionOnly) const
 
- Protected Member Functions inherited from YACS::ENGINE::DataNode
 DataNode (const DataNode &other, ComposedNode *father)
 
 DataNode (const std::string &name)
 
- 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 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 void exForwardFailed ()
 
virtual void exForwardFinished ()
 

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)
 
- Protected Attributes inherited from YACS::ENGINE::DataNode
std::string _ref
 
- Static Protected Attributes inherited from YACS::ENGINE::Node
static const char SEP_CHAR_IN_PORT [] ="."
 
static int _total = 0
 

Detailed Description

Definition at line 46 of file StudyNodes.hxx.

Constructor & Destructor Documentation

YACS::ENGINE::StudyOutNode::StudyOutNode ( const std::string &  name)

Definition at line 180 of file StudyNodes.cxx.

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

Referenced by simpleClone().

181  : DataNode(name)
182 {
184 }
YACS::ENGINE::StudyOutNode::StudyOutNode ( const StudyOutNode other,
ComposedNode father 
)

Definition at line 186 of file StudyNodes.cxx.

187  : DataNode(other, father)
188 {
189 }

Member Function Documentation

void YACS::ENGINE::StudyOutNode::accept ( Visitor visitor)
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 358 of file StudyNodes.cxx.

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

359 {
360  visitor->visitStudyOutNode(this);
361 }
void YACS::ENGINE::StudyOutNode::checkBasicConsistency ( ) const throw (Exception)
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 319 of file StudyNodes.cxx.

References YACS::ENGINE::ElementaryNode::_setOfInputPort, YACS::ENGINE::ElementaryNode::_setOfOutputPort, YACS::ENGINE::InputPort::checkBasicConsistency(), DEBTRACE, YACS::ENGINE::InputStudyPort::getData(), and YACS::ENGINE::Node::getName().

320 {
321  DEBTRACE("StudyOutNode::checkBasicConsistency");
322  if (! _setOfOutputPort.empty())
323  {
324  std::string what = "StudyNode ";
325  what += getName();
326  what += " only accepts InputStudyPort, no OutputPort";
327  throw Exception(what);
328  }
329 
330  std::list<InputPort *>::const_iterator iter;
331  for(iter=_setOfInputPort.begin();iter!=_setOfInputPort.end();iter++)
332  {
333  InputStudyPort *inp = dynamic_cast<InputStudyPort*>(*iter);
334  if (!inp)
335  {
336  std::string what("Input port: ");
337  what += (*iter)->getName();
338  what += " is not an InputStudyPort. StudyNode ";
339  what += getName();
340  what += " only accepts InputStudyPorts";
341  throw Exception(what);
342  }
343  inp->checkBasicConsistency();
344 
345  std::string data = inp->getData();
346  DEBTRACE(data);
347  if (data.empty())
348  {
349  std::string what("InputStudyPort: ");
350  what += (*iter)->getName();
351  what += " is not initialised";
352  throw Exception(what);
353  }
354  }
355 
356 }
InputPort * YACS::ENGINE::StudyOutNode::createInputPort ( const std::string &  inputPortName,
TypeCode type 
)
virtual

Reimplemented from YACS::ENGINE::ElementaryNode.

Definition at line 196 of file StudyNodes.cxx.

197 {
198  return new InputStudyPort(inputPortName, this, type);
199 }
void YACS::ENGINE::StudyOutNode::execute ( )
virtual

Implements YACS::ENGINE::Task.

Definition at line 242 of file StudyNodes.cxx.

References YACS::ENGINE::Node::_errorDetails, YACS::ENGINE::DataNode::_ref, YACS::ENGINE::ElementaryNode::_setOfInputPort, DEBTRACE, YACS::ENGINE::Node::getProc(), YACS::ENGINE::Node::getProperty(), YACS::ENGINE::getSALOMERuntime(), p, and YACS::ENGINE::InputStudyPort::putDataInStudy().

243 {
244  DEBTRACE("+++++++ StudyOutNode::execute +++++++++++");
245  SALOME_NamingService NS(getSALOMERuntime()->getOrb());
246  CORBA::Object_var obj=NS.Resolve("/myStudyManager");
247  if(CORBA::is_nil(obj))
248  {
249  _errorDetails="Execution problem: no naming service";
250  throw Exception(_errorDetails);
251  }
252 
253  SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow(obj);
254  if(CORBA::is_nil(aStudyManager))
255  {
256  _errorDetails="Execution problem: no naming service";
257  throw Exception(_errorDetails);
258  }
259 
260  int studyid=1;
261  if (getProperty("StudyID") != "")
262  {
263  // StudyId is specified
264  studyid=atoi(getProperty("StudyID").c_str());
265  }
266  else
267  {
268  Proc* p=getProc();
269  if(p)
270  {
271  std::string value=p->getProperty("DefaultStudyID");
272  if(!value.empty())
273  studyid= atoi(value.c_str());
274  }
275  }
276 
277  SALOMEDS::Study_var myStudy =aStudyManager->GetStudyByID(studyid);
278  if(CORBA::is_nil(myStudy))
279  {
280  //open a new one
281  std::stringstream msg;
282  msg << "Study" << studyid;
283  myStudy=aStudyManager->NewStudy(msg.str().c_str());
284  if(CORBA::is_nil(myStudy))
285  {
286  _errorDetails="Execution problem: can not create new study " + msg.str();
287  throw Exception(_errorDetails);
288  }
289  }
290  DEBTRACE(myStudy->StudyId());
291 
292  SALOMEDS::StudyBuilder_var aBuilder =myStudy->NewBuilder() ;
293  if(CORBA::is_nil(aBuilder))
294  {
295  _errorDetails="Execution problem: can not create StudyBuilder";
296  throw Exception(_errorDetails);
297  }
298 
299  SALOMEDS::GenericAttribute_var aGAttr;
300  SALOMEDS::SObject_var aSO ;
301  SALOMEDS::AttributeName_var anAttr ;
302  SALOMEDS::AttributeIOR_var iorAttr ;
303 
304  std::list<InputPort *>::const_iterator iter;
305  for(iter = _setOfInputPort.begin(); iter != _setOfInputPort.end(); iter++)
306  {
307  InputStudyPort *inp = dynamic_cast<InputStudyPort *>(*iter);
308  inp->putDataInStudy(myStudy,aBuilder);
309  }
310 
311  // save in file if ref is given
312  if(_ref != "")
313  {
314  aStudyManager->SaveAs(_ref.c_str(),myStudy, false);
315  }
316  DEBTRACE("+++++++ end StudyOutNode::execute +++++++++++" );
317 }
void YACS::ENGINE::StudyOutNode::setData ( InputPort port,
const std::string &  data 
)
virtual

Reimplemented from YACS::ENGINE::DataNode.

Definition at line 201 of file StudyNodes.cxx.

References YACS::ENGINE::InputStudyPort::setData().

202 {
203  InputStudyPort *inp = dynamic_cast<InputStudyPort *>(port);
204  inp->setData(data);
205 }
Node * YACS::ENGINE::StudyOutNode::simpleClone ( ComposedNode father,
bool  editionOnly 
) const
protectedvirtual

Implements YACS::ENGINE::Node.

Definition at line 191 of file StudyNodes.cxx.

References StudyOutNode().

192 {
193  return new StudyOutNode(*this,father);
194 }
virtual std::string YACS::ENGINE::StudyOutNode::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::DataNode.

Definition at line 58 of file StudyNodes.hxx.

58 {return "YACS__ENGINE__StudyOutNode";}

Member Data Documentation

const char YACS::ENGINE::StudyOutNode::IMPL_NAME ="XML"
static

Definition at line 60 of file StudyNodes.hxx.

Referenced by StudyOutNode().


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