Version: 9.15.0
YACS::ENGINE::VisitorSalomeSaveState Class Reference

#include <VisitorSalomeSaveState.hxx>

Inheritance diagram for YACS::ENGINE::VisitorSalomeSaveState:
Collaboration diagram for YACS::ENGINE::VisitorSalomeSaveState:

Public Member Functions

 VisitorSalomeSaveState (ComposedNode *root)
 
virtual ~VisitorSalomeSaveState ()
 
virtual void visitForEachLoop (ForEachLoop *node)
 
- Public Member Functions inherited from YACS::ENGINE::VisitorSaveState
 VisitorSaveState (ComposedNode *root)
 
virtual ~VisitorSaveState ()
 
void openFileDump (const std::string &xmlDump)
 
void closeFileDump ()
 
virtual void visitBloc (Bloc *node)
 
virtual void visitElementaryNode (ElementaryNode *node)
 
void visitForEachLoopDyn (ForEachLoopDyn *node) override
 
virtual void visitOptimizerLoop (OptimizerLoop *node)
 
virtual void visitDynParaLoop (DynParaLoop *node)
 
virtual void visitForLoop (ForLoop *node)
 
virtual void visitInlineNode (InlineNode *node)
 
virtual void visitInlineFuncNode (InlineFuncNode *node)
 
virtual void visitLoop (Loop *node)
 
virtual void visitProc (Proc *node)
 
virtual void visitServiceNode (ServiceNode *node)
 
virtual void visitServerNode (ServerNode *node)
 
virtual void visitServiceInlineNode (ServiceInlineNode *node)
 
virtual void visitSwitch (Switch *node)
 
virtual void visitWhileLoop (WhileLoop *node)
 
virtual void visitPresetNode (DataNode *node)
 
virtual void visitOutNode (DataNode *node)
 
virtual void visitStudyInNode (DataNode *node)
 
virtual void visitStudyOutNode (DataNode *node)
 
- Public Member Functions inherited from YACS::ENGINE::Visitor
 Visitor (ComposedNode *root)
 

Additional Inherited Members

- Protected Member Functions inherited from YACS::ENGINE::Visitor
std::map< std::string, std::string > getNodeProperties (Node *node)
 
std::map< std::string, TypeCode * > getTypeCodeMap (Proc *proc)
 
std::map< std::string, Container * > getContainerMap (Proc *proc)
 
std::list< TypeCodeObjref * > getListOfBases (TypeCodeObjref *objref)
 
- Protected Attributes inherited from YACS::ENGINE::VisitorSaveState
std::ofstream _out
 
std::map< int, std::string > _nodeStateName
 
- Protected Attributes inherited from YACS::ENGINE::Visitor
ComposedNode_root
 

Detailed Description

Definition at line 31 of file VisitorSalomeSaveState.hxx.

Constructor & Destructor Documentation

◆ VisitorSalomeSaveState()

VisitorSalomeSaveState::VisitorSalomeSaveState ( ComposedNode root)

Definition at line 31 of file VisitorSalomeSaveState.cxx.

32 :VisitorSaveState(root)
33 {
34 }
VisitorSaveState(ComposedNode *root)

◆ ~VisitorSalomeSaveState()

VisitorSalomeSaveState::~VisitorSalomeSaveState ( )
virtual

Definition at line 36 of file VisitorSalomeSaveState.cxx.

37 {
38 }

Member Function Documentation

◆ visitForEachLoop()

void VisitorSalomeSaveState::visitForEachLoop ( ForEachLoop node)
virtual

Reimplemented from YACS::ENGINE::VisitorSaveState.

Definition at line 40 of file VisitorSalomeSaveState.cxx.

