1 // Copyright (C) 2006-2008 CEA/DEN, EDF R&D
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.
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
19 #include "XMLPorts.hxx"
24 #include "YacsTrace.hxx"
26 using namespace YACS::ENGINE;
29 InputXmlPort::InputXmlPort(const std::string& name, Node * node, TypeCode * type)
30 : InputPort(name, node, type), DataPort(name, node, type), Port(node), _initData(""), _data("")
34 InputXmlPort::InputXmlPort(const InputXmlPort& other, Node *newHelder):InputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder),_initData(other._initData),_data(other._data)
38 bool InputXmlPort::edIsManuallyInitialized() const
40 return _initData != "";
43 void InputXmlPort::edRemoveManInit()
46 InputPort::edRemoveManInit();
49 const char *InputXmlPort::getXml() const
55 void *InputXmlPort::get() const throw(Exception)
57 return (void *) _data.c_str();
60 void InputXmlPort::put(const void *data) throw (ConversionException)
62 DEBTRACE("put(void *)");
63 put((const char*)data);
66 void InputXmlPort::put(const char *data) throw (ConversionException)
72 bool InputXmlPort::isEmpty()
77 InputPort *InputXmlPort::clone(Node *newHelder) const
79 return new InputXmlPort(*this,newHelder);
82 //! Save the current data value for further reinitialization of the port
86 void InputXmlPort::exSaveInit()
91 //! Restore the saved data value to current data value
93 * If no data has been saved (_initData == 0) don't restore
95 void InputXmlPort::exRestoreInit()
97 if(_initData!="")return;
101 std::string InputXmlPort::dump()
106 std::string InputXmlPort::valToStr()
111 void InputXmlPort::valFromStr(std::string valstr)
117 OutputXmlPort::OutputXmlPort(const std::string& name, Node* node, TypeCode * type)
118 : OutputPort(name, node, type), DataPort(name, node, type), Port(node)
122 OutputXmlPort::OutputXmlPort(const OutputXmlPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),Port(other,newHelder)
126 const char * OutputXmlPort::get() const throw (ConversionException)
128 return _data.c_str();
131 void OutputXmlPort::put(const void *data) throw (ConversionException)
133 put((const char*)data);
136 void OutputXmlPort::put(const char *data) throw (ConversionException)
141 OutputPort::put(data);
144 OutputPort *OutputXmlPort::clone(Node *newHelder) const
146 return new OutputXmlPort(*this,newHelder);
149 std::string OutputXmlPort::dump()
154 std::string OutputXmlPort::valToStr()
159 void OutputXmlPort::valFromStr(std::string valstr)