Salome HOME
A patch from Paul RASCLE for: kernel documentation with doxygen, modification on...
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyManager_i.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : SALOMEDS_StudyManager_i.hxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
25 #define __SALOMEDS_STUDYMANAGER_I_H__
26
27 // std C++ headers
28 #include <iostream>
29
30 #ifndef WNT
31 #include <unistd.h>
32 #endif
33
34 // IDL headers
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SALOMEDS)
37
38 // Naming Service header
39 #include "SALOME_NamingService.hxx"
40
41 #include <stdlib.h>
42
43 #include "SALOMEDS_Driver_i.hxx"
44 #include "SALOMEDSImpl_StudyManager.hxx"
45
46 namespace SALOMEDS{
47
48   // To convert CORBA::Object to  PortableServer::ServantBase
49   PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
50
51 }    
52
53 class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager
54 {
55 private:
56
57   CORBA::ORB_ptr                    _orb;
58   PortableServer::POA_var           _poa;
59   SALOMEDSImpl_StudyManager*        _impl;  
60   SALOME_NamingService*             _name_service;
61   SALOMEDS_DriverFactory_i*         _factory; 
62
63 public:
64
65   //! standard constructor
66   SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA);
67
68   //! standard destructor
69   virtual  ~SALOMEDS_StudyManager_i(); 
70
71  //! method to Register study Manager in the naming service
72   /*!
73     \param char* arguments, the context to register the study manager in the NS
74   */  
75   void register_name(char * name);
76   
77  //! method to Create a New Study of name study_name
78   /*!
79     \param char* arguments, the new study name
80     \return Study_ptr arguments
81   */  
82   virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
83
84   //! method to Open a Study from it's persistent reference
85   /*!
86     \param char* arguments, the study URL
87     \return Study_ptr arguments
88   */ 
89   virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
90
91
92   //! method to close a Study 
93   /*!
94     \param Study_ptr arguments
95   */ 
96   virtual void Close( SALOMEDS::Study_ptr aStudy);
97
98   //! method to save a Study 
99   /*!
100     \param Study_ptr arguments
101   */
102   virtual CORBA::Boolean Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
103
104   virtual CORBA::Boolean SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
105
106   //! method to save a Study to the persistent reference aUrl
107   /*!
108     \param char* arguments, the new URL of the study
109     \param Study_ptr arguments
110   */
111   virtual CORBA::Boolean SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
112   virtual CORBA::Boolean SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
113
114  //! method to Get name list of open studies in the session
115   /*!
116     \return ListOfOpenStudies* arguments
117   */
118   virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
119
120   //! method to get a Study from it's name
121   /*!
122     \param char* arguments, the study name
123     \return Study_ptr arguments
124   */ 
125   virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
126
127   //! method to get a Study from it's ID
128   /*!
129     \param char* arguments, the study ID
130     \return Study_ptr arguments
131   */ 
132   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
133   
134   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
135   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
136   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
137   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
138
139   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
140   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };  
141   
142   void ping(){};
143   CORBA::Long getPID();
144   void ShutdownWithExit();
145
146   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
147
148   static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
149
150   void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
151 };
152
153 #endif