Salome HOME
Issue 0020194: EDF 977 ALL: Get rid of warnings PACKAGE_VERSION already defined
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyManager_i.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 //  File   : SALOMEDS_StudyManager_i.hxx
23 //  Author : Sergey RUIN
24 //  Module : SALOME
25 //
26 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
27 #define __SALOMEDS_STUDYMANAGER_I_H__
28
29 // std C++ headers
30 #include <iostream>
31
32 #ifndef WIN32
33 #include <unistd.h>
34 #endif
35
36 // IDL headers
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SALOMEDS)
39
40 // Naming Service header
41 #include "SALOME_NamingService.hxx"
42
43 #include <stdlib.h>
44
45 #include "SALOMEDS_Driver_i.hxx"
46 #include "SALOMEDSImpl_StudyManager.hxx"
47
48 namespace SALOMEDS{
49
50   // To convert CORBA::Object to  PortableServer::ServantBase
51   PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
52
53 }    
54
55 class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager
56 {
57 private:
58
59   CORBA::ORB_var                    _orb;
60   PortableServer::POA_var           _poa;
61   SALOMEDSImpl_StudyManager*        _impl;  
62   SALOME_NamingService*             _name_service;
63   SALOMEDS_DriverFactory_i*         _factory; 
64
65 public:
66
67   //! standard constructor
68   SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA);
69
70   //! standard destructor
71   virtual  ~SALOMEDS_StudyManager_i(); 
72
73  //! method to Register study Manager in the naming service
74   /*!
75     \param char* arguments, the context to register the study manager in the NS
76   */  
77   void register_name(const char * name);
78   
79  //! method to Create a New Study of name study_name
80   /*!
81     \param char* arguments, the new study name
82     \return Study_ptr arguments
83   */  
84   virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
85
86   //! method to Open a Study from it's persistent reference
87   /*!
88     \param char* arguments, the study URL
89     \return Study_ptr arguments
90   */ 
91   virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
92
93
94   //! method to close a Study 
95   /*!
96     \param Study_ptr arguments
97   */ 
98   virtual void Close( SALOMEDS::Study_ptr aStudy);
99
100   //! method to save a Study 
101   /*!
102     \param Study_ptr arguments
103   */
104   virtual CORBA::Boolean Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
105
106   virtual CORBA::Boolean SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
107
108   //! method to save a Study to the persistent reference aUrl
109   /*!
110     \param char* arguments, the new URL of the study
111     \param Study_ptr arguments
112   */
113   virtual CORBA::Boolean SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
114   virtual CORBA::Boolean SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
115
116  //! method to Get name list of open studies in the session
117   /*!
118     \return ListOfOpenStudies* arguments
119   */
120   virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
121
122   //! method to get a Study from it's name
123   /*!
124     \param char* arguments, the study name
125     \return Study_ptr arguments
126   */ 
127   virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
128
129   //! method to get a Study from it's ID
130   /*!
131     \param char* arguments, the study ID
132     \return Study_ptr arguments
133   */ 
134   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
135   
136   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
137   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
138   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
139   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
140
141   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
142   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };  
143   
144   void ping(){};
145   CORBA::Long getPID();
146   void ShutdownWithExit();
147
148   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
149
150   static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
151
152   void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
153 };
154
155 #endif