1 // Copyright (C) 2006-2024 CEA, EDF
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "XMLPorts.hxx"
25 #include "YacsTrace.hxx"
27 using namespace YACS::ENGINE;
30 InputXmlPort::InputXmlPort(const std::string& name, Node * node, TypeCode * type)
31 : InputPort(name, node, type), DataPort(name, node, type), Port(node), _initData(""), _data("")
35 InputXmlPort::InputXmlPort(const InputXmlPort& other, Node *newHelder):InputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),_initData(other._initData),_data(other._data)
39 bool InputXmlPort::edIsManuallyInitialized() const
41 return _initData != "";
44 void InputXmlPort::edRemoveManInit()
47 InputPort::edRemoveManInit();
50 const char *InputXmlPort::getXml() const
56 void *InputXmlPort::get() const
58 return (void *) _data.c_str();
61 void InputXmlPort::put(const void *data)
63 DEBTRACE("put(void *)");
64 put((const char*)data);
67 void InputXmlPort::put(const char *data)
73 void InputXmlPort::releaseData()
74 {//nothing because _data has no ref counter
77 bool InputXmlPort::isEmpty()
82 InputPort *InputXmlPort::clone(Node *newHelder) const
84 return new InputXmlPort(*this,newHelder);
87 //! Save the current data value for further reinitialization of the port
91 void InputXmlPort::exSaveInit()
96 //! Restore the saved data value to current data value
98 * If no data has been saved (_initData == 0) don't restore
100 void InputXmlPort::exRestoreInit()
102 if(_initData!="")return;
106 std::string InputXmlPort::dump()
111 std::string InputXmlPort::valToStr()
116 void InputXmlPort::valFromStr(std::string valstr)
122 OutputXmlPort::OutputXmlPort(const std::string& name, Node* node, TypeCode * type)
123 : OutputPort(name, node, type), DataPort(name, node, type), Port(node)
127 OutputXmlPort::OutputXmlPort(const OutputXmlPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),
128 Port(other,newHelder),_data(other._data)
132 const char * OutputXmlPort::get() const
134 return _data.c_str();
137 void OutputXmlPort::put(const void *data)
139 put((const char*)data);
142 void OutputXmlPort::put(const char *data)
147 OutputPort::put(data);
150 OutputPort *OutputXmlPort::clone(Node *newHelder) const
152 return new OutputXmlPort(*this,newHelder);
155 std::string OutputXmlPort::dump()
160 std::string OutputXmlPort::valToStr()
165 void OutputXmlPort::valFromStr(std::string valstr)