Salome HOME
CCAR: remove memory leaks in non local SALOMEDS
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_StudyBuilder.hxx
1 //  Copyright (C) 2007-2008  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 //  File   : SALOMEDS_StudyBuilder.hxx
23 //  Author : Sergey RUIN
24 //  Module : SALOME
25 //
26 #ifndef __SALOMEDS_STUDYBUILDER_H__
27 #define __SALOMEDS_STUDYBUILDER_H__
28
29 #include "SALOMEDS_Defines.hxx"
30
31 #include "SALOMEDSClient.hxx"
32 #include "SALOMEDSImpl_StudyBuilder.hxx"
33
34 // IDL headers
35 #include <SALOMEconfig.h>
36 #include CORBA_SERVER_HEADER(SALOMEDS)
37
38 class SALOMEDS_EXPORT SALOMEDS_StudyBuilder: public SALOMEDSClient_StudyBuilder
39 {
40 private:
41   bool _isLocal;
42   SALOMEDSImpl_StudyBuilder*        _local_impl;
43   SALOMEDS::StudyBuilder_var        _corba_impl;
44   CORBA::ORB_var                    _orb;
45
46 public:
47
48   SALOMEDS_StudyBuilder(SALOMEDSImpl_StudyBuilder* theBuilder);
49   SALOMEDS_StudyBuilder(SALOMEDS::StudyBuilder_ptr theBuilder);
50   ~SALOMEDS_StudyBuilder();
51
52   virtual _PTR(SComponent) NewComponent(const std::string& ComponentDataType);
53   virtual void DefineComponentInstance (const _PTR(SComponent)&, const std::string& ComponentIOR);
54   virtual void RemoveComponent(const _PTR(SComponent)& theSCO);
55   virtual _PTR(SObject) NewObject(const _PTR(SObject)& theFatherObject);
56   virtual _PTR(SObject) NewObjectToTag(const _PTR(SObject)& theFatherObject, int theTag);
57   virtual void AddDirectory(const std::string& thePath);
58   virtual void LoadWith(const _PTR(SComponent)& theSCO, const std::string& theIOR);
59   virtual void Load(const _PTR(SObject)& theSCO);
60   virtual void RemoveObject(const _PTR(SObject)& theSO);
61   virtual void RemoveObjectWithChildren(const _PTR(SObject)& theSO);
62   virtual _PTR(GenericAttribute) FindOrCreateAttribute(const _PTR(SObject)& theSO, 
63                                                        const std::string& aTypeOfAttribute);
64   virtual bool FindAttribute(const _PTR(SObject)& theSO, 
65                              _PTR(GenericAttribute)& theAttribute, 
66                              const std::string& aTypeOfAttribute);
67   virtual void RemoveAttribute(const _PTR(SObject)& theSO, const std::string& aTypeOfAttribute);
68   virtual void Addreference(const _PTR(SObject)& me, const _PTR(SObject)& thereferencedObject);
69   virtual void RemoveReference(const _PTR(SObject)& me);
70   virtual void SetGUID(const _PTR(SObject)& theSO, const std::string& theGUID);
71   virtual bool IsGUID(const _PTR(SObject)& theSO, const std::string& theGUID);
72   virtual void NewCommand();
73   virtual void CommitCommand();
74   virtual bool HasOpenCommand();
75   virtual void AbortCommand();
76   virtual void Undo();
77   virtual void Redo();
78   virtual bool GetAvailableUndos();
79   virtual bool GetAvailableRedos();
80   virtual int UndoLimit();
81   virtual void UndoLimit(int theLimit);
82   virtual void SetName(const _PTR(SObject)& theSO, const std::string& theValue);
83   virtual void SetComment(const _PTR(SObject)& theSO, const std::string& theValue);
84   virtual void SetIOR(const _PTR(SObject)& theSO, const std::string& theValue);
85
86   SALOMEDS::StudyBuilder_ptr GetBuilder();
87
88 private:
89   void CheckLocked();
90   void init_orb();
91 };
92 #endif