Salome HOME
2c45ce203061f643c6d8b06ee17aeaaa0ce0c57e
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyManager_i.hxx
1 //  SALOME SALOMEDS : data structure of SALOME and sources of Salome data server 
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SALOMEDS_StudyManager_i.hxx
25 //  Author : Yves FRICAUD
26 //  Module : SALOME
27 //  $Header$
28
29 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
30 #define __SALOMEDS_STUDYMANAGER_I_H__
31
32 // std C++ headers
33 #include <iostream.h>
34
35 // IDL headers
36 #include <SALOMEconfig.h>
37 #include CORBA_SERVER_HEADER(SALOMEDS)
38
39 // Cascade headers
40 #include "SALOMEDS_OCAFApplication.hxx"
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
47 // Naming Service header
48 #include "SALOME_NamingService.hxx"
49
50 // HDF
51 #include <iostream.h>
52 #include "HDFOI.hxx"
53 #include <stdlib.h>
54
55 //Standard not implemented
56 #include <Standard_NotImplemented.hxx>
57
58
59 class SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager,
60                                public PortableServer::RefCountServantBase {
61 private:
62
63   CORBA::ORB_ptr _orb;
64   Handle (SALOMEDS_OCAFApplication) _OCAFApp;  
65   SALOME_NamingService* _name_service;
66   int _IDcounter;
67   Handle(TDocStd_Document) _clipboard;
68
69   // _SaveAs private function called by Save and SaveAs
70   virtual void _SaveAs(const char* aUrl,
71                        SALOMEDS::Study_ptr aStudy,
72                        CORBA::Boolean theMultiFile,
73                        CORBA::Boolean theASCII);
74   // _SaveObject private function called by _SaveAs
75   virtual void _SaveObject(SALOMEDS::Study_ptr aStudy, 
76                            SALOMEDS::SObject_ptr SC, 
77                            HDFgroup *hdf_group_datatype);
78   // _SubstituteSlash function called by Open and GetStudyByName
79   virtual const char *_SubstituteSlash(const char *aUrl);
80
81   virtual void _SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group);
82
83 public:
84
85   //! standard constructor
86   SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb);
87
88   //! standard destructor
89   virtual  ~SALOMEDS_StudyManager_i(); 
90
91  //! method to Register study Manager in the naming service
92   /*!
93     \param char* arguments, the context to register the study manager in the NS
94   */  
95   void register_name(char * name);
96   
97  //! method to Create a New Study of name study_name
98   /*!
99     \param char* arguments, the new study name
100     \return Study_ptr arguments
101   */  
102   virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
103
104   //! method to Open a Study from it's persistent reference
105   /*!
106     \param char* arguments, the study URL
107     \return Study_ptr arguments
108   */ 
109   virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
110
111
112   //! method to close a Study 
113   /*!
114     \param Study_ptr arguments
115   */ 
116   virtual void Close( SALOMEDS::Study_ptr aStudy);
117
118   //! method to save a Study 
119   /*!
120     \param Study_ptr arguments
121   */
122   virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
123
124   virtual void SaveASCII( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
125
126   //! method to save a Study to the persistent reference aUrl
127   /*!
128     \param char* arguments, the new URL of the study
129     \param Study_ptr arguments
130   */
131   virtual void SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
132   virtual void SaveAsASCII(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
133
134  //! method to Get name list of open studies in the session
135   /*!
136     \return ListOfOpenStudies* arguments
137   */
138   virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
139
140   //! method to get a Study from it's name
141   /*!
142     \param char* arguments, the study name
143     \return Study_ptr arguments
144   */ 
145   virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
146
147   //! method to get a Study from it's ID
148   /*!
149     \param char* arguments, the study ID
150     \return Study_ptr arguments
151   */ 
152   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
153
154
155   Handle(TDocStd_Document) GetDocumentOfStudy(SALOMEDS::Study_ptr theStudy);
156   
157   void CopyLabel(const SALOMEDS::Study_ptr theSourceStudy, 
158                  const SALOMEDS::Driver_ptr theEngine,
159                  const Standard_Integer theSourceStartDepth,
160                  const TDF_Label& theSource,
161                  const TDF_Label& theDestinationMain);
162
163   TDF_Label PasteLabel(const SALOMEDS::Study_ptr theDestinationStudy,
164                        const SALOMEDS::Driver_ptr theEngine,
165                        const TDF_Label& theSource,
166                        const TDF_Label& theDestinationStart,
167                        const int theCopiedStudyID,
168                        const bool isFirstElement);
169   
170   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
171   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
172   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
173   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
174   
175   void ping(){};
176 };
177
178 #endif