Version: 9.16.0
XMLPorts.cxx
Go to the documentation of this file.
1// Copyright (C) 2006-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#include "XMLPorts.hxx"
21
22#include <iostream>
23
24//#define _DEVDEBUG_
25#include "YacsTrace.hxx"
26
27using namespace YACS::ENGINE;
28using namespace std;
29
30InputXmlPort::InputXmlPort(const std::string& name, Node * node, TypeCode * type)
31 : InputPort(name, node, type), DataPort(name, node, type), Port(node), _initData(""), _data("")
32{
33}
34
35InputXmlPort::InputXmlPort(const InputXmlPort& other, Node *newHelder):InputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),_initData(other._initData),_data(other._data)
36{
37}
38
40{
41 return _initData != "";
42}
43
45{
46 _initData="";
48}
49
50const char *InputXmlPort::getXml() const
51{
53 return _data.c_str();
54}
55
56void *InputXmlPort::get() const
57{
58 return (void *) _data.c_str();
59}
60
61void InputXmlPort::put(const void *data)
62{
63 DEBTRACE("put(void *)");
64 put((const char*)data);
65}
66
67void InputXmlPort::put(const char *data)
68{
69 DEBTRACE(data);
70 _data = data;
71}
72
74{//nothing because _data has no ref counter
75}
76
78{
79 return _data.empty();
80}
81
83{
84 return new InputXmlPort(*this,newHelder);
85}
86
88
92{
94}
95
97
101{
102 if(_initData!="")return;
104}
105
107{
108 return _data;
109}
110
112{
113 return _data;
114}
115
116void InputXmlPort::valFromStr(std::string valstr)
117{
118 _data = valstr;
119}
120
121
122OutputXmlPort::OutputXmlPort(const std::string& name, Node* node, TypeCode * type)
123 : OutputPort(name, node, type), DataPort(name, node, type), Port(node)
124{
125}
126
127OutputXmlPort::OutputXmlPort(const OutputXmlPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),
128 Port(other,newHelder),_data(other._data)
129{
130}
131
132const char * OutputXmlPort::get() const
133{
134 return _data.c_str();
135}
136
137void OutputXmlPort::put(const void *data)
138{
139 put((const char*)data);
140}
141
142void OutputXmlPort::put(const char *data)
143{
144 DEBTRACE(data);
145 InputPort *p;
146 _data=data;
147 OutputPort::put(data);
148}
149
151{
152 return new OutputXmlPort(*this,newHelder);
153}
154
156{
157 return _data;
158}
159
161{
162 return _data;
163}
164
165void OutputXmlPort::valFromStr(std::string valstr)
166{
167 _data = valstr;
168}
169
#define DEBTRACE(msg)
Definition: YacsTrace.hxx:31
Base class for Input Ports.
Definition: InputPort.hxx:44
virtual void edRemoveManInit()
Removes eventually previous manual initialisation.
Definition: InputPort.cxx:140
Class for XML Input Ports.
Definition: XMLPorts.hxx:38
virtual void valFromStr(std::string valstr)
Allows to set data from a string representation used in user interface.
Definition: XMLPorts.cxx:116
void releaseData() override
Definition: XMLPorts.cxx:73
virtual void exRestoreInit()
Restore the saved data value to current data value.
Definition: XMLPorts.cxx:100
virtual std::string dump()
Definition: XMLPorts.cxx:106
void edRemoveManInit()
Removes eventually previous manual initialisation.
Definition: XMLPorts.cxx:44
InputPort * clone(Node *newHelder) const
Definition: XMLPorts.cxx:82
bool edIsManuallyInitialized() const
Specifies if this port has been manually set by the call of InputPort::edInit.
Definition: XMLPorts.cxx:39
virtual void exSaveInit()
Save the current data value for further reinitialization of the port.
Definition: XMLPorts.cxx:91
virtual std::string valToStr()
Gives a string representation of the data, for user interfaces.
Definition: XMLPorts.cxx:111
InputXmlPort(const std::string &name, Node *node, TypeCode *type)
Definition: XMLPorts.cxx:30
virtual const char * getXml() const
Definition: XMLPorts.cxx:50
virtual void put(const void *data)
Definition: XMLPorts.cxx:61
Base class for all nodes.
Definition: Node.hxx:70
virtual void put(const void *data)
Definition: OutputPort.cxx:66
Class for XML Output Ports.
Definition: XMLPorts.hxx:68
virtual void put(const void *data)
Definition: XMLPorts.cxx:137
virtual std::string valToStr()
Gives a string representation of the data, for user interfaces.
Definition: XMLPorts.cxx:160
virtual std::string dump()
Definition: XMLPorts.cxx:155
OutputPort * clone(Node *newHelder) const
Definition: XMLPorts.cxx:150
virtual const char * get() const
Definition: XMLPorts.cxx:132
OutputXmlPort(const std::string &name, Node *node, TypeCode *type)
Definition: XMLPorts.cxx:122
virtual void valFromStr(std::string valstr)
Allows to set data from a string representation used in user interface.
Definition: XMLPorts.cxx:165
Base class for all ports.
Definition: Port.hxx:43
Base class for all type objects.
Definition: TypeCode.hxx:68
Proc * p
Definition: driver.cxx:216