Version: 8.3.0
YACS::ENGINE::OutputPresetPort Class Reference

Class for PRESET output Ports. More...

#include <PresetPorts.hxx>

Inheritance diagram for YACS::ENGINE::OutputPresetPort:
Collaboration diagram for YACS::ENGINE::OutputPresetPort:

Public Member Functions

 OutputPresetPort (const std::string &name, Node *node, TypeCode *type)
 
 OutputPresetPort (const OutputPresetPort &other, Node *newHelder)
 
OutputPortclone (Node *newHelder) const
 
void setData (std::string data)
 
std::string getData ()
 
virtual void checkBasicConsistency () const throw (Exception)
 Check validity of output port. Nothing on base class. More...
 
virtual std::string dump ()
 
virtual std::string getAsString ()
 returns port value as a string that can be used in a GUI for example More...
 
virtual PyObject * getPyObj ()
 
virtual std::string typeName ()
 
- 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 ()
 
- 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 PRESET output Ports.

See Also
PresetNode

Definition at line 32 of file PresetPorts.hxx.

Constructor & Destructor Documentation

OutputPresetPort::OutputPresetPort ( const std::string &  name,
Node node,
TypeCode type 
)

Definition at line 40 of file PresetPorts.cxx.

Referenced by clone().

41  : OutputXmlPort(name, node, type),
42  DataPort(name, node, type),
43  Port(node)
44 {
45 }
OutputPresetPort::OutputPresetPort ( const OutputPresetPort other,
Node newHelder 
)

Definition at line 47 of file PresetPorts.cxx.

48  : OutputXmlPort(other,newHelder),
49  DataPort(other,newHelder),
50  Port(other,newHelder),_storeData(other._storeData)
51 {
52 }

Member Function Documentation

void OutputPresetPort::checkBasicConsistency ( ) const throw (Exception)
virtual

Check validity of output port. Nothing on base class.

Reimplemented from YACS::ENGINE::OutputPort.

Definition at line 66 of file PresetPorts.cxx.

References _storeData, DEBTRACE, and YACS::ENGINE::DataPort::getName().

Referenced by YACS::ENGINE::PresetNode::checkBasicConsistency().

67 {
68  DEBTRACE("OutputPresetPort::checkBasicConsistency " << _storeData);
69  if (_storeData.empty())
70  {
71  std::string what("OutputPresetPort: ");
72  what += getName();
73  what += " is not initialised";
74  throw Exception(what);
75  }
76 }
OutputPort * OutputPresetPort::clone ( Node newHelder) const
virtual

Implements YACS::ENGINE::OutputPort.

Definition at line 54 of file PresetPorts.cxx.

References OutputPresetPort().

55 {
56  return new OutputPresetPort(*this,newHelder);
57 }
std::string OutputPresetPort::dump ( )
virtual

Reimplemented from YACS::ENGINE::OutputXmlPort.

Definition at line 119 of file PresetPorts.cxx.

References getData().

120 {
121  return getData();
122 }
std::string OutputPresetPort::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 136 of file PresetPorts.cxx.

References YACS::ENGINE::convertPyObjectToString(), DEBTRACE, and getPyObj().

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

137 {
139  PyObject* ob=getPyObj();
140  DEBTRACE(PyObject_Str(ob));
141  std::string s=convertPyObjectToString(ob);
142  DEBTRACE(s);
143  Py_DECREF(ob);
144  return s;
145 }
std::string OutputPresetPort::getData ( )

Definition at line 78 of file PresetPorts.cxx.

References _storeData, 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::Sequence, YACS::ENGINE::String, and YACS::ENGINE::Struct.

Referenced by dump(), YACS::ENGINE::PresetNode::execute(), getPyObj(), and YACS::ENGINE::VisitorSaveSalomeSchema::writeDataNodeParameters().

79 {
80  DEBTRACE("OutputPresetPort::getData " << _storeData);
81  if(_storeData.substr(0,7) == "<value>")
82  {
83  return _storeData;
84  }
85  else
86  {
87  std::string value;
88  switch(edGetType()->kind())
89  {
90  case Double:
91  value="<value><double>"+_storeData+"</double></value>";
92  break;
93  case Int:
94  value="<value><int>"+_storeData+"</int></value>";
95  break;
96  case String:
97  value="<value><string>"+_storeData+"</string></value>";
98  break;
99  case Bool:
100  value="<value><boolean>"+_storeData+"</boolean></value>";
101  break;
102  case Objref:
103  value="<value><objref>"+_storeData+"</objref></value>";
104  break;
105  case Sequence:
106  case Array:
107  value="<value><array><data>"+_storeData+"</data></array></value>";
108  break;
109  case Struct:
110  value="<value><struct><data>"+_storeData+"</data></struct></value>";
111  break;
112  default:
113  break;
114  }
115  return value;
116  }
117 }
PyObject * OutputPresetPort::getPyObj ( )
virtual

Definition at line 124 of file PresetPorts.cxx.

References _storeData, YACS::ENGINE::convertXmlStrPyObject(), DEBTRACE, YACS::ENGINE::DataPort::edGetType(), and getData().

Referenced by getAsString().

125 {
126  DEBTRACE(getData());
127  if(_storeData=="")
128  {
129  Py_INCREF(Py_None);
130  return Py_None;
131  }
132  else
134 }
void OutputPresetPort::setData ( std::string  data)

Definition at line 59 of file PresetPorts.cxx.

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

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

60 {
61  _storeData = data;
62  DEBTRACE( "OutputPresetPort::setData " << _storeData );
63  modified();
64 }
virtual std::string YACS::ENGINE::OutputPresetPort::typeName ( )
inlinevirtual

Reimplemented from YACS::ENGINE::OutputPort.

Definition at line 44 of file PresetPorts.hxx.

44 {return "YACS__ENGINE__OutputPresetPort";}

Member Data Documentation

std::string YACS::ENGINE::OutputPresetPort::_storeData
protected

Definition at line 46 of file PresetPorts.hxx.

Referenced by checkBasicConsistency(), getData(), getPyObj(), and setData().


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