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