1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : PARAVIS_Gen_i.hh
23 // Author : Vitaly Smetannikov
26 #ifndef __PARAVIS_GEN_I_H__
27 #define __PARAVIS_GEN_I_H__
30 #include "vtkSmartPointer.h"
32 #include "SALOMEconfig.h"
33 #include CORBA_SERVER_HEADER(PARAVIS_Gen)
34 #include CORBA_SERVER_HEADER(SALOMEDS)
35 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
37 #include "SALOME_NamingService.hxx"
38 #include "SALOME_LifeCycleCORBA.hxx"
40 #include "SALOME_Component_i.hxx"
41 #include "SALOME_NamingService.hxx"
43 #include "vtkSmartPointer.h"
48 class SalomeApp_Application;
56 * Base implementation for all container objects for Paravis serevrmanager API classes
58 class PARAVIS_Base_i : public virtual POA_PARAVIS::PARAVIS_Base
65 virtual ~PARAVIS_Base_i();
67 //! Initialises internal pointer on existing Paraview class instance
68 virtual void Init(::vtkObjectBase* base);
70 //! Returns pointer on internal Paraview class instance
71 virtual ::vtkObjectBase* getVTKObject() { return mySmartPointer.GetPointer(); }
73 //! The same as previous in static context
74 static ::vtkObjectBase* getVTKObject(PARAVIS_Base_ptr theBase);
76 //! Compares two container objects comparing of their internal pointers
77 virtual CORBA::Boolean IsSame(PARAVIS_Base_ptr theOther);
81 //! Pointer on wrapped class
82 vtkSmartPointer< ::vtkObjectBase> mySmartPointer;
85 //----------------------------------------------------------------------------
86 class PARAVIS_Gen_i : public virtual POA_PARAVIS::PARAVIS_Gen,
87 public virtual ::Engines_Component_i
90 PARAVIS_Gen_i(const PARAVIS::PARAVIS_Gen_i &);
94 PARAVIS_Gen_i(CORBA::ORB_ptr theORB,
95 PortableServer::POA_ptr thePOA,
96 SALOME_NamingService* theNamingService,
100 virtual ~PARAVIS_Gen_i();
102 //! Returns CORBA ID for the current instance
103 virtual char* GetIOR();
105 //! Import file to PARAVIS module by its name.
106 virtual void ImportFile(const char* theFileName);
108 //! Returns Trace string. If Trace is not activated then empty string is returned
109 virtual char* GetTrace();
111 //! Save trace sting to a disk file.
112 virtual void SaveTrace(const char* theFileName);
114 //! inherited methods from Engines::Component
115 virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
116 CORBA::Boolean theIsPublished,
117 CORBA::Boolean& theIsValidScript);
119 //! inherited methods from SALOMEDS::Driver
120 virtual SALOMEDS::TMPFile* Save(SALOMEDS::SComponent_ptr theComponent,
121 const char* theURL, bool isMultiFile);
123 //! inherited methods from SALOMEDS::Driver
124 virtual SALOMEDS::TMPFile* SaveASCII(SALOMEDS::SComponent_ptr theComponent,
125 const char* theURL, bool isMultiFile);
127 //! inherited methods from SALOMEDS::Driver
128 virtual bool Load(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &,
129 const char* theURL, bool isMultiFile);
131 //! inherited methods from SALOMEDS::Driver
132 virtual bool LoadASCII(SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile &,
133 const char* theURL, bool isMultiFile);
135 //! inherited methods from SALOMEDS::Driver
136 virtual void Close(SALOMEDS::SComponent_ptr IORSComponent);
138 //! inherited methods from SALOMEDS::Driver
139 virtual char* ComponentDataType();
141 //! inherited methods from SALOMEDS::Driver
142 virtual char* IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, const char* IORString,
143 CORBA::Boolean isMultiFile, CORBA::Boolean isASCII);
145 //! inherited methods from SALOMEDS::Driver
146 virtual char* LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, const char* aLocalPersistentID,
147 CORBA::Boolean isMultiFile, CORBA::Boolean isASCII);
149 //! inherited methods from SALOMEDS::Driver. Alwais returns false for this module
150 virtual bool CanPublishInStudy(CORBA::Object_ptr theIOR);
152 //! inherited methods from SALOMEDS::Driver. Does nothing
153 virtual SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr theStudy,
154 SALOMEDS::SObject_ptr theSObject,
155 CORBA::Object_ptr theObject,
156 const char* theName) throw (SALOME::SALOME_Exception);
158 //! inherited methods from SALOMEDS::Driver. Alwais returns false for this module
159 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
161 //! inherited methods from SALOMEDS::Driver. Does nothing
162 virtual SALOMEDS::TMPFile* CopyFrom(SALOMEDS::SObject_ptr theObject, CORBA::Long& theObjectID);
164 //! inherited methods from SALOMEDS::Driver. Does nothing
165 virtual CORBA::Boolean CanPaste(const char* theComponentName, CORBA::Long theObjectID);
167 //! inherited methods from SALOMEDS::Driver. Does nothing
168 virtual SALOMEDS::SObject_ptr PasteInto(const SALOMEDS::TMPFile& theStream,
169 CORBA::Long theObjectID, SALOMEDS::SObject_ptr theObject);
171 //! Implementation of PARAVIS_Gen interface
172 virtual PARAVIS::string_array* GetClassesList();
174 //! Implementation of PARAVIS_Gen interface
175 virtual PARAVIS_Base_ptr CreateClass(const char* theClassName);
177 //! Implementation of PARAVIS_Gen interface
178 virtual void GetConnectionParameters(CORBA::Long& theId,
179 CORBA::String_out theDHost, CORBA::Long& theDPort,
180 CORBA::String_out theRHost, CORBA::Long& theRPort,
181 CORBA::Long& theReversed);
184 //! Implementation of PARAVIS_Gen interface
185 virtual void ActivateModule();
187 //! Returns current ORB
188 static CORBA::ORB_var GetORB() { return myOrb;}
190 //! Returns current POA
191 static PortableServer::POA_var GetPOA() { return myPoa;}
193 //! Returns current implementation instance
194 static PARAVIS_Gen_i* GetParavisGenImpl() { return myParavisGenImpl;}
197 static CORBA::ORB_var myOrb;
198 static PortableServer::POA_var myPoa;
199 static PARAVIS_Gen_i* myParavisGenImpl;
200 static SALOME_LifeCycleCORBA* myEnginesLifeCycle;
201 static SALOME_NamingService* myNamingService;
202 static QMutex* myMutex;
205 SALOMEDS::Study_var myStudyDocument;
206 static SalomeApp_Application* mySalomeApp;