Salome HOME
DCQ: prepare V2.0.0
[modules/geom.git] / src / GEOMDS / GEOMDS_Commands.hxx
1 //  GEOM GEOMDS : implementation of Geometry component data structure and Geometry documents management
2 //
3 //  Copyright (C) 2003  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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : GeomDS_Commands.hxx
25 //  Author : Yves FRICAUD/Lucien PIGNOLONI
26 //  Module : GEOM
27 //  $Header$
28
29 #ifndef _GEOMDS_Commands_HeaderFile
30 #define _GEOMDS_Commands_HeaderFile
31
32 #ifndef _TDF_Label_HeaderFile
33 #include <TDF_Label.hxx>
34 #endif
35 class TDF_Label;
36 class TopoDS_Shape;
37 class TCollection_ExtendedString;
38
39
40 #ifndef _Standard_HeaderFile
41 #include <Standard.hxx>
42 #endif
43 #ifndef _Standard_Macro_HeaderFile
44 #include <Standard_Macro.hxx>
45 #endif
46
47
48
49 //============================================================================
50 // class    : GEOMDS_Commands
51 // purpose  :
52 //============================================================================
53 class GEOMDS_Commands  {
54   
55 public:
56   
57   inline void* operator new(size_t,void* anAddress) 
58       {
59         return anAddress;
60       }
61   inline void* operator new(size_t size) 
62   { 
63     return Standard::Allocate(size); 
64   }
65   inline void  operator delete(void *anAddress) 
66   { 
67         if (anAddress) Standard::Free((Standard_Address&)anAddress); 
68   }
69   //    inline void  operator delete(void *anAddress, size_t size) 
70   //      { 
71   //        if (anAddress) Standard::Free((Standard_Address&)anAddress,size); 
72   //      }
73   // Methods PUBLIC
74   // 
75
76   // used for specific entities
77   enum GEOMDS_ConstructiveType { VECTOR, LINE, PLANE } ;
78   
79   // Methods to add or create items in the data structure
80   Standard_EXPORT GEOMDS_Commands(const TDF_Label& Main);
81   Standard_EXPORT TDF_Label AddShape(const TopoDS_Shape& S,
82                                      const TCollection_ExtendedString& Name) ;
83
84   Standard_EXPORT TDF_Label Generated(const TopoDS_Shape& S,
85                                       const TCollection_ExtendedString& Name) ;
86   Standard_EXPORT TDF_Label Generated(const TopoDS_Shape& S1,
87                                       const TopoDS_Shape& S2,
88                                       const TCollection_ExtendedString& Name) ;
89
90   /* Shapes construction */
91   Standard_EXPORT TDF_Label AddIndependentShape(const TopoDS_Shape& S,
92                                                 const TCollection_AsciiString& nameIOR) ;
93   Standard_EXPORT TDF_Label AddDependentShape(const TopoDS_Shape& S,
94                                               const TCollection_AsciiString& nameIOR,
95                                               const TDF_Label& mainLab) ;
96   Standard_EXPORT TDF_Label AddConstructiveElement(const TopoDS_Shape& S,
97                                                    const TCollection_ExtendedString& nameIOR,
98                                                    const GEOMDS_ConstructiveType& aType);
99
100   Standard_EXPORT Standard_Boolean AddIORNameAttribute(const TDF_Label& aLabel,
101                                                        const TCollection_ExtendedString& nameIOR) ;
102
103   /* Shapes query */
104
105   Standard_EXPORT Standard_Boolean IsConstructiveElement(const TDF_Label& aLabel) ;
106
107   Standard_EXPORT Standard_Boolean IsConstructiveElement(const TDF_Label& aLabel,
108                                                          TopoDS_Shape& returnTopo,
109                                                          GEOMDS_ConstructiveType& returnType) ;
110
111   Standard_EXPORT Standard_Boolean GetShape(const TDF_Label& aLabel,
112                                             TopoDS_Shape& returnTopo) ;
113
114   Standard_EXPORT Standard_Boolean IsDependentShape(const TDF_Label& aLabel) ;
115
116   Standard_EXPORT Standard_Boolean GetMainShapeLabel(const TDF_Label& aLabel,
117                                                      TDF_Label& returnMainLabel) ;
118
119   Standard_EXPORT Standard_Boolean ClearAllIOR(const TDF_Label& aLabel) ;
120
121   Standard_EXPORT Standard_Boolean HasIOR(const TDF_Label& aLabel) ;
122
123   Standard_EXPORT Standard_Boolean ReturnNameIOR(const TDF_Label& aLabel,
124                                                  TCollection_ExtendedString& returnNameIOR) ;
125   
126 protected:
127   
128   // Methods PROTECTED
129   // 
130
131   // Fields PROTECTED
132   //
133   
134 private: 
135   
136   // Methods PRIVATE
137   // 
138   
139   // Fields PRIVATE
140   //
141   
142   TDF_Label myLab;
143   
144 };
145
146 // other inline functions and methods (like "C++: function call" methods)
147 //
148
149
150 #endif