Salome HOME
Porting KERNEL on new XML reader.
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_StudyBuilder.hxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 //  File   : SALOMEDSImpl_StudyBuilder.hxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #ifndef __SALOMEDSImpl_STUDYBUILDER_H__
25 #define __SALOMEDSImpl_STUDYBUILDER_H__
26
27 //Handle definition
28 #include <Handle_MMgt_TShared.hxx>
29 #include <Standard_DefineHandle.hxx>
30 DEFINE_STANDARD_HANDLE( SALOMEDSImpl_StudyBuilder, MMgt_TShared )
31
32 // std C++ headers
33 #include <iostream>
34
35 // Cascade header
36 #include <TCollection_AsciiString.hxx>
37 #include <TDocStd_Document.hxx>
38  
39 #include "SALOMEDSImpl_Callback.hxx"
40 #include "SALOMEDSImpl_Driver.hxx"
41
42 class SALOMEDSImpl_StudyBuilder : public MMgt_TShared 
43 {
44 private:
45   Handle(TDocStd_Document)        _doc;
46   Handle(Standard_Transient)      _study;  
47   Handle(SALOMEDSImpl_Callback)   _callbackOnAdd;
48   Handle(SALOMEDSImpl_Callback)   _callbackOnRemove;
49   TCollection_AsciiString         _errorCode;
50
51 public:
52     
53   Standard_EXPORT SALOMEDSImpl_StudyBuilder(const Handle(Standard_Transient)& theOwner);
54
55   Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
56
57   Standard_EXPORT virtual Handle(SALOMEDSImpl_SComponent) NewComponent(const TCollection_AsciiString& ComponentDataType);
58
59   Standard_EXPORT virtual bool DefineComponentInstance (const Handle(SALOMEDSImpl_SComponent)&, const TCollection_AsciiString& ComponentIOR);
60   
61   Standard_EXPORT virtual bool RemoveComponent(const Handle(SALOMEDSImpl_SComponent)& aComponent);
62
63   Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObject(const Handle(SALOMEDSImpl_SObject)& theFatherObject);
64
65   Standard_EXPORT virtual Handle(SALOMEDSImpl_SObject) NewObjectToTag(const Handle(SALOMEDSImpl_SObject)& theFatherObject, 
66                                                       const int theTag);
67
68   //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
69   Standard_EXPORT virtual bool AddDirectory(const TCollection_AsciiString& thePath);
70
71   Standard_EXPORT virtual bool LoadWith(const Handle(SALOMEDSImpl_SComponent)& sco, SALOMEDSImpl_Driver* Engine);
72   Standard_EXPORT virtual bool Load(const Handle(SALOMEDSImpl_SObject)& sco);
73
74   Standard_EXPORT virtual bool RemoveObject(const Handle(SALOMEDSImpl_SObject)& anObject);
75   Standard_EXPORT virtual bool RemoveObjectWithChildren(const Handle(SALOMEDSImpl_SObject)& anObject);
76
77   Standard_EXPORT virtual Handle(TDF_Attribute) FindOrCreateAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, 
78                                                       const TCollection_AsciiString& aTypeOfAttribute);
79   Standard_EXPORT virtual bool FindAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, 
80                              Handle(TDF_Attribute)& anAttribute, 
81                              const TCollection_AsciiString& aTypeOfAttribute);
82
83   Standard_EXPORT virtual bool RemoveAttribute(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& aTypeOfAttribute);
84
85   Standard_EXPORT virtual bool Addreference(const Handle(SALOMEDSImpl_SObject)& me, 
86                             const Handle(SALOMEDSImpl_SObject)& thereferencedObject);
87
88   Standard_EXPORT virtual bool RemoveReference(const Handle(SALOMEDSImpl_SObject)& me);
89
90   Standard_EXPORT virtual bool SetGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
91   Standard_EXPORT virtual bool IsGUID(const Handle(SALOMEDSImpl_SObject)& anObject, const TCollection_AsciiString& theGUID);
92
93   Standard_EXPORT virtual void NewCommand();
94   Standard_EXPORT virtual void CommitCommand();
95   Standard_EXPORT virtual bool HasOpenCommand();
96   Standard_EXPORT virtual void AbortCommand();
97   Standard_EXPORT virtual void Undo();
98   Standard_EXPORT virtual void Redo();
99   Standard_EXPORT bool GetAvailableUndos();
100   Standard_EXPORT bool GetAvailableRedos();
101   Standard_EXPORT bool IsSaved();
102   Standard_EXPORT bool IsModified();
103   Standard_EXPORT virtual int UndoLimit();
104   Standard_EXPORT virtual void UndoLimit(const int);
105
106   Standard_EXPORT void CheckLocked();
107
108   Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnAddSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
109   Standard_EXPORT virtual Handle(SALOMEDSImpl_Callback) SetOnRemoveSObject(const Handle(SALOMEDSImpl_Callback)& theCallback);
110
111   Standard_EXPORT virtual bool SetName(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
112
113   Standard_EXPORT virtual bool SetComment(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
114
115   Standard_EXPORT virtual bool SetIOR(const Handle(SALOMEDSImpl_SObject)& theSO, const TCollection_AsciiString& theValue);
116
117   Standard_EXPORT virtual TCollection_AsciiString GetErrorCode() { return _errorCode; }
118   Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
119
120   Standard_EXPORT virtual Handle(Standard_Transient) GetOwner() { return _study; }
121
122 public:
123   DEFINE_STANDARD_RTTI( SALOMEDSImpl_StudyBuilder )
124 };
125 #endif