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 void _SaveObject(SALOMEDS_Study_i* theStudy,
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 void _SaveProperties(SALOMEDS_Study_i* theStudy, 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 SALOMEDS_Study_i* DownCast(SALOMEDS::Study_ptr theStudy) const;
111 //! method to Register study Manager in the naming service
113 \param char* arguments, the context to register the study manager in the NS
115 void register_name(char * name);
117 //! method to Create a New Study of name study_name
119 \param char* arguments, the new study name
120 \return Study_ptr arguments
122 virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
124 //! method to Open a Study from it's persistent reference
126 \param char* arguments, the study URL
127 \return Study_ptr arguments
129 virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
132 //! method to close a Study
134 \param Study_ptr arguments
136 virtual void Close( SALOMEDS::Study_ptr aStudy);
138 //! method to save a Study
140 \param Study_ptr arguments
142 virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
144 virtual void SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
146 //! method to save a Study to the persistent reference aUrl
148 \param char* arguments, the new URL of the study
149 \param Study_ptr arguments
151 virtual void SaveAs(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
152 virtual void SaveAsASCII(const char* aUrl, SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
154 //! method to Get name list of open studies in the session
156 \return ListOfOpenStudies* arguments
158 virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
160 //! method to get a Study from it's name
162 \param char* arguments, the study name
163 \return Study_ptr arguments
165 virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
167 //! method to get a Study from it's ID
169 \param char* arguments, the study ID
170 \return Study_ptr arguments
172 virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
174 void CopyLabel(SALOMEDS_Study_i* theSourceStudy,
175 const SALOMEDS::Driver_ptr theEngine,
176 const Standard_Integer theSourceStartDepth,
177 const TDF_Label& theSource,
178 const TDF_Label& theDestinationMain);
180 TDF_Label PasteLabel(SALOMEDS_Study_i* theDestinationStudy,
181 const SALOMEDS::Driver_ptr theEngine,
182 const TDF_Label& theSource,
183 const TDF_Label& theDestinationStart,
184 const int theCopiedStudyID,
185 const bool isFirstElement);
187 virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
188 virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
189 virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
190 virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);