Back to index

salome-kernel  6.5.0
SALOMEDSImpl_StudyBuilder.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  File   : SALOMEDSImpl_StudyBuilder.hxx
00024 //  Author : Sergey RUIN
00025 //  Module : SALOME
00026 //
00027 #ifndef __SALOMEDSImpl_STUDYBUILDER_H__
00028 #define __SALOMEDSImpl_STUDYBUILDER_H__
00029 
00030 #include "SALOMEDSImpl_Defines.hxx"
00031 // std C++ headers
00032 #include <iostream>
00033 #include <string>
00034 #include <vector>
00035 
00036 #include "SALOMEDSImpl_Callback.hxx"
00037 #include "SALOMEDSImpl_Driver.hxx"
00038 
00039 class SALOMEDSImpl_Study;
00040 
00041 class SALOMEDSIMPL_EXPORT SALOMEDSImpl_StudyBuilder
00042 {
00043 private:
00044   DF_Document*             _doc;
00045   SALOMEDSImpl_Study*      _study;  
00046   SALOMEDSImpl_Callback*   _callbackOnAdd;
00047   SALOMEDSImpl_Callback*   _callbackOnRemove;
00048   std::string              _errorCode;
00049 
00050 public:
00051 
00052   SALOMEDSImpl_StudyBuilder(const SALOMEDSImpl_Study* theOwner);
00053 
00054   ~SALOMEDSImpl_StudyBuilder();
00055 
00056   virtual SALOMEDSImpl_SComponent NewComponent(const std::string& ComponentDataType);
00057 
00058   virtual bool DefineComponentInstance (const SALOMEDSImpl_SComponent&, const std::string& ComponentIOR);
00059 
00060   virtual bool RemoveComponent(const SALOMEDSImpl_SComponent& aComponent);
00061 
00062   virtual SALOMEDSImpl_SObject NewObject(const SALOMEDSImpl_SObject& theFatherObject);
00063 
00064   virtual SALOMEDSImpl_SObject NewObjectToTag(const SALOMEDSImpl_SObject& theFatherObject, 
00065     const int theTag);
00066 
00068   virtual bool AddDirectory(const std::string& thePath);
00069 
00070   virtual bool LoadWith(const SALOMEDSImpl_SComponent& sco, SALOMEDSImpl_Driver* Engine);
00071   virtual bool Load(const SALOMEDSImpl_SObject& sco);
00072 
00073   virtual bool RemoveObject(const SALOMEDSImpl_SObject& anObject);
00074   virtual bool RemoveObjectWithChildren(const SALOMEDSImpl_SObject& anObject);
00075 
00076   virtual DF_Attribute* FindOrCreateAttribute(const SALOMEDSImpl_SObject& anObject, 
00077                                               const std::string& aTypeOfAttribute);
00078   virtual bool FindAttribute(const SALOMEDSImpl_SObject& anObject, 
00079                              DF_Attribute*& anAttribute, 
00080                              const std::string& aTypeOfAttribute);
00081 
00082   virtual bool RemoveAttribute(const SALOMEDSImpl_SObject& anObject, const std::string& aTypeOfAttribute);
00083 
00084   virtual bool Addreference(const SALOMEDSImpl_SObject& me, 
00085                             const SALOMEDSImpl_SObject& thereferencedObject);
00086 
00087   virtual bool RemoveReference(const SALOMEDSImpl_SObject& me);
00088 
00089   virtual bool SetGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
00090   virtual bool IsGUID(const SALOMEDSImpl_SObject& anObject, const std::string& theGUID);
00091 
00092   virtual void NewCommand();
00093   virtual void CommitCommand();
00094   virtual bool HasOpenCommand();
00095   virtual void AbortCommand();
00096   virtual void Undo();
00097   virtual void Redo();
00098   bool GetAvailableUndos();
00099   bool GetAvailableRedos();
00100   bool IsSaved();
00101   bool IsModified();
00102   virtual int UndoLimit();
00103   virtual void UndoLimit(const int);
00104 
00105   void CheckLocked();
00106 
00107   virtual SALOMEDSImpl_Callback* SetOnAddSObject(const SALOMEDSImpl_Callback* theCallback);
00108   virtual SALOMEDSImpl_Callback* SetOnRemoveSObject(const SALOMEDSImpl_Callback* theCallback);
00109 
00110   virtual bool SetName(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
00111 
00112   virtual bool SetComment(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
00113 
00114   virtual bool SetIOR(const SALOMEDSImpl_SObject& theSO, const std::string& theValue);
00115 
00116   virtual std::string GetErrorCode() { return _errorCode; }
00117   virtual bool IsError() { return _errorCode != ""; }
00118 
00119   virtual SALOMEDSImpl_Study* GetOwner() { return _study; }
00120 };
00121 #endif