Salome HOME
Make HELLO component appear into "salome sesionless"
[samples/hello.git] / src / HELLO / HELLO.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 #ifndef _HELLO_HXX_
24 #define _HELLO_HXX_
25
26 #ifdef WIN32
27 # if defined HELLOENGINE_EXPORTS || defined HELLOEngine_EXPORTS
28 #  define HELLOENGINE_EXPORT __declspec( dllexport )
29 # else
30 #  define HELLOENGINE_EXPORT __declspec( dllimport )
31 # endif
32 #else
33 # define HELLOENGINE_EXPORT
34 #endif
35
36
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(HELLO_Gen)
39 #include <SALOME_Component_i.hxx>
40
41 class HELLOENGINE_EXPORT HELLO_Abstract :
42   public POA_HELLO_ORB::HELLO_Gen,
43   public Engines_Component_i 
44 {
45 public:
46   HELLO_Abstract( CORBA::ORB_ptr orb,
47          PortableServer::POA_ptr poa,
48          PortableServer::ObjectId* contId, 
49          const char* instanceName, 
50          const char* interfaceName ,
51          bool withRegistry = true);
52   virtual ~HELLO_Abstract();
53
54   HELLO_ORB::status hello  ( const char* name );
55   HELLO_ORB::status goodbye( const char* name );
56   void              copyOrMove( const HELLO_ORB::object_list& what,
57                                 SALOMEDS::SObject_ptr where,
58                                 CORBA::Long row, CORBA::Boolean isCopy );
59   virtual char*     getVersion();
60   // Get Study
61   virtual SALOMEDS::Study_var getStudyServant() = 0;
62 };
63
64 class HELLOENGINE_EXPORT HELLO_Session : public HELLO_Abstract
65 {
66 public:
67   HELLO_Session( CORBA::ORB_ptr orb,
68          PortableServer::POA_ptr poa,
69          PortableServer::ObjectId* contId, 
70          const char* instanceName, 
71          const char* interfaceName):HELLO_Abstract(orb,poa,contId,instanceName,interfaceName,true) { }
72    SALOMEDS::Study_var getStudyServant() override;
73 };
74
75 class HELLOENGINE_EXPORT HELLO_No_Session : public HELLO_Abstract
76 {
77 public:
78   HELLO_No_Session( CORBA::ORB_ptr orb,
79          PortableServer::POA_ptr poa,
80          PortableServer::ObjectId* contId, 
81          const char* instanceName, 
82          const char* interfaceName):HELLO_Abstract(orb,poa,contId,instanceName,interfaceName,false) { }
83   SALOMEDS::Study_var getStudyServant() override;
84 };
85
86 extern "C"
87 HELLOENGINE_EXPORT
88 PortableServer::ObjectId* HELLOEngine_factory( CORBA::ORB_ptr orb,
89                                                PortableServer::POA_ptr poa,
90                                                PortableServer::ObjectId* contId,
91                                                const char* instanceName,
92                                                const char* interfaceName );
93
94 #endif