41 {
42  node->ComposedNode::accept(this);
43  if (!_out) throw Exception("No file open for dump state");
44  std::string name = _root->getName();
45  if (static_cast<ComposedNode*>(node) != _root) name = _root->getChildName(node);
46  DEBTRACE("VisitorSaveState::visitForEachLoop ------ " << name);
47  _out << " <node type='forEachLoop'>" << std::endl;
48  _out << " <name>" << name << "</name>" << std::endl;
49  _out << " <state>" << _nodeStateName[node->getState()] << "</state>" << std::endl;
50 // VisitorSaveState::visitForEachLoop(node);
51  std::list<InputPort *> setOfInputPort = node->getLocalInputPorts();
52  std::list<InputPort *>::iterator iter;
53  for(iter = setOfInputPort.begin(); iter != setOfInputPort.end(); iter++)
54  {
55  _out << " <inputPort>" << std::endl;
56  _out << " <name>" << (*iter)->getName() << "</name>" << std::endl;
57  try
58  {
59  _out << " ";
60  _out << (*iter)->dump();
61  }
62  catch (YACS::Exception &e)
63  {
64  DEBTRACE("caught YACS:Exception: " << e.what());
65  _out << "<value><error><![CDATA[" << e.what() << "]]></error></value>" << std::endl;
66  }
67  _out << " </inputPort>" << std::endl;
68  }
69 
70  StatesForNode state = node->getState();
71  if(YACS::LOADED == state ||
75  YACS::PAUSE == state ||
78  YACS::FAILED == state ||
79  YACS::ERROR == state)
80  {
81  ForEachLoopPassedData* processedData = node->getProcessedData();
82  if(processedData)
83  {
84  const std::vector<unsigned int>& processedIndexes = processedData->getIds();
85  std::vector<SequenceAny *>::const_iterator it_outputs;
86  std::vector<std::string>::const_iterator it_names;
87 
88  for(it_outputs = processedData->getOutputs().begin(), it_names = processedData->getOutputNames().begin();
89  it_names != processedData->getOutputNames().end();
90  it_outputs++, it_names++)
91  {
92  _out << " <loopOutputPort>" << std::endl;
93  _out << " <name>" << (*it_names) << "</name>" << std::endl;
94  for(unsigned int i = 0; i < (*it_outputs)->size(); i++)
95  {
96  AnyPtr value = (*(*it_outputs))[i];
97  _out << " <sample><index>" << processedIndexes[i]<< "</index>";
98  if(value)
99  _out << convertNeutralXml(value->getType(), value);
100  else
101  _out << "<value>None</value>";
102  _out << " </sample>" << std::endl;
103  }
104  _out << " </loopOutputPort>" << std::endl;
105  }
106 
107  delete processedData;
108  processedData = NULL;
109  }
110  }
111  _out << " </node>" << std::endl;
112 }
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
: Allow to manage memory of instances of T. The only constraint on T is to have method incrRef and De...
Definition: SharedPtr.hxx:30
Base class for all composed nodes.
std::string getChildName(const Node *node) const
std::string getName() const
std::list< InputPort * > getLocalInputPorts() const
redefined on derived class of ComposedNode. by default a ComposedNode has no port by itself
ForEachLoopPassedData * getProcessedData() const
const std::vector< unsigned int > & getIds() const
const std::vector< std::string > & getOutputNames() const
const std::vector< SequenceAny * > & getOutputs() const
virtual YACS::StatesForNode getState() const
Definition: Node.hxx:118
std::map< int, std::string > _nodeStateName
ComposedNode * _root
Definition: Visitor.hxx:85
const char * what(void) const noexcept
Definition: Exception.cxx:50
std::string convertNeutralXml(const TypeCode *t, YACS::ENGINE::Any *data)
StatesForNode
Definition: define.hxx:34
@ FAILED
Definition: define.hxx:51
@ EXECFAILED
Definition: define.hxx:46
@ LOADED
Definition: define.hxx:39
@ ACTIVATED
Definition: define.hxx:41
@ INTERNALERR
Definition: define.hxx:49
@ SUSPENDED
Definition: define.hxx:44
@ PAUSE
Definition: define.hxx:47
@ TORECONNECT
Definition: define.hxx:48
@ ERROR
Definition: define.hxx:52

References YACS::ENGINE::VisitorSaveState::_nodeStateName, YACS::ENGINE::VisitorSaveState::_out, YACS::ENGINE::Visitor::_root, YACS::ACTIVATED, YACS::ENGINE::convertNeutralXml(), DEBTRACE, YACS::ERROR, YACS::EXECFAILED, YACS::FAILED, YACS::ENGINE::ComposedNode::getChildName(), YACS::ENGINE::ForEachLoopPassedData::getIds(), YACS::ENGINE::ForEachLoopGen::getLocalInputPorts(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::ForEachLoopPassedData::getOutputNames(), YACS::ENGINE::ForEachLoopPassedData::getOutputs(), YACS::ENGINE::ForEachLoopGen::getProcessedData(), YACS::ENGINE::Node::getState(), yacsorb.CORBAEngineTest::i, YACS::INTERNALERR, YACS::LOADED, YACS::PAUSE, yacsorb.CORBAEngineTest::state, YACS::SUSPENDED, YACS::TORECONNECT, and YACS::Exception::what().


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