]> SALOME platform Git repositories - modules/yacs.git/blob - src/runtime/CORBAPorts.hxx
Salome HOME
d36f089f818f78051ac71f2abd608d270b1c4c11
[modules/yacs.git] / src / runtime / CORBAPorts.hxx
1 // Copyright (C) 2006-2019  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, 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 #ifndef _CORBAPORTS_HXX_
21 #define _CORBAPORTS_HXX_
22
23 #include <omniORB4/CORBA.h>
24
25 #include "YACSRuntimeSALOMEExport.hxx"
26 #include "InputPort.hxx"
27 #include "OutputPort.hxx"
28 #include "Mutex.hxx"
29
30 #include <Python.h>
31
32 #include <string>
33
34 namespace YACS
35 {
36   namespace ENGINE
37   {
38 /*! \brief Class for CORBA Input Ports
39  *
40  * \ingroup Ports
41  *
42  * \see CORBANode
43  */
44     class YACSRUNTIMESALOME_EXPORT InputCorbaPort : public InputPort
45     {
46     public:
47       InputCorbaPort(const std::string& name, Node *node, TypeCode * type);
48       InputCorbaPort(const InputCorbaPort& other, Node *newHelder);
49       virtual ~InputCorbaPort();
50       bool edIsManuallyInitialized() const;
51       void edRemoveManInit();
52       virtual void put(const void *data) throw(ConversionException);
53       void put(CORBA::Any *data) throw (ConversionException);
54       InputPort *clone(Node *newHelder) const;
55       void *get() const throw(Exception);
56       virtual bool isEmpty();
57       virtual CORBA::Any * getAny();
58       virtual std::string getAsString();
59       virtual PyObject* getPyObj();
60       virtual void exSaveInit();
61       virtual void exRestoreInit();
62       virtual std::string dump();
63       virtual std::string typeName() {return "YACS__ENGINE__InputCorbaPort";}
64       virtual std::string valToStr();
65       virtual void valFromStr(std::string valstr);
66     protected:
67       CORBA::Any  _data;
68       CORBA::Any *  _initData;
69       CORBA::ORB_ptr _orb;
70     private:
71       YACS::BASES::Mutex _mutex;
72     };
73
74     class OutputCorbaPort;
75
76     YACSRUNTIMESALOME_EXPORT std::ostream & operator<<(std::ostream &os,
77                                                        const YACS::ENGINE::OutputCorbaPort& p);
78
79     class YACSRUNTIMESALOME_EXPORT OutputCorbaPort : public OutputPort
80     {
81       friend std::ostream &operator<< ( std::ostream &os,
82                                         const OutputCorbaPort& p);
83     public:
84       OutputCorbaPort(const std::string& name, Node *node, TypeCode * type);
85       OutputCorbaPort(const OutputCorbaPort& other, Node *newHelder);
86       virtual ~OutputCorbaPort();
87       virtual void put(const void *data) throw(ConversionException);
88       void put(CORBA::Any *data) throw (ConversionException);
89       OutputPort *clone(Node *newHelder) const;
90       virtual CORBA::Any * getAny();
91       virtual CORBA::Any * getAnyOut();
92       virtual std::string getAsString();
93       virtual PyObject* getPyObj();
94       virtual std::string dump();
95       virtual std::string typeName() {return "YACS__ENGINE__OutputCorbaPort";}
96       virtual std::string valToStr();
97       virtual void valFromStr(std::string valstr);
98     protected:
99       CORBA::Any  _data;
100       CORBA::ORB_ptr _orb;
101     private:
102       YACS::BASES::Mutex _mutex;
103     };
104
105
106   }
107 }
108
109 #endif