1 // Copyright (C) 2006-2014 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, 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 throw(YACS::Exception)
58 return (void *) _data.c_str();
61 void InputXmlPort::put(const void *data) throw (ConversionException)
63 DEBTRACE("put(void *)");
64 put((const char*)data);
67 void InputXmlPort::put(const char *data) throw (ConversionException)
73 bool InputXmlPort::isEmpty()
78 InputPort *InputXmlPort::clone(Node *newHelder) const
80 return new InputXmlPort(*this,newHelder);
83 //! Save the current data value for further reinitialization of the port
87 void InputXmlPort::exSaveInit()
92 //! Restore the saved data value to current data value
94 * If no data has been saved (_initData == 0) don't restore
96 void InputXmlPort::exRestoreInit()
98 if(_initData!="")return;
102 std::string InputXmlPort::dump()
107 std::string InputXmlPort::valToStr()
112 void InputXmlPort::valFromStr(std::string valstr)
118 OutputXmlPort::OutputXmlPort(const std::string& name, Node* node, TypeCode * type)
119 : OutputPort(name, node, type), DataPort(name, node, type), Port(node)
123 OutputXmlPort::OutputXmlPort(const OutputXmlPort& other, Node *newHelder):OutputPort(other,newHelder),DataPort(other,newHelder),
124 Port(other,newHelder),_data(other._data)
128 const char * OutputXmlPort::get() const throw (ConversionException)
130 return _data.c_str();
133 void OutputXmlPort::put(const void *data) throw (ConversionException)
135 put((const char*)data);
138 void OutputXmlPort::put(const char *data) throw (ConversionException)
143 OutputPort::put(data);
146 OutputPort *OutputXmlPort::clone(Node *newHelder) const
148 return new OutputXmlPort(*this,newHelder);
151 std::string OutputXmlPort::dump()
156 std::string OutputXmlPort::valToStr()
161 void OutputXmlPort::valFromStr(std::string valstr)