Salome HOME
7df1f3adb03fcaadbc5118d09b91ff0dea134069
[samples/component.git] / src / SyrComponent / SyrComponent_Impl.hxx
1 //  Copyright (C) 2007-2008  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.
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 //  SuperVisionTest SyrComponent : example of component performing some mathinatical operations
23 //  File   : SyrComponent_Impl.hxx
24 //  Author : Jean Rahuel, CEA
25 //  Module : SuperVisionTest
26 //  $Header:
27 //
28 #ifndef _SYRCOMPONENT_IMPL_HXX_
29 #define _SYRCOMPONENT_IMPL_HXX_
30
31 //#include <iostream.h>
32 #include <SALOMEconfig.h>
33 #include CORBA_SERVER_HEADER(SyrComponent)
34 #include CORBA_SERVER_HEADER(SALOME_Component)
35 #include "SALOME_Component_i.hxx"
36
37 class SyrComponent_Impl :  public POA_SuperVisionTest::SyrComponent ,
38                            public Engines_Component_i {
39 public:
40   SyrComponent_Impl() ;
41   SyrComponent_Impl( CORBA::ORB_ptr orb ,
42                      PortableServer::POA_ptr poa ,
43                      PortableServer::ObjectId * contId , 
44                      const char *instanceName ,
45                      const char *interfaceName ,
46                      const bool kactivate = true ) ;
47
48   virtual ~SyrComponent_Impl();
49
50   virtual CORBA::Long C_ISEVEN( CORBA::Long anInteger ) ;
51
52   virtual CORBA::Long C_ISONE( CORBA::Long anOddInteger ) ;
53
54   virtual CORBA::Long C_M3( CORBA::Long anOddInteger ) ;
55
56   virtual CORBA::Long C_M3P1( CORBA::Long anOddInteger ) ;
57
58   virtual CORBA::Long C_DIV2( CORBA::Long anEvenInteger ) ;
59
60   virtual CORBA::Long C_INCR( CORBA::Long aCount ) ;
61
62   virtual void CPP_SETLONG( CORBA::Long aLong ) ;
63
64   virtual CORBA::Long CPP_ADDTOLONG( CORBA::Long anIncr ) ;
65
66   virtual CORBA::Long C_MIN( CORBA::Long aMinVal , CORBA::Long anInteger ) ;
67
68   virtual CORBA::Long C_MAX( CORBA::Long aMaxVal , CORBA::Long anInteger ) ;
69
70   virtual SuperVisionTest::ListOfSyr_ptr C_LISTOFSYR() ;
71
72   virtual SuperVisionTest::ListOfSyr_ptr C_AVERAGE(
73                        SuperVisionTest::ListOfSyr_ptr aListOfSyr ,
74                        CORBA::Long anInteger ,
75                        CORBA::Long aCount ,
76                        CORBA::Double & anAverage ) ;
77
78   virtual SuperVisionTest::Syr_ptr Init( CORBA::Long anOddInteger ) ;
79
80 private:
81
82   long _Count ;
83 };
84
85 class ListOfSyr_Impl :  public POA_SuperVisionTest::ListOfSyr ,
86                         public Engines_Component_i {
87 public:
88   ListOfSyr_Impl( CORBA::ORB_ptr orb ,
89                   PortableServer::POA_ptr poa ,
90                   PortableServer::ObjectId * contId , 
91                   const char *instanceName ,
92                   const char *interfaceName , 
93                   const char * graphName ,
94                   const char * nodeName ) ;
95   ListOfSyr_Impl() ;
96   virtual ~ListOfSyr_Impl();
97
98   virtual SuperVisionTest::SeqOfSyr * GetSeqOfSyr() ;
99
100   virtual void SetSeqOfSyr( const SuperVisionTest::SeqOfSyr & ) ;
101
102 private:
103   SuperVisionTest::SeqOfSyr _SeqOfSyr ;
104
105 };
106
107 extern "C"
108   PortableServer::ObjectId * SyrComponentEngine_factory
109                                    ( CORBA::ORB_ptr orb ,
110                                      PortableServer::POA_ptr poa , 
111                                      PortableServer::ObjectId * contId ,
112                                      const char *instanceName ,
113                                      const char *interfaceName ) ;
114
115 class Syr_Impl :  public POA_SuperVisionTest::Syr ,
116                   public SyrComponent_Impl {
117 public:
118   Syr_Impl() ;
119   Syr_Impl( CORBA::ORB_ptr orb ,
120             PortableServer::POA_ptr poa ,
121             PortableServer::ObjectId * contId , 
122             const char *instanceName ,
123             const char *interfaceName , 
124             const char * graphName ,
125             const char * nodeName ,
126             const CORBA::Long anOddInteger );
127
128   virtual ~Syr_Impl();
129
130   virtual CORBA::Long Initial() ;
131
132   virtual CORBA::Long Current() ;
133
134   virtual CORBA::Long IsEven() ;
135
136   virtual CORBA::Long IsOne() ;
137
138   virtual CORBA::Long Count() ;
139
140   virtual void M3p1() ;
141
142   virtual void Div2() ;
143
144   virtual void Incr() ;
145
146 private:
147
148   long _InitialInteger ;
149   long _CurrentInteger ;
150   long _Count ;
151
152 };
153
154 #endif