1 // SALOME SALOMEDS : data structure of SALOME and sources of Salome data server
3 // Copyright (C) 2003 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOMEDS_StudyManager_i.hxx
25 // Author : Yves FRICAUD
29 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
30 #define __SALOMEDS_STUDYMANAGER_I_H__
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SALOMEDS)
41 #include <TDocStd_Document.hxx>
42 #include <TDF_Attribute.hxx>
43 #include <TDataStd_Name.hxx>
44 #include <TDF_Label.hxx>
45 #include <TDocStd_Document.hxx>
46 #include <Standard_NotImplemented.hxx>
48 #include "SALOMEDS_OCAFApplication.hxx"
49 #include "SALOME_NamingService.hxx"
54 class SALOMEDS_Study_i;
58 // To convert IOR from SALOMEDS_IORAttribute to CORBA::Object
60 GetObject(const TDF_Label&, CORBA::ORB_ptr);
62 // To convert CORBA::Object to PortableServer::ServantBase
63 PortableServer::ServantBase_var
64 GetServant(CORBA::Object_ptr, PortableServer::POA_ptr);
69 class SALOMEDS_StudyManager_i:
70 public virtual POA_SALOMEDS::StudyManager,
71 public virtual PortableServer::RefCountServantBase
73 SALOMEDS_StudyManager_i(); // Not implemented
74 void operator=(const SALOMEDS_StudyManager_i&); // Not implemented
78 PortableServer::POA_var _poa;
79 SALOME_NamingService _name_service;
80 Handle (SALOMEDS_OCAFApplication) _OCAFApp;
81 Handle(TDocStd_Document) _clipboard;
84 // _SaveAs private function called by Save and SaveAs
85 virtual void _SaveAs(const char* aUrl,
86 SALOMEDS::Study_ptr aStudy,
87 CORBA::Boolean theMultiFile,
88 CORBA::Boolean theASCII);
89 // _SaveObject private function called by _SaveAs
90 virtual void _SaveObject(SALOMEDS::Study_ptr aStudy,
91 SALOMEDS::SObject_ptr SC,
92 HDFgroup *hdf_group_datatype);
93 // _SubstituteSlash function called by Open and GetStudyByName
94 virtual std::string _SubstituteSlash(const char *aUrl);
96 virtual void _SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group);
99 //! standard constructor
100 SALOMEDS_StudyManager_i(CORBA::ORB_ptr theORB, PortableServer::POA_ptr thePOA);
102 //! standard destructor
103 virtual ~SALOMEDS_StudyManager_i();
105 CORBA::ORB_var GetORB() const { return _orb; }
107 PortableServer::POA_var GetPOA() const { return _poa; }
109 //! method to Register study Manager in the naming service
111 \param char* arguments, the context to register the study manager in the NS
113 void register_name(char * name);
115 //! method to Create a New Study of name study_name
117 \param char* arguments, the new study name
118 \return Study_ptr arguments
120 virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
122 //! method to Open a Study from it's persistent reference
124 \param char* arguments, the study URL
125 \return Study_ptr arguments
127 virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
130 //! method to close a Study
132 \param Study_ptr arguments
134 virtual void Close( SALOMEDS::Study_ptr aStudy);
136 //! method to save a Study
138 \param Study_ptr arguments
140 virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
142 virtual void SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
144 //! method to save a Study to the persistent reference aUrl
146 \param char* arguments, the new URL of the study
147 \param Study_ptr arguments
149 virtual void SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
150 virtual void SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
152 //! method to Get name list of open studies in the session
154 \return ListOfOpenStudies* arguments
156 virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
158 //! method to get a Study from it's name
160 \param char* arguments, the study name
161 \return Study_ptr arguments
163 virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
165 //! method to get a Study from it's ID
167 \param char* arguments, the study ID
168 \return Study_ptr arguments
170 virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
172 void CopyLabel(SALOMEDS_Study_i* theSourceStudy,
173 const SALOMEDS::Driver_ptr theEngine,
174 const Standard_Integer theSourceStartDepth,
175 const TDF_Label& theSource,
176 const TDF_Label& theDestinationMain);
178 TDF_Label PasteLabel(SALOMEDS_Study_i* theDestinationStudy,
179 const SALOMEDS::Driver_ptr theEngine,
180 const TDF_Label& theSource,
181 const TDF_Label& theDestinationStart,
182 const int theCopiedStudyID,
183 const bool isFirstElement);
185 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
186 virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
187 virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
188 virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);