Back to index

salome-paravis  6.5.0
PARAVIS_Gen_i.hh
Go to the documentation of this file.
00001 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 //  File   : PARAVIS_Gen_i.hh
00020 //  Author : Vitaly Smetannikov
00021 //  Module : PARAVIS
00022 //
00023 #ifndef __PARAVIS_GEN_I_H__
00024 #define __PARAVIS_GEN_I_H__
00025 
00026 #include "PV_I.h"
00027 #include "vtkSmartPointer.h"
00028 
00029 #include "SALOMEconfig.h"
00030 #include CORBA_SERVER_HEADER(PARAVIS_Gen)
00031 #include CORBA_SERVER_HEADER(SALOMEDS)
00032 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
00033 
00034 #include "SALOME_NamingService.hxx"
00035 #include "SALOME_LifeCycleCORBA.hxx"
00036 
00037 #include "SALOME_Component_i.hxx"
00038 #include "SALOME_NamingService.hxx"
00039 
00040 #include "vtkSmartPointer.h"
00041 
00042 // QT Includes
00043 #include <QMutex>
00044 
00045 class SalomeApp_Application;
00046 class PVGUI_Module;
00047 class vtkObjectBase;
00048 
00049 #define PVSTATEID 15555
00050 
00051 namespace PARAVIS
00052 {
00053 
00054   const char* checkNullStr(const char* theStr);
00055 
00059   class PARAVIS_Base_i : public virtual POA_PARAVIS::PARAVIS_Base
00060   {
00061   public:
00063     PARAVIS_Base_i() {};
00064 
00066     virtual ~PARAVIS_Base_i();
00067 
00069     virtual void Init(::vtkObjectBase* base);
00070 
00071     virtual ::vtkObjectBase* GetNew() { return NULL; }
00072 
00074     virtual ::vtkObjectBase* getVTKObject() 
00075     { if (mySmartPointer == NULL)
00076         mySmartPointer = GetNew();
00077       return mySmartPointer.GetPointer(); 
00078     }
00079 
00081     static ::vtkObjectBase* getVTKObject(PARAVIS_Base_ptr theBase);
00082 
00084     virtual CORBA::Boolean IsSame(PARAVIS_Base_ptr theOther);
00085 
00086   protected:
00087 
00089     vtkSmartPointer< ::vtkObjectBase> mySmartPointer;
00090   };
00091 
00092   //----------------------------------------------------------------------------
00093   class PARAVIS_Gen_i : public virtual POA_PARAVIS::PARAVIS_Gen,
00094                    public virtual ::Engines_Component_i
00095   {
00097     PARAVIS_Gen_i(const PARAVIS::PARAVIS_Gen_i &);
00098   public:
00099     
00101     PARAVIS_Gen_i(CORBA::ORB_ptr theORB,
00102                   PortableServer::POA_ptr thePOA,
00103                   SALOME_NamingService* theNamingService, 
00104                   QMutex* theMutex);
00105     
00107     virtual ~PARAVIS_Gen_i();
00108     
00110     virtual char* GetIOR();
00111 
00113     virtual void ImportFile(const char* theFileName);
00114 
00116     virtual void ExecuteScript(const char* script);
00117     
00119     virtual char* GetTrace();
00120 
00122     virtual void SaveTrace(const char* theFileName);
00123 
00125     virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
00126                                          CORBA::Boolean theIsPublished,
00127                                     CORBA::Boolean theIsMultiFile,
00128                                          CORBA::Boolean& theIsValidScript);
00129 
00131     virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent, 
00132                                     const char* theURL, bool isMultiFile);
00133     
00135     virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
00136                                          const char* theURL, bool isMultiFile);
00137     
00139     virtual bool Load(SALOMEDS::SComponent_ptr,   const SALOMEDS::TMPFile &,
00140                       const char* theURL, bool isMultiFile);
00141 
00143     virtual bool LoadASCII(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &,
00144                            const char* theURL, bool isMultiFile);
00145     
00147     virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
00148 
00150     virtual char* ComponentDataType();
00151 
00153     virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString,
00154                                          CORBA::Boolean isMultiFile, CORBA::Boolean isASCII);
00155 
00157     virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, const char* aLocalPersistentID,
00158                                          CORBA::Boolean isMultiFile, CORBA::Boolean isASCII);
00159 
00161     virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
00162 
00164     virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
00165                                                  SALOMEDS::SObject_ptr theSObject, 
00166                                                  CORBA::Object_ptr theObject,
00167                                                  const char* theName) throw (SALOME::SALOME_Exception);
00168 
00170     virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
00171 
00173     virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
00174 
00176     virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
00177 
00179     virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
00180                                             CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject);
00181 
00183     virtual PARAVIS::string_array* GetClassesList();
00184 
00186     virtual PARAVIS_Base_ptr CreateClass(const char* theClassName);
00187 
00189     virtual void GetConnectionParameters(CORBA::Long& theId, 
00190                                          CORBA::String_out theDHost, CORBA::Long& theDPort,
00191                                          CORBA::String_out theRHost, CORBA::Long& theRPort,
00192                                          CORBA::Long& theReversed);
00193 
00194 
00196     virtual void ActivateModule();
00197 
00198     virtual void SetCurrentStudy(SALOMEDS::Study_ptr theStudy);
00199 
00200     virtual SALOMEDS::Study_ptr GetCurrentStudy();
00201 
00203     static CORBA::ORB_var GetORB() { return myOrb;}
00204 
00206     static PortableServer::POA_var GetPOA() { return myPoa;}
00207 
00209     static PARAVIS_Gen_i* GetParavisGenImpl() { return myParavisGenImpl;}
00210 
00211   private:
00212     static CORBA::ORB_var          myOrb;
00213     static PortableServer::POA_var myPoa;
00214     static PARAVIS_Gen_i*          myParavisGenImpl;
00215     static SALOME_LifeCycleCORBA*  myEnginesLifeCycle;
00216     static SALOME_NamingService*   myNamingService;
00217     static QMutex*                 myMutex;
00218 
00219     std::string         myIOR;
00220     SALOMEDS::Study_var myStudyDocument;
00221     static SalomeApp_Application* mySalomeApp;
00222 
00223   };
00224 
00225 };
00226 #endif