Salome HOME
New implementation of SALOMEDSImpl package based on DF data structure instead of...
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_SObject.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_SObject.hxx
21 //  Author : Sergey RUIN
22 //  Module : SALOME
23
24 #ifndef __SALOMEDSIMPL_SOBJECT_H__
25 #define __SALOMEDSIMPL_SOBJECT_H__
26
27 #include "DF_Label.hxx"
28 #include "DF_Attribute.hxx"
29 #include <string>
30 #include <vector>
31
32 class SALOMEDSImpl_SComponent;
33 class SALOMEDSImpl_Study;
34
35 class SALOMEDSImpl_SObject
36 {
37 protected:
38   DF_Label     _lab;
39   std::string  _name;  
40   std::string  _value;
41   std::string  _type;
42
43 public:
44   
45   Standard_EXPORT SALOMEDSImpl_SObject();
46   Standard_EXPORT SALOMEDSImpl_SObject(const DF_Label& theLabel);
47   Standard_EXPORT SALOMEDSImpl_SObject(const SALOMEDSImpl_SObject& theSObject);
48   Standard_EXPORT virtual ~SALOMEDSImpl_SObject();
49   
50   Standard_EXPORT virtual std::string GetID() const;
51   Standard_EXPORT virtual SALOMEDSImpl_SComponent GetFatherComponent() const;
52   Standard_EXPORT virtual SALOMEDSImpl_SObject GetFather() const ;
53   Standard_EXPORT virtual bool FindAttribute(DF_Attribute*& theAttribute, const std::string& theTypeOfAttribute) const;
54   Standard_EXPORT virtual bool ReferencedObject(SALOMEDSImpl_SObject& theObject) const ;
55   Standard_EXPORT virtual bool FindSubObject(int theTag, SALOMEDSImpl_SObject& theObject);
56
57   Standard_EXPORT virtual SALOMEDSImpl_Study*  GetStudy() const;
58   Standard_EXPORT virtual std::string Name() const { return _name; }
59   Standard_EXPORT virtual void Name(const std::string& theName) { _name = theName; }
60   Standard_EXPORT virtual std::vector<DF_Attribute*> GetAllAttributes() const; 
61
62   Standard_EXPORT virtual std::string GetName() const ;
63   Standard_EXPORT virtual std::string GetComment() const;
64   Standard_EXPORT virtual std::string GetIOR() const;
65
66   Standard_EXPORT virtual int Tag() const { return _lab.Tag(); }
67   Standard_EXPORT virtual int Depth() const { return _lab.Depth(); }
68
69   Standard_EXPORT virtual DF_Label GetLabel() const { return _lab; }   
70
71   Standard_EXPORT bool IsNull() const { return _lab.IsNull(); }
72
73   Standard_EXPORT bool IsComponent() const;
74
75   Standard_EXPORT operator SALOMEDSImpl_SComponent() const; 
76
77   Standard_EXPORT operator bool () const { return !IsNull(); }
78   
79   Standard_EXPORT SALOMEDSImpl_SObject* GetPersistentCopy() const;
80
81   Standard_EXPORT static std::string GetGUID(const std::string& theTypeOfAttribute);
82
83   
84 };
85 #endif