]> SALOME platform Git repositories - modules/yacs.git/blob - src/runtime/CppXMLConv.cxx
Salome HOME
52d4b7ed0298099211a1c5eb1ee061630ccc67a7
[modules/yacs.git] / src / runtime / CppXMLConv.cxx
1 //  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
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.
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 #include "TypeConversions.hxx"
20 #include "CppXMLConv.hxx"
21
22 #include <iostream>
23
24 //#define _DEVDEBUG_
25 #include "YacsTrace.hxx"
26
27 using namespace std;
28
29 namespace YACS 
30 {
31   namespace ENGINE 
32   {
33     std::string convertCppXml(const TypeCode *t, void *ob)
34     {
35       return convertNeutralXml(t, (Any *) ob);
36     }
37
38     CppXml::CppXml(InputXmlPort* p)
39       : ProxyPort(p), DataPort(p->getName(), p->getNode(), p->edGetType()), Port(p->getNode())
40     {
41       DEBTRACE("proxy port from C++ to XML");
42     }
43
44     //!Convert a YACS::ENGINE::Any that is convertible to Xml::char * and send it to proxy port
45     /*!
46      *   \param data : YACS::ENGINE::Any object as a void * pointer
47      */
48
49     void CppXml::put(const void *data) throw(ConversionException)
50     {
51       put((YACS::ENGINE::Any *)data);
52     }
53
54     //!Convert a YACS::ENGINE::Any that is convertible to Xml::char * and send it to proxy port
55     /*!
56      *   \param data : YACS::ENGINE::Any object
57      */
58     void CppXml::put(YACS::ENGINE::Any *data) throw(ConversionException)
59     {
60       DEBTRACE("CppXml::put");
61       std::string s = convertCppXml(edGetType(), data);
62       DEBTRACE(s);
63       DEBTRACE(_port->getName());
64       ((InputXmlPort*)_port)->put(s.c_str());
65       DEBTRACE("End CppXml::put");
66     }
67
68     int isAdaptableXmlCpp(const TypeCode *t1, const TypeCode *t2)
69     {
70       return isAdaptableXmlNeutral(t1, t2);
71     }
72   }
73 }