Back to index

salome-gui  6.5.0
SalomeApp_Engine_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 //  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
00024 //  File   : SalomeApp_Engine_i.hxx
00025 //  Author : Alexander SLADKOV
00026 
00027 #ifndef _SALOMEAPP_ENGINE_I_HXX_
00028 #define _SALOMEAPP_ENGINE_I_HXX_
00029 
00030 #include "SALOME_Session.hxx"
00031 
00032 #include "SALOME_Component_i.hxx"
00033 
00034 #include <vector> 
00035 #include <map> 
00036 
00037 #include <SALOMEconfig.h>
00038 #include CORBA_SERVER_HEADER(SalomeApp_Engine)
00039 
00040 class SALOME_NamingService;
00041 
00042 class SESSION_EXPORT SalomeApp_Engine_i: public POA_SalomeApp::Engine,
00043                                     public Engines_Component_i
00044 {
00045 public:
00046   SalomeApp_Engine_i( const char* theComponentName );
00047   ~SalomeApp_Engine_i();
00048 
00049   SALOMEDS::TMPFile*      Save( SALOMEDS::SComponent_ptr theComponent, 
00050                                const char* theURL, 
00051                                bool isMultiFile );
00052 
00053   CORBA::Boolean          Load( SALOMEDS::SComponent_ptr theComponent, 
00054                                const SALOMEDS::TMPFile& theFile, 
00055                                const char* theURL, 
00056                                bool isMultiFile );
00057 
00058   virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
00059                                        CORBA::Boolean isPublished,
00060                                        CORBA::Boolean isMultiFile,
00061                                        CORBA::Boolean& isValidScript);
00062 
00063 public:
00064   typedef std::vector<std::string> ListOfFiles;
00065 
00066   ListOfFiles             GetListOfFiles (const int          theStudyId);
00067   void                    SetListOfFiles (const ListOfFiles& theListOfFiles,
00068                                           const int          theStudyId);
00069 
00070   static std::string         EngineIORForComponent( const char* theComponentName,
00071                                               bool toCreate );
00072   static SalomeApp_Engine_i* GetInstance          ( const char* theComponentName,
00073                                               bool toCreate ); 
00074 
00075 public:
00076   // methods from SALOMEDS::Driver without implementation.  Must be redefined because 
00077   // there is no default implementation of SALOMEDS::Driver interface
00078   SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr, const char*, bool )                                                                        {return 0;}
00079   CORBA::Boolean LoadASCII( SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile&, const char*, bool )                                                  {return 0;}
00080   void Close( SALOMEDS::SComponent_ptr )                                                                                                             {}
00081   char* ComponentDataType();
00082   char* IORToLocalPersistentID( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
00083   char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
00084   bool CanPublishInStudy( CORBA::Object_ptr )                                                                                                        {return 0;}
00085   SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr, CORBA::Object_ptr, const char* ) throw (SALOME::SALOME_Exception) {return 0;}
00086   CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr )                                                                                                    {return 0;}
00087   SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr, CORBA::Long& )                                                                                 {return 0;}
00088   CORBA::Boolean CanPaste( const char*, CORBA::Long )                                                                                                {return 0;}
00089   SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile&, CORBA::Long, SALOMEDS::SObject_ptr )                                                    {return 0;}
00090 
00091 private:
00092   static CORBA::ORB_var              orb();
00093   static PortableServer::POA_var     poa();
00094   static SALOME_NamingService*       namingService();
00095   static CORBA::Object_ptr           engineForComponent( const char* theComponentName,
00096                                                   bool toCreate  );
00097 
00098 private:
00099   typedef std::map<int, ListOfFiles> MapOfListOfFiles;
00100   MapOfListOfFiles                   myMap;
00101 
00102   std::string                        myComponentName;
00103 };
00104 
00105 #endif
00106