Salome HOME
CMake: replacing CMAKE_* variables by PROJECT_* variables
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_StudyBuilder.hxx
1 // Copyright (C) 2007-2013  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.
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   : SALOMEDSImpl_StudyBuilder.hxx
24 //  Author : Sergey RUIN
25 //  Module : SALOME
26 //
27 #ifndef __SALOMEDSImpl_STUDYBUILDER_H__
28 #define __SALOMEDSImpl_STUDYBUILDER_H__
29
30 #include "SALOMEDSImpl_Defines.hxx"
31 // std C++ headers
32 #include <iostream>
33 #include <string>
34 #include <vector>
35
36 #include "SALOMEDSImpl_Callback.hxx"
37 #include "SALOMEDSImpl_Driver.hxx"
38
39 class SALOMEDSImpl_Study;
40
41 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyBuilder
42 {
43 private:
44   DF_Document*             _doc;
45   SALOMEDSImpl_Study*      _study;  
46   SALOMEDSImpl_Callback*   _callbackOnAdd;
47   SALOMEDSImpl_Callback*   _callbackOnRemove;
48   std::string              _errorCode;
49
50 public:
51
52   SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
53
54   ~SALOMEDSImpl_StudyBuilder();
55
56   virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
57
58   virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
59
60   virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
61
62   virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
63
64   virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject, 
65     const int theTag);
66
67   //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
68   virtual bool AddDirectory(const std::string& thePath);
69
70   virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
71   virtual bool Load(const SALOMEDSImpl_SObject& sco);
72
73   virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
74   virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
75
76   virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject, 
77                                               const std::string& aTypeOfAttribute);
78   virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject, 
79                              DF_Attribute*& anAttribute, 
80                              const std::string& aTypeOfAttribute);
81
82   virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
83
84   virtual bool Addreference(const SALOMEDSImpl_SObject& me, 
85                             const SALOMEDSImpl_SObject& thereferencedObject);
86
87   virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
88
89   virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
90   virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
91
92   virtual void NewCommand();
93   virtual void CommitCommand();
94   virtual bool HasOpenCommand();
95   virtual void AbortCommand();
96   virtual void Undo();
97   virtual void Redo();
98   bool GetAvailableUndos();
99   bool GetAvailableRedos();
100   bool IsSaved();
101   bool IsModified();
102   virtual int UndoLimit();
103   virtual void UndoLimit(const int);
104
105   void CheckLocked();
106
107   virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
108   virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
109
110   virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
111
112   virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
113
114   virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
115
116   virtual std::string GetErrorCode() { return _errorCode; }
117   virtual bool IsError() { return _errorCode != ""; }
118
119   virtual SALOMEDSImpl_Study* GetOwner() { return _study; }
120 };
121 #endif