Version: 9.16.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
 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)
 
void put (const char *data)
 
virtual const char * get () const
 
OutputPortclone (Node *newHelder) const
 
virtual std::string dump ()
 
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)
 
virtual bool edAddInputPort (InputPort *phyPort)
 
virtual bool edAddInPropertyPort (InPropertyPort *phyPort)
 
virtual int edRemoveInputPort (InputPort *inputPort, bool forward)
 
bool addInPort (InPort *inPort)
 
void edRemoveAllLinksLinkedWithMe ()
 
virtual void exInit ()
 
virtual void checkBasicConsistency () const
 Check validity of output port. Nothing on base class. More...
 
virtual OutputPortclone (Node *newHelder) const =0
 
virtual std::string dump ()
 
virtual void put (const void *data)
 
virtual std::string typeName ()
 
- Public Member Functions inherited from YACS::ENGINE::DataFlowPort
std::string getNameOfTypeOfCurrentInstance () const
 
TypeOfChannel getTypeOfChannel () const
 returns type of channel the port will use for data exchange on runtime : DATAFLOW or DATASTREAM. More...
 
virtual ~DataFlowPort ()
 
virtual std::string typeName ()
 
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::DataPort
TypeCodeedGetType () const
 
void edSetType (TypeCode *type)
 
std::string getName () const
 
void setName (std::string theName)
 
std::string getNameOfTypeOfCurrentInstance () const
 
virtual TypeOfChannel getTypeOfChannel () const =0
 returns type of channel the port will use for data exchange on runtime : DATAFLOW or DATASTREAM. More...
 
bool isDifferentTypeOf (const DataPort *other) const
 
virtual void edRemoveAllLinksLinkedWithMe ()=0
 
virtual std::string typeName ()
 
virtual std::string getAsString ()
 returns port value as a string that can be used in a GUI for example More...
 
- Public Member Functions inherited from YACS::ENGINE::Port
virtual ~Port ()
 
NodegetNode () const
 
virtual std::string getNameOfTypeOfCurrentInstance () const
 
int getNumId () const
 
virtual std::string typeName ()
 
void modified ()
 
- Public Member Functions inherited from YACS::ENGINE::OutPort
virtual void checkConsistency (LinkInfo &info) const
 
virtual int edGetNumberOfOutLinks () const
 
virtual std::set< InPort * > edSetInPort () const =0
 
virtual bool isAlreadyLinkedWith (InPort *withp) const =0
 
virtual void getAllRepresented (std::set< OutPort * > &represented) const
 
virtual bool addInPort (InPort *inPort)=0
 
virtual int removeInPort (InPort *inPort, bool forward)=0
 
virtual ~OutPort ()
 
std::vector< DataPort * > calculateHistoryOfLinkWith (InPort *end)
 
virtual std::string typeName ()
 

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
 
- Protected Attributes inherited from YACS::ENGINE::DataPort
TypeCode_type
 
std::string _name
 
- Protected Attributes inherited from YACS::ENGINE::Port
Node_node
 
int _id
 

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"
 
- Static Public Attributes inherited from YACS::ENGINE::DataFlowPort
static const char NAME [] ="DataFlowPort"
 
- Static Public Attributes inherited from YACS::ENGINE::DataPort
static const char NAME [] ="DataPort"
 
- 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...
 
- Protected Member Functions inherited from YACS::ENGINE::DataFlowPort
 DataFlowPort (const DataFlowPort &other, Node *newHelder)
 
 DataFlowPort (const std::string &name, Node *node, TypeCode *type)
 
- Protected Member Functions inherited from YACS::ENGINE::DataPort
virtual ~DataPort ()
 
 DataPort (const DataPort &other, Node *newHelder)
 
 DataPort (const std::string &name, Node *node, TypeCode *type)
 
- Protected Member Functions inherited from YACS::ENGINE::Port
 Port (Node *node)
 
 Port (const Port &other, Node *newHelder)
 
- Protected Member Functions inherited from YACS::ENGINE::OutPort
 OutPort (const OutPort &other, Node *newHelder)
 
 OutPort (const std::string &name, Node *node, TypeCode *type)
 
- 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() [1/2]

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

Definition at line 40 of file PresetPorts.cxx.

41 : OutputXmlPort(name, node, type),
42 DataPort(name, node, type),
43 Port(node)
44{
45}
DataPort(const DataPort &other, Node *newHelder)
Definition: DataPort.cxx:41
OutputXmlPort(const std::string &name, Node *node, TypeCode *type)
Definition: XMLPorts.cxx:122
Port(Node *node)
Definition: Port.cxx:34

Referenced by clone().

◆ OutputPresetPort() [2/2]

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

◆ checkBasicConsistency()

void OutputPresetPort::checkBasicConsistency ( ) const
virtual

Check validity of output port. Nothing on base class.

Reimplemented from YACS::ENGINE::OutputPort.

Definition at line 66 of file PresetPorts.cxx.

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}
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
std::string getName() const
Definition: DataPort.hxx:55

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

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

◆ clone()

OutputPort * OutputPresetPort::clone ( Node newHelder) const
virtual

Implements YACS::ENGINE::OutputPort.

Definition at line 54 of file PresetPorts.cxx.

55{
56 return new OutputPresetPort(*this,newHelder);
57}
OutputPresetPort(const std::string &name, Node *node, TypeCode *type)
Definition: PresetPorts.cxx:40

References OutputPresetPort().

◆ dump()

std::string OutputPresetPort::dump ( )
virtual

Reimplemented from YACS::ENGINE::OutputXmlPort.

Definition at line 119 of file PresetPorts.cxx.

120{
121 return getData();
122}

References getData().

◆ getAsString()

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.

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}
virtual PyObject * getPyObj()
std::string convertPyObjectToString(PyObject *ob)

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

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

◆ getData()

std::string OutputPresetPort::getData ( )

Definition at line 78 of file PresetPorts.cxx.

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}
TypeCode * edGetType() const
Definition: DataPort.hxx:53

References _storeData, YACS::ENGINE::Array, YACS::ENGINE::Bool, DEBTRACE, YACS::ENGINE::Double, YACS::ENGINE::DataPort::edGetType(), YACS::ENGINE::Int, 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().

◆ getPyObj()

PyObject * OutputPresetPort::getPyObj ( )
virtual

Definition at line 124 of file PresetPorts.cxx.

125{
126 DEBTRACE(getData());
127 if(_storeData=="")
128 {
129 Py_INCREF(Py_None);
130 return Py_None;
131 }
132 else
134}
PyObject * convertXmlStrPyObject(const TypeCode *t, std::string data)

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

Referenced by getAsString().

◆ setData()

void OutputPresetPort::setData ( std::string  data)

Definition at line 59 of file PresetPorts.cxx.

60{
61 _storeData = data;
62 DEBTRACE( "OutputPresetPort::setData " << _storeData );
63 modified();
64}
void modified()
Definition: Port.cxx:53

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

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

◆ typeName()

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

◆ _storeData

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: