Version: 8.3.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) throw (Exception)
 
void closeFileDump ()
 
virtual void visitBloc (Bloc *node)
 
virtual void visitElementaryNode (ElementaryNode *node)
 
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
 

Detailed Description

Definition at line 31 of file VisitorSalomeSaveState.hxx.

Constructor & Destructor Documentation

VisitorSalomeSaveState::VisitorSalomeSaveState ( ComposedNode root)

Definition at line 31 of file VisitorSalomeSaveState.cxx.

32 :VisitorSaveState(root)
33 {
34 }
VisitorSalomeSaveState::~VisitorSalomeSaveState ( )
virtual

Definition at line 36 of file VisitorSalomeSaveState.cxx.

37 {
38 }

Member Function Documentation

void VisitorSalomeSaveState::visitForEachLoop ( ForEachLoop node)
virtual

Reimplemented from YACS::ENGINE::VisitorSaveState.

Definition at line 40 of file VisitorSalomeSaveState.cxx.

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::ForEachLoop::getLocalInputPorts(), YACS::ENGINE::ComposedNode::getName(), YACS::ENGINE::ForEachLoopPassedData::getOutputNames(), YACS::ENGINE::ForEachLoopPassedData::getOutputs(), YACS::ENGINE::ForEachLoop::getProcessedData(), YACS::ENGINE::Node::getState(), CORBAEngineTest::i, YACS::INTERNALERR, YACS::LOADED, YACS::PAUSE, CORBAEngineTest::state, YACS::SUSPENDED, YACS::TORECONNECT, and YACS::Exception::what().

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 ||
72  YACS::ACTIVATED == state ||
73  YACS::SUSPENDED == state ||
74  YACS::EXECFAILED == state ||
75  YACS::PAUSE == state ||
76  YACS::TORECONNECT == state ||
77  YACS::INTERNALERR == 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 }

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