Version: 9.12.0
XAO_GeometricElement.hxx
Go to the documentation of this file.
1 // Copyright (C) 2013-2023 CEA, EDF, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 // Author : Frederic Pons (OpenCascade)
20 
21 #ifndef __XAO_GEOMETRICELEMENT_HXX__
22 #define __XAO_GEOMETRICELEMENT_HXX__
23 
24 #include <string>
25 #include <map>
26 
27 #include "XAO.hxx"
28 #include "XAO_Exception.hxx"
29 
30 #ifdef WIN32
31 #pragma warning(disable:4290) // Warning Exception ...
32 #pragma warning(disable:4251) // Warning dll-interface ...
33 #endif
34 
35 
36 namespace XAO
37 {
43  {
44  public:
54  GeometricElement(const std::string& name, const std::string& reference);
58  virtual ~GeometricElement();
59 
64  const std::string getName()
65  {
66  return m_name;
67  }
72  void setName(const std::string& name)
73  {
74  m_name = name;
75  }
76 
81  bool hasName();
82 
87  const std::string getReference()
88  {
89  return m_reference;
90  }
95  void setReference(const std::string& reference)
96  {
97  m_reference = reference;
98  }
99 
100  private:
102  std::string m_name;
104  std::string m_reference;
105  };
106 
112  {
113  public:
118 
123  GeometricElementList(int nb);
124 
129 
134  int getSize() const { return m_count; }
135 
141  void setSize(int nb);
142 
150  void setElement(int index, const std::string& name, const std::string& reference);
157  const std::string getName(int index);
164  void setName(int index, const std::string& name);
165 
171  bool hasName(int index);
172 
179  const std::string getReference(int index);
186  void setReference(int index, const std::string& reference);
187 
193  int getIndexByReference(const std::string& reference);
194 
198  typedef std::map<int, GeometricElement>::iterator iterator;
199 
204  iterator begin() { return m_elements.begin(); }
205 
210  iterator end() { return m_elements.end(); }
211 
212  private:
213  void checkElementIndex(int index) const;
214 
215  private:
216  int m_count;
217  std::map<int, GeometricElement> m_elements;
218  };
219 }
220 
221 #endif /* __XAO_GEOMETRICELEMENT_HXX__ */
static std::string getName(GEOM::GEOM_BaseObject_ptr object)
Definition: GEOM_Displayer.cxx:469
#define XAO_EXPORT
Definition: XAO.hxx:31
Generic class to manipulate a list of topologic element.
Definition: XAO_GeometricElement.hxx:112
iterator begin()
Gets an iterator on the first element.
Definition: XAO_GeometricElement.hxx:204
std::map< int, GeometricElement >::iterator iterator
Iterator on the element of the list.
Definition: XAO_GeometricElement.hxx:198
int m_count
Definition: XAO_GeometricElement.hxx:216
int getSize() const
Gets the size of the list.
Definition: XAO_GeometricElement.hxx:134
iterator end()
Gets an iterator on the last element.
Definition: XAO_GeometricElement.hxx:210
std::map< int, GeometricElement > m_elements
Definition: XAO_GeometricElement.hxx:217
virtual ~GeometricElementList()
Destructor.
Definition: XAO_GeometricElement.hxx:128
Generic class to manipulate a topologic element (vertex, edge, face or solid).
Definition: XAO_GeometricElement.hxx:43
const std::string getReference()
Gets the reference of the element.
Definition: XAO_GeometricElement.hxx:87
void setName(const std::string &name)
Sets the name of the element.
Definition: XAO_GeometricElement.hxx:72
std::string m_name
The name of the element.
Definition: XAO_GeometricElement.hxx:102
std::string m_reference
The reference of the element.
Definition: XAO_GeometricElement.hxx:104
const std::string getName()
Gets the name of the element.
Definition: XAO_GeometricElement.hxx:64
void setReference(const std::string &reference)
Sets the reference of the element.
Definition: XAO_GeometricElement.hxx:95
Definition: BrepGeometryTest.hxx:26