Version: 8.3.0
SALOMEDS_StudyManager_i.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 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 // File : SALOMEDS_StudyManager_i.hxx
24 // Author : Sergey RUIN
25 // Module : SALOME
26 //
27 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
28 #define __SALOMEDS_STUDYMANAGER_I_H__
29 
30 // std C++ headers
31 #include <iostream>
32 
33 #ifndef WIN32
34 #include <unistd.h>
35 #endif
36 
37 // IDL headers
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SALOMEDS)
40 
41 // Naming Service header
42 #include "SALOME_NamingService.hxx"
43 
44 #include <stdlib.h>
45 
46 #include "SALOMEDS_Driver_i.hxx"
48 
49 namespace SALOMEDS{
50 
51  // To convert CORBA::Object to PortableServer::ServantBase
52  PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
53 
54 }
55 
56 class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager
57 {
58 private:
59 
60  CORBA::ORB_var _orb;
61  PortableServer::POA_var _poa;
65 
66 public:
67 
69  SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA);
70 
72  virtual ~SALOMEDS_StudyManager_i();
73 
75 
78  void register_name(const char * name);
79 
81 
85  virtual SALOMEDS::Study_ptr NewStudy(const char* study_name) throw (SALOME::SALOME_Exception);
86 
88 
92  virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
93 
94 
96 
99  virtual void Close( SALOMEDS::Study_ptr aStudy);
100 
102 
105  virtual CORBA::Boolean Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
106 
107  virtual CORBA::Boolean SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
108 
110 
114  virtual CORBA::Boolean SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
115  virtual CORBA::Boolean SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
116 
118 
121  virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
122 
124 
128  virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
129 
131 
135  virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
136 
137  virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
138  virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
139  virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
140  virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
141 
142  virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
143  virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };
144 
145  void ping(){};
146  CORBA::Long getPID();
147  void ShutdownWithExit();
148 
149  virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
150 
151  static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
152 
153  void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
154 };
155 
156 #endif