Back to index

salome-kernel  6.5.0
SALOMEDS_StudyManager_i.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDS_StudyManager_i.hxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
00028 #define __SALOMEDS_STUDYMANAGER_I_H__
00029 
00030 // std C++ headers
00031 #include <iostream>
00032 
00033 #ifndef WIN32
00034 #include <unistd.h>
00035 #endif
00036 
00037 // IDL headers
00038 #include <SALOMEconfig.h>
00039 #include CORBA_SERVER_HEADER(SALOMEDS)
00040 
00041 // Naming Service header
00042 #include "SALOME_NamingService.hxx"
00043 
00044 #include <stdlib.h>
00045 
00046 #include "SALOMEDS_Driver_i.hxx"
00047 #include "SALOMEDSImpl_StudyManager.hxx"
00048 
00049 namespace SALOMEDS{
00050 
00051   // To convert CORBA::Object to  PortableServer::ServantBase
00052   PortableServer::ServantBase_var GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
00053 
00054 }    
00055 
00056 class Standard_EXPORT SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager
00057 {
00058 private:
00059 
00060   CORBA::ORB_var                    _orb;
00061   PortableServer::POA_var           _poa;
00062   SALOMEDSImpl_StudyManager*        _impl;  
00063   SALOME_NamingService*             _name_service;
00064   SALOMEDS_DriverFactory_i*         _factory; 
00065 
00066 public:
00067 
00069   SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb, PortableServer::POA_ptr thePOA);
00070 
00072   virtual  ~SALOMEDS_StudyManager_i(); 
00073 
00075 
00078   void register_name(const char * name);
00079   
00081 
00085   virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
00086 
00088 
00092   virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
00093 
00094 
00096 
00099   virtual void Close( SALOMEDS::Study_ptr aStudy);
00100 
00102 
00105   virtual CORBA::Boolean Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
00106 
00107   virtual CORBA::Boolean SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
00108 
00110 
00114   virtual CORBA::Boolean SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
00115   virtual CORBA::Boolean SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
00116 
00118 
00121   virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
00122 
00124 
00128   virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
00129 
00131 
00135   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
00136   
00137   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
00138   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
00139   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
00140   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
00141 
00142   virtual char* ConvertObjectToIOR(CORBA::Object_ptr theObject) {return _orb->object_to_string(theObject); }
00143   virtual CORBA::Object_ptr ConvertIORToObject(const char* theIOR) { return _orb->string_to_object(theIOR); };  
00144   
00145   void ping(){};
00146   CORBA::Long getPID();
00147   void ShutdownWithExit();
00148 
00149   virtual CORBA::LongLong GetLocalImpl(const char* theHostname, CORBA::Long thePID, CORBA::Boolean& isLocal);
00150 
00151   static PortableServer::POA_ptr GetPOA(const SALOMEDS::Study_ptr theStudy);
00152 
00153   void Shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); }
00154 };
00155 
00156 #endif