Version: 9.12.0
XAO_Group.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 : Nathalie Gore (OpenCascade), Frederic Pons (OpenCascade)
20 
21 #ifndef __XAO_GROUP_HXX__
22 #define __XAO_GROUP_HXX__
23 
24 #include <string>
25 #include <set>
26 
27 #include "XAO.hxx"
28 #include "XAO_XaoUtils.hxx"
29 #ifdef WIN32
30 #pragma warning(disable:4251) // Warning dll-interface ...
31 #endif
32 namespace XAO
33 {
39  {
40  public:
47  Group(XAO::Dimension dim, int nbElements, const std::string& name = std::string(""));
48 
52  virtual ~Group();
53 
58  const std::string getName()
59  {
60  return m_name;
61  }
66  void setName(const std::string& name)
67  {
68  m_name = name;
69  }
70 
76  {
77  return m_dimension;
78  }
79 
85  {
86  return m_nbElements;
87  }
88 
93  int count() const
94  {
95  return m_elements.size();
96  }
97 
104  int get(int index)
105  {
106  checkIndex(index);
107  std::set<int>::iterator it = m_elements.begin();
108  std::advance(it, index);
109  return (*it);
110  }
111 
116  void add(int value);
117 
122  void remove(int value);
123 
128  std::set<int>::iterator begin() { return m_elements.begin(); }
129 
134  std::set<int>::iterator end() { return m_elements.end(); }
135 
136  private:
142  void checkIndex(int element);
143 
144  private:
146  std::string m_name;
152  int m_count;
154  std::set<int> m_elements;
155  };
156 }
157 
158 #endif
#define XAO_EXPORT
Definition: XAO.hxx:31
Class to represent a Geometrical Group.
Definition: XAO_Group.hxx:39
int m_count
The number of elements in the group.
Definition: XAO_Group.hxx:152
XAO::Dimension getDimension()
Gets the dimension of the group.
Definition: XAO_Group.hxx:75
int count() const
Gets the number of elements in the group.
Definition: XAO_Group.hxx:93
void setName(const std::string &name)
Sets the name of the group.
Definition: XAO_Group.hxx:66
const std::string getName()
Gets the name of the group.
Definition: XAO_Group.hxx:58
int get(int index)
Gets the reference of an element.
Definition: XAO_Group.hxx:104
std::string m_name
The name of the group.
Definition: XAO_Group.hxx:146
XAO::Dimension m_dimension
The dimension of the group.
Definition: XAO_Group.hxx:150
std::set< int > m_elements
The elements of the group.
Definition: XAO_Group.hxx:154
std::set< int >::iterator end()
Gets an iterator on the last element in the group.
Definition: XAO_Group.hxx:134
int getNbElements()
Gets the numbers of elements in the geometry of the same type than the group.
Definition: XAO_Group.hxx:84
int m_nbElements
The number of elements in the associated geometry.
Definition: XAO_Group.hxx:148
std::set< int >::iterator begin()
Gets an iterator on the first element in the group.
Definition: XAO_Group.hxx:128
Definition: BrepGeometryTest.hxx:26
Dimension
Definition: XAO_XaoUtils.hxx:50