Salome HOME
Copyright update 2021
[samples/component.git] / src / SyrComponent / SyrComponent_Impl.hxx
1 // Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  SuperVisionTest SyrComponent : example of component performing some mathinatical operations
24 //  File   : SyrComponent_Impl.hxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SuperVisionTest
27 //  $Header:
28 //
29 #ifndef _SYRCOMPONENT_IMPL_HXX_
30 #define _SYRCOMPONENT_IMPL_HXX_
31
32 #ifdef WIN32
33 # if defined SYRCOMPONENTENGINE_EXPORTS || defined SyrComponentEngine_EXPORTS                                                   
34 #  define SYRCOMPONENTENGINE_EXPORT __declspec( dllexport )
35 # else
36 #  define SYRCOMPONENTENGINE_EXPORT __declspec( dllimport )
37 # endif
38 #else
39 # define SYRCOMPONENTENGINE_EXPORT
40 #endif
41
42 //#include <iostream.h>
43 #include <SALOMEconfig.h>
44 #include CORBA_SERVER_HEADER(SyrComponent)
45 #include CORBA_SERVER_HEADER(SALOME_Component)
46 #include "SALOME_Component_i.hxx"
47
48 class SYRCOMPONENTENGINE_EXPORT SyrComponent_Impl : public POA_SuperVisionTest::SyrComponent,
49                                                       public Engines_Component_i {
50 public:
51   SyrComponent_Impl() ;
52   SyrComponent_Impl( CORBA::ORB_ptr orb ,
53                      PortableServer::POA_ptr poa ,
54                      PortableServer::ObjectId * contId , 
55                      const char *instanceName ,
56                      const char *interfaceName ,
57                      const bool kactivate = true ) ;
58
59   virtual ~SyrComponent_Impl();
60
61   virtual char* getVersion();
62
63   virtual CORBA::Long C_ISEVEN( CORBA::Long anInteger ) ;
64
65   virtual CORBA::Long C_ISONE( CORBA::Long anOddInteger ) ;
66
67   virtual CORBA::Long C_M3( CORBA::Long anOddInteger ) ;
68
69   virtual CORBA::Long C_M3P1( CORBA::Long anOddInteger ) ;
70
71   virtual CORBA::Long C_DIV2( CORBA::Long anEvenInteger ) ;
72
73   virtual CORBA::Long C_INCR( CORBA::Long aCount ) ;
74
75   virtual void CPP_SETLONG( CORBA::Long aLong ) ;
76
77   virtual CORBA::Long CPP_ADDTOLONG( CORBA::Long anIncr ) ;
78
79   virtual CORBA::Long C_MIN( CORBA::Long aMinVal , CORBA::Long anInteger ) ;
80
81   virtual CORBA::Long C_MAX( CORBA::Long aMaxVal , CORBA::Long anInteger ) ;
82
83   virtual SuperVisionTest::ListOfSyr_ptr C_LISTOFSYR() ;
84
85   virtual SuperVisionTest::ListOfSyr_ptr C_AVERAGE(
86                        SuperVisionTest::ListOfSyr_ptr aListOfSyr ,
87                        CORBA::Long anInteger ,
88                        CORBA::Long aCount ,
89                        CORBA::Double & anAverage ) ;
90
91   virtual SuperVisionTest::Syr_ptr Init( CORBA::Long anOddInteger ) ;
92
93 private:
94
95   long _Count ;
96 };
97
98 class SYRCOMPONENTENGINE_EXPORT ListOfSyr_Impl :  public POA_SuperVisionTest::ListOfSyr ,
99                                                    public Engines_Component_i {
100 public:
101   ListOfSyr_Impl( CORBA::ORB_ptr orb ,
102                   PortableServer::POA_ptr poa ,
103                   PortableServer::ObjectId * contId , 
104                   const char *instanceName ,
105                   const char *interfaceName , 
106                   const char * graphName ,
107                   const char * nodeName ) ;
108   ListOfSyr_Impl() ;
109   virtual ~ListOfSyr_Impl();
110
111   virtual char* getVersion();
112
113   virtual SuperVisionTest::SeqOfSyr * GetSeqOfSyr() ;
114
115   virtual void SetSeqOfSyr( const SuperVisionTest::SeqOfSyr & ) ;
116
117 private:
118   SuperVisionTest::SeqOfSyr _SeqOfSyr ;
119
120 };
121
122 extern "C"
123   SYRCOMPONENTENGINE_EXPORT
124   PortableServer::ObjectId * SyrComponentEngine_factory
125                                    ( CORBA::ORB_ptr orb ,
126                                      PortableServer::POA_ptr poa , 
127                                      PortableServer::ObjectId * contId ,
128                                      const char *instanceName ,
129                                      const char *interfaceName ) ;
130
131 class SYRCOMPONENTENGINE_EXPORT Syr_Impl :  public POA_SuperVisionTest::SyrComponent ,
132                                              public SyrComponent_Impl {
133 public:
134   Syr_Impl() ;
135   Syr_Impl( CORBA::ORB_ptr orb ,
136             PortableServer::POA_ptr poa ,
137             PortableServer::ObjectId * contId , 
138             const char *instanceName ,
139             const char *interfaceName , 
140             const char * graphName ,
141             const char * nodeName ,
142             const CORBA::Long anOddInteger );
143
144   virtual ~Syr_Impl();
145
146   virtual CORBA::Long Initial() ;
147
148   virtual CORBA::Long Current() ;
149
150   virtual CORBA::Long IsEven() ;
151
152   virtual CORBA::Long IsOne() ;
153
154   virtual CORBA::Long Count() ;
155
156   virtual void M3p1() ;
157
158   virtual void Div2() ;
159
160   virtual void Incr() ;
161
162 private:
163
164   long _InitialInteger ;
165   long _CurrentInteger ;
166   long _Count ;
167
168 };
169
170 #endif