Version: 8.3.0
YACS::ENGINE::OutputStudyPort Class Reference

Class for Study output Ports. More...

#include <StudyPorts.hxx>

Inheritance diagram for YACS::ENGINE::OutputStudyPort:
Collaboration diagram for YACS::ENGINE::OutputStudyPort:

Public Member Functions

 OutputStudyPort (const std::string &name, Node *node, TypeCode *type)
 
 OutputStudyPort (const OutputStudyPort &other, Node *newHelder)
 
OutputPortclone (Node *newHelder) const
 
void setData (const std::string &data)
 
std::string getData ()
 
virtual void putIOR (const std::string &ior)
 
virtual std::string dump ()
 
virtual std::string getPyObj ()
 
virtual std::string getAsString ()
 returns port value as a string that can be used in a GUI for example More...
 
virtual std::string typeName ()
 
virtual void getDataFromStudy (SALOMEDS::Study_var myStudy)
 
- Public Member Functions inherited from YACS::ENGINE::OutputXmlPort
 OutputXmlPort (const std::string &name, Node *node, TypeCode *type)
 
 OutputXmlPort (const OutputXmlPort &other, Node *newHelder)
 
virtual void put (const void *data) throw (ConversionException)
 
void put (const char *data) throw (ConversionException)
 
virtual const char * get () const throw (ConversionException)
 
OutputPortclone (Node *newHelder) const
 
virtual std::string valToStr ()
 Gives a string representation of the data, for user interfaces. More...
 
virtual void valFromStr (std::string valstr)
 Allows to set data from a string representation used in user interface. More...
 
- Public Member Functions inherited from YACS::ENGINE::OutputPort
virtual ~OutputPort ()
 
std::set< InPort * > edSetInPort () const
 
bool isAlreadyLinkedWith (InPort *withp) const
 
bool isAlreadyInSet (InputPort *inputPort) const
 
bool isConnected () const
 
std::string getNameOfTypeOfCurrentInstance () const
 
int removeInPort (InPort *inPort, bool forward) throw (Exception)
 
virtual bool edAddInputPort (InputPort *phyPort) throw (Exception)
 
virtual bool edAddInPropertyPort (InPropertyPort *phyPort) throw (Exception)
 
virtual int edRemoveInputPort (InputPort *inputPort, bool forward) throw (Exception)
 
bool addInPort (InPort *inPort) throw (Exception)
 
void edRemoveAllLinksLinkedWithMe () throw (Exception)
 
virtual void exInit ()
 
virtual void checkBasicConsistency () const throw (Exception)
 Check validity of output port. Nothing on base class. More...
 
- Public Member Functions inherited from YACS::ENGINE::DataFlowPort
TypeOfChannel getTypeOfChannel () const
 returns type of channel the port will use for data exchange on runtime : DATAFLOW or DATASTREAM. More...
 
virtual ~DataFlowPort ()
 
- Public Member Functions inherited from YACS::ENGINE::DataPort
TypeCodeedGetType () const
 
void edSetType (TypeCode *type)
 
std::string getName () const
 
void setName (std::string theName)
 
bool isDifferentTypeOf (const DataPort *other) const
 
- Public Member Functions inherited from YACS::ENGINE::Port
virtual ~Port ()
 
NodegetNode () const
 
int getNumId () const
 
void modified ()
 
- Public Member Functions inherited from YACS::ENGINE::OutPort
virtual void checkConsistency (LinkInfo &info) const
 
virtual int edGetNumberOfOutLinks () const
 
virtual void getAllRepresented (std::set< OutPort * > &represented) const
 
virtual ~OutPort ()
 
std::vector< DataPort * > calculateHistoryOfLinkWith (InPort *end)
 

Protected Attributes

std::string _storeData
 
- Protected Attributes inherited from YACS::ENGINE::OutputXmlPort
std::string _data
 
- Protected Attributes inherited from YACS::ENGINE::OutputPort
std::set< InputPort * > _setOfInputPort
 

Additional Inherited Members

- Static Public Member Functions inherited from YACS::ENGINE::DataPort
static DataPortisCrossingType (const std::vector< DataPort * > &historyOfLink)
 
- Static Public Attributes inherited from YACS::ENGINE::OutputPort
static const char NAME [] ="OutputPort"
 
- Protected Member Functions inherited from YACS::ENGINE::OutputPort
 OutputPort (const OutputPort &other, Node *newHelder)
 
 OutputPort (const std::string &name, Node *node, TypeCode *type)
 
const std::set< InputPort * > & getSetOfPhyLinks () const
 Returns physical links linked to this. Contrary to edSetInPort that returns semantic links. More...
 
- Static Protected Attributes inherited from YACS::ENGINE::Port
static int _total = 0
 
static const char NAME [] ="Port"
 

Detailed Description

Class for Study output Ports.

See Also
StudyInNode

Definition at line 32 of file StudyPorts.hxx.

Constructor & Destructor Documentation

YACS::ENGINE::OutputStudyPort::OutputStudyPort ( const std::string &  name,
Node node,
TypeCode type 
)

Definition at line 51 of file StudyPorts.cxx.

Referenced by clone().

52  : OutputXmlPort(name, node, type),
53  DataPort(name, node, type),
54  Port(node)
55 {
56 }
YACS::ENGINE::OutputStudyPort::OutputStudyPort ( const OutputStudyPort other,
Node newHelder 
)

Definition at line 58 of file StudyPorts.cxx.

59  : OutputXmlPort(other,newHelder),
60  DataPort(other,newHelder),
61  Port(other,newHelder),_storeData(other._storeData)
62 {
63 }

Member Function Documentation

OutputPort * YACS::ENGINE::OutputStudyPort::clone ( Node newHelder) const
virtual

Implements YACS::ENGINE::OutputPort.

Definition at line 65 of file StudyPorts.cxx.

References OutputStudyPort().

66 {
67  return new OutputStudyPort(*this,newHelder);
68 }
std::string YACS::ENGINE::OutputStudyPort::dump ( )
virtual

Reimplemented from YACS::ENGINE::OutputXmlPort.

Definition at line 121 of file StudyPorts.cxx.

References YACS::ENGINE::OutputXmlPort::_data, _storeData, and DEBTRACE.

122 {
123  DEBTRACE( "OutputStudyPort::dump " << _storeData );
124  DEBTRACE( "OutputStudyPort::dump " << _data );
125  //return "<value><string>"+_storeData+"</string></value>";
126  return _data;
127 }
std::string YACS::ENGINE::OutputStudyPort::getAsString ( )
virtual

returns port value as a string that can be used in a GUI for example

Do nothing here. To subclass

Reimplemented from YACS::ENGINE::DataPort.

Definition at line 133 of file StudyPorts.cxx.

References getData().

Referenced by YACS::HMI::CommandSetOutPortValue::localExecute(), and YACS::HMI::CommandSetOutPortValue::localReverse().

134 {
135  return getData();
136 }
std::string YACS::ENGINE::OutputStudyPort::getData ( )
void YACS::ENGINE::OutputStudyPort::getDataFromStudy ( SALOMEDS::Study_var  myStudy)
virtual

Definition at line 138 of file StudyPorts.cxx.

References DEBTRACE, YACS::ENGINE::Double, YACS::ENGINE::DataPort::edGetType(), getData(), YACS::ENGINE::Int, YACS::ENGINE::Objref, YACS::ENGINE::OutputXmlPort::put(), and putIOR().

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

139 {
140  std::string data = getData();
141  DEBTRACE("data: " << data );
142  //try an id
143  SALOMEDS::SObject_var aSO = myStudy->FindObjectID(data.c_str());
144  if(CORBA::is_nil(aSO))
145  {
146  //try a path
147  aSO=myStudy->FindObjectByPath(data.c_str());
148  if(CORBA::is_nil(aSO))
149  {
150  std::stringstream msg;
151  msg << "Execution problem: no id or path: " << data << " in study " << myStudy->StudyId();
152  throw Exception(msg.str());
153  }
154  }
155 
156  CORBA::String_var path=myStudy->GetObjectPath(aSO);
157  DEBTRACE(path);
158  CORBA::String_var id=aSO->GetID();
159  DEBTRACE(id);
160  //CORBA::Object_var sobj=aSO->GetObject();
161 
162  SALOMEDS::GenericAttribute_var aGAttr;
163  CORBA::String_var value;
164 
165  if(edGetType()->kind()==Objref)
166  {
167  if ( aSO->FindAttribute( aGAttr, "AttributeIOR" ) )
168  {
169  SALOMEDS::AttributeIOR_var anAttr = SALOMEDS::AttributeIOR::_narrow( aGAttr );
170  value=anAttr->Value();
171  putIOR((const char*)value);
172  }
173  else
174  {
175  //Problem !!!
176  std::string error="Execution problem: no AttributeIOR in study object: ";
177  error=error+data;
178  throw Exception(error);
179  }
180  }
181  else if(edGetType()->kind()==Double )
182  {
183  if ( aSO->FindAttribute( aGAttr, "AttributeReal" ) )
184  {
185  SALOMEDS::AttributeReal_var anAttr = SALOMEDS::AttributeReal::_narrow( aGAttr );
186  CORBA::Double d=anAttr->Value();
187  std::stringstream msg;
188  msg << "<value><double>" << std::setprecision(16) << d << "</double></value>";
189  put(msg.str().c_str());
190  }
191  else
192  {
193  std::string error="Execution problem: no AttributeReal in study object: ";
194  throw Exception(error+data);
195  }
196  }
197  else if(edGetType()->kind()== Int)
198  {
199  if ( aSO->FindAttribute( aGAttr, "AttributeInteger" ) )
200  {
201  SALOMEDS::AttributeInteger_var anAttr = SALOMEDS::AttributeInteger::_narrow( aGAttr );
202  CORBA::Long l=anAttr->Value();
203  std::stringstream msg;
204  msg << "<value><int>" << l << "</int></value>";
205  put(msg.str().c_str());
206  }
207  else
208  {
209  std::string error="Execution problem: no AttributeInteger in study object: ";
210  throw Exception(error+data);
211  }
212  }
213  else
214  {
215  if ( aSO->FindAttribute( aGAttr, "AttributeComment" ) )
216  {
217  SALOMEDS::AttributeComment_var anAttr = SALOMEDS::AttributeComment::_narrow( aGAttr );
218  value=anAttr->Value();
219  DEBTRACE(value);
220  putIOR((const char*)value);
221  }
222  else
223  {
224  std::string error="Execution problem: no AttributeComment in study object: ";
225  throw Exception(error+data);
226  }
227  }
228 }
std::string YACS::ENGINE::OutputStudyPort::getPyObj ( )
virtual

Definition at line 129 of file StudyPorts.cxx.

References getData().

130 {
131  return getData();
132 }
void YACS::ENGINE::OutputStudyPort::putIOR ( const std::string &  ior)
virtual

Definition at line 83 of file StudyPorts.cxx.

References YACS::ENGINE::Array, YACS::ENGINE::Bool, DEBTRACE, YACS::ENGINE::Double, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::Int, YACS::ENGINE::TypeCode::kind(), YACS::ENGINE::Objref, YACS::ENGINE::OutputXmlPort::put(), YACS::ENGINE::Sequence, YACS::ENGINE::String, and YACS::ENGINE::Struct.

Referenced by getDataFromStudy().

84 {
85  DEBTRACE("OutputStudyPort::putIOR " << ior);
86  if(ior.substr(0,7) == "<value>")
87  {
88  put(ior.c_str());
89  }
90  else
91  {
92  int tk=edGetType()->kind();
93  std::string value;
94  switch(tk)
95  {
96  case Double:
97  value="<value><double>"+ior+"</double></value>";
98  break;
99  case Int:
100  value="<value><int>"+ior+"</int></value>";
101  break;
102  case String:
103  value="<value><string>"+ior+"</string></value>";
104  break;
105  case Bool:
106  value="<value><boolean>"+ior+"</boolean></value>";
107  break;
108  case Objref:
109  value="<value><objref>"+ior+"</objref></value>";
110  break;
111  case Sequence:
112  case Array:
113  case Struct:
114  default:
115  break;
116  }
117  put(value.c_str());
118  }
119 }
void YACS::ENGINE::OutputStudyPort::setData ( const std::string &  data)

Definition at line 70 of file StudyPorts.cxx.

References _storeData, DEBTRACE, and YACS::ENGINE::Port::modified().

Referenced by YACS::ENGINE::StudyInNode::setData().

71 {
72  _storeData = data;
73  DEBTRACE( "OutputStudyPort::setData " << _storeData );
74  modified();
75 }
virtual std::string YACS::ENGINE::OutputStudyPort::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::OutputPort.

Definition at line 44 of file StudyPorts.hxx.

44 {return "YACS__ENGINE__OutputStudyPort";}

Member Data Documentation

std::string YACS::ENGINE::OutputStudyPort::_storeData
protected

Definition at line 47 of file StudyPorts.hxx.

Referenced by dump(), getData(), and setData().


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