]> SALOME platform Git repositories - modules/kernel.git/blob - src/SALOMEDS/SALOMEDS_Study.hxx
Salome HOME
Fixed problem with dump study and small optimization:
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_Study.hxx
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  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, or (at your option) any later version.
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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 //  File   : SALOMEDS_Study.hxx
24 //  Author : Sergey RUIN
25 //  Module : SALOME
26 //
27 #ifndef __SALOMEDS_STUDY_H__
28 #define __SALOMEDS_STUDY_H__
29
30 #include <vector>
31 #include <string>
32
33 #include "SALOMEDSClient.hxx"
34 #include "SALOMEDSImpl_Study.hxx"
35
36 // IDL headers
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(SALOMEDS)
39
40 class Standard_EXPORT SALOMEDS_Study: public SALOMEDSClient_Study
41 {
42
43 private:
44   bool                       _isLocal;
45   SALOMEDSImpl_Study*        _local_impl;
46   SALOMEDS::Study_var        _corba_impl;
47   CORBA::ORB_var             _orb;
48
49 public:
50
51   SALOMEDS_Study(SALOMEDSImpl_Study* theStudy);
52   SALOMEDS_Study(SALOMEDS::Study_ptr theStudy);
53   ~SALOMEDS_Study();
54
55   virtual void Clear();
56   virtual void Init();
57
58   virtual bool Open(const std::string& theStudyUrl);
59
60   virtual bool Save(bool theMultiFile);
61   virtual bool SaveASCII(bool theMultiFile);
62   virtual bool SaveAs(const std::string& theUrl, bool theMultiFile);
63   virtual bool SaveAsASCII(const std::string& theUrl, bool theMultiFile);
64
65   virtual bool CanCopy(const _PTR(SObject)& theSO);
66   virtual bool Copy(const _PTR(SObject)& theSO);
67   virtual bool CanPaste(const _PTR(SObject)& theSO);
68   virtual _PTR(SObject) Paste(const _PTR(SObject)& theSO);
69
70   virtual std::string GetPersistentReference();
71   virtual std::string GetTransientReference();
72   virtual bool IsEmpty();
73   virtual _PTR(SComponent) FindComponent (const std::string& aComponentName);
74   virtual _PTR(SComponent) FindComponentID(const std::string& aComponentID);
75   virtual _PTR(SObject) FindObject(const std::string& anObjectName);
76   virtual std::vector<_PTR(SObject)> FindObjectByName( const std::string& anObjectName, const std::string& aComponentName ) ;  
77   virtual _PTR(SObject) FindObjectID(const std::string& anObjectID);
78   virtual _PTR(SObject) CreateObjectID(const std::string& anObjectID);
79   virtual _PTR(SObject) FindObjectIOR(const std::string& anObjectIOR);
80   virtual _PTR(SObject) FindObjectByPath(const std::string& thePath);
81   virtual std::string GetObjectPath(const _PTR(SObject)& theSO);
82   virtual void SetContext(const std::string& thePath);
83   virtual std::string GetContext();  
84   virtual std::vector<std::string> GetObjectNames(const std::string& theContext);
85   virtual std::vector<std::string> GetDirectoryNames(const std::string& theContext);
86   virtual std::vector<std::string> GetFileNames(const std::string& theContext);
87   virtual std::vector<std::string> GetComponentNames(const std::string& theContext);
88   virtual _PTR(ChildIterator) NewChildIterator(const _PTR(SObject)& theSO);
89   virtual _PTR(SComponentIterator) NewComponentIterator();
90   virtual _PTR(StudyBuilder) NewBuilder();
91   virtual std::string Name();
92   virtual bool IsSaved();
93   virtual void  IsSaved(bool save);
94   virtual bool IsModified();
95   virtual void Modified();
96   virtual std::string URL();
97   virtual void  URL(const std::string& url);
98   virtual std::vector<_PTR(SObject)> FindDependances(const _PTR(SObject)& theSO);
99   virtual _PTR(AttributeStudyProperties) GetProperties();
100   virtual std::string GetLastModificationDate();
101   virtual std::vector<std::string> GetModificationsDate();
102   virtual _PTR(UseCaseBuilder) GetUseCaseBuilder();
103   virtual void EnableUseCaseAutoFilling(bool isEnabled);
104   virtual bool DumpStudy(const std::string& thePath,const std::string& theBaseName,bool isPublished,bool isMultiFile); 
105   virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint);
106   virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, 
107                                                        const std::string& theModuleName, int theSavePoint);
108   virtual void SetStudyLock(const std::string& theLockerID);
109   virtual bool IsStudyLocked();
110   virtual void UnLockStudy(const std::string& theLockerID);
111   virtual std::vector<std::string> GetLockerID();
112
113   virtual void SetReal(const std::string& theVarName, const double theValue);
114   virtual void SetInteger(const std::string& theVarName, const int theValue);
115   virtual void SetBoolean(const std::string& theVarName, const bool theValue);  
116   virtual void SetString(const std::string& theVarName, const std::string& theValue);
117   virtual void SetStringAsDouble(const std::string& theVarName, const double theValue);
118   
119   virtual double GetReal(const std::string& theVarName);
120   virtual int GetInteger(const std::string& theVarName);
121   virtual bool GetBoolean(const std::string& theVarName);
122   virtual std::string GetString(const std::string& theVarName);
123   
124   virtual bool IsReal(const std::string& theVarName);
125   virtual bool IsInteger(const std::string& theVarName);
126   virtual bool IsBoolean(const std::string& theVarName);
127   virtual bool IsString(const std::string& theVarName);
128
129   virtual bool IsVariable(const std::string& theVarName);
130   virtual std::vector<std::string> GetVariableNames();
131
132   virtual bool RemoveVariable(const std::string& theVarName);
133   virtual bool RenameVariable(const std::string& theVarName, const std::string& theNewVarName);
134   virtual bool IsVariableUsed(const std::string& theVarName);
135   virtual std::vector< std::vector<std::string> > ParseVariables(const std::string& theVars);
136   virtual void attach(SALOMEDS::Observer_ptr theObserver,bool modify);
137   virtual void detach(SALOMEDS::Observer_ptr theObserver);
138
139   std::string ConvertObjectToIOR(CORBA::Object_ptr theObject);
140   CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR);     
141
142   SALOMEDS::Study_ptr GetStudy();
143   
144   SALOMEDSImpl_Study* GetLocalImpl() { return _local_impl; }
145
146 private:
147   void InitORB();
148
149 };
150 #endif