1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File : SALOMEDSImpl_StudyBuilder.hxx
21 // Author : Sergey RUIN
24 #ifndef __SALOMEDSImpl_STUDYBUILDER_H__
25 #define __SALOMEDSImpl_STUDYBUILDER_H__
32 #include "SALOMEDSImpl_Callback.hxx"
33 #include "SALOMEDSImpl_Driver.hxx"
35 class SALOMEDSImpl_Study;
37 class SALOMEDSImpl_StudyBuilder
41 SALOMEDSImpl_Study* _study;
42 SALOMEDSImpl_Callback* _callbackOnAdd;
43 SALOMEDSImpl_Callback* _callbackOnRemove;
44 std::string _errorCode;
48 Standard_EXPORT SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
50 Standard_EXPORT ~SALOMEDSImpl_StudyBuilder();
52 Standard_EXPORT virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
54 Standard_EXPORT virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
56 Standard_EXPORT virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
58 Standard_EXPORT virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
60 Standard_EXPORT virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject,
63 //! The methods adds a new subdirectory, the path can be absolute or relative (then the current context is used)
64 Standard_EXPORT virtual bool AddDirectory(const std::string& thePath);
66 Standard_EXPORT virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
67 Standard_EXPORT virtual bool Load(const SALOMEDSImpl_SObject& sco);
69 Standard_EXPORT virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
70 Standard_EXPORT virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
72 Standard_EXPORT virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject,
73 const std::string& aTypeOfAttribute);
74 Standard_EXPORT virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject,
75 DF_Attribute*& anAttribute,
76 const std::string& aTypeOfAttribute);
78 Standard_EXPORT virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
80 Standard_EXPORT virtual bool Addreference(const SALOMEDSImpl_SObject& me,
81 const SALOMEDSImpl_SObject& thereferencedObject);
83 Standard_EXPORT virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
85 Standard_EXPORT virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
86 Standard_EXPORT virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
88 Standard_EXPORT virtual void NewCommand();
89 Standard_EXPORT virtual void CommitCommand();
90 Standard_EXPORT virtual bool HasOpenCommand();
91 Standard_EXPORT virtual void AbortCommand();
92 Standard_EXPORT virtual void Undo();
93 Standard_EXPORT virtual void Redo();
94 Standard_EXPORT bool GetAvailableUndos();
95 Standard_EXPORT bool GetAvailableRedos();
96 Standard_EXPORT bool IsSaved();
97 Standard_EXPORT bool IsModified();
98 Standard_EXPORT virtual int UndoLimit();
99 Standard_EXPORT virtual void UndoLimit(const int);
101 Standard_EXPORT void CheckLocked();
103 Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
104 Standard_EXPORT virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
106 Standard_EXPORT virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
108 Standard_EXPORT virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
110 Standard_EXPORT virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
112 Standard_EXPORT virtual std::string GetErrorCode() { return _errorCode; }
113 Standard_EXPORT virtual bool IsError() { return _errorCode != ""; }
115 Standard_EXPORT virtual SALOMEDSImpl_Study* GetOwner() { return _study; }