Salome HOME
de061a44d1e512a8f948c19b7323adc4c2ea8157
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyManager_i.hxx
1 //  File      : SALOMEDS_StudyManager_i.hxx
2 //  Created   : Wed Nov 28 16:27:08 2001
3 //  Author    : Yves FRICAUD
4
5 //  Project   : SALOME
6 //  Module    : SALOMEDS
7 //  Copyright : Open CASCADE 2001
8 //  $Header$
9
10 #ifndef __SALOMEDS_STUDYMANAGER_I_H__
11 #define __SALOMEDS_STUDYMANAGER_I_H__
12
13 // std C++ headers
14 #include <iostream.h>
15
16 // IDL headers
17 #include <SALOMEconfig.h>
18 #include CORBA_SERVER_HEADER(SALOMEDS)
19
20 // Cascade headers
21 #include "SALOMEDS_OCAFApplication.hxx"
22 #include <TDocStd_Document.hxx>
23 #include <TDF_Attribute.hxx>
24 #include <TDataStd_Name.hxx>
25 #include <TDF_Label.hxx>
26 #include <TDocStd_Document.hxx>
27
28 // Naming Service header
29 #include "SALOME_NamingService.hxx"
30
31 // HDF
32 #include <iostream.h>
33 #include "HDFOI.hxx"
34 #include <stdlib.h>
35
36 //Standard not implemented
37 #include <Standard_NotImplemented.hxx>
38
39
40 class SALOMEDS_StudyManager_i: public POA_SALOMEDS::StudyManager,
41                                public PortableServer::RefCountServantBase {
42 private:
43
44   CORBA::ORB_ptr _orb;
45   Handle (SALOMEDS_OCAFApplication) _OCAFApp;  
46   SALOME_NamingService* _name_service;
47   int _IDcounter;
48   Handle(TDocStd_Document) _clipboard;
49
50   // _SaveAs private function called by Save and SaveAs
51   virtual void _SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
52   // _SaveObject private function called by _SaveAs
53   virtual void _SaveObject(SALOMEDS::Study_ptr aStudy, 
54                            SALOMEDS::SObject_ptr SC, 
55                            HDFgroup *hdf_group_datatype);
56   // _SubstituteSlash function called by Open and GetStudyByName
57   virtual const char *_SubstituteSlash(const char *aUrl);
58
59   virtual void _SaveProperties(SALOMEDS::Study_ptr aStudy, HDFgroup *hdf_group);
60
61 public:
62
63   //! standard constructor
64   SALOMEDS_StudyManager_i(CORBA::ORB_ptr orb);
65
66   //! standard destructor
67   virtual  ~SALOMEDS_StudyManager_i(); 
68
69  //! method to Register study Manager in the naming service
70   /*!
71     \param char* arguments, the context to register the study manager in the NS
72   */  
73   void register_name(char * name);
74   
75  //! method to Create a New Study of name study_name
76   /*!
77     \param char* arguments, the new study name
78     \return Study_ptr arguments
79   */  
80   virtual SALOMEDS::Study_ptr NewStudy(const char* study_name);
81
82   //! method to Open a Study from it's persistent reference
83   /*!
84     \param char* arguments, the study URL
85     \return Study_ptr arguments
86   */ 
87   virtual SALOMEDS::Study_ptr Open(const char* aStudyUrl) throw (SALOME::SALOME_Exception);
88
89
90   //! method to close a Study 
91   /*!
92     \param Study_ptr arguments
93   */ 
94   virtual void Close( SALOMEDS::Study_ptr aStudy);
95
96   //! method to save a Study 
97   /*!
98     \param Study_ptr arguments
99   */
100   virtual void Save( SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
101
102   //! method to save a Study to the persistent reference aUrl
103   /*!
104     \param char* arguments, the new URL of the study
105     \param Study_ptr arguments
106   */
107   virtual void SaveAs(const char* aUrl,  SALOMEDS::Study_ptr aStudy, CORBA::Boolean theMultiFile);
108
109  //! method to Get name list of open studies in the session
110   /*!
111     \return ListOfOpenStudies* arguments
112   */
113   virtual SALOMEDS::ListOfOpenStudies* GetOpenStudies();
114
115   //! method to get a Study from it's name
116   /*!
117     \param char* arguments, the study name
118     \return Study_ptr arguments
119   */ 
120   virtual SALOMEDS::Study_ptr GetStudyByName(const char* aStudyName) ;
121
122   //! method to get a Study from it's ID
123   /*!
124     \param char* arguments, the study ID
125     \return Study_ptr arguments
126   */ 
127   virtual SALOMEDS::Study_ptr GetStudyByID(CORBA::Short aStudyID) ;
128
129
130   Handle(TDocStd_Document) GetDocumentOfStudy(SALOMEDS::Study_ptr theStudy);
131   
132   void CopyLabel(const SALOMEDS::Study_ptr theSourceStudy, 
133                  const SALOMEDS::Driver_ptr theEngine,
134                  const Standard_Integer theSourceStartDepth,
135                  const TDF_Label& theSource,
136                  const TDF_Label& theDestinationMain);
137
138   TDF_Label PasteLabel(const SALOMEDS::Study_ptr theDestinationStudy,
139                        const SALOMEDS::Driver_ptr theEngine,
140                        const TDF_Label& theSource,
141                        const TDF_Label& theDestinationStart,
142                        const int theCopiedStudyID,
143                        const bool isFirstElement);
144   
145   virtual CORBA::Boolean CanCopy(SALOMEDS::SObject_ptr theObject);
146   virtual CORBA::Boolean Copy(SALOMEDS::SObject_ptr theObject);
147   virtual CORBA::Boolean CanPaste(SALOMEDS::SObject_ptr theObject);
148   virtual SALOMEDS::SObject_ptr Paste(SALOMEDS::SObject_ptr theObject) throw(SALOMEDS::StudyBuilder::LockProtection);
149   
150   void ping(){};
151 };
152
153 #endif