Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
XAO_Group.hxx
Go to the documentation of this file.
1 // Copyright (C) 2013-2016 CEA/DEN, EDF R&D, 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(const XAO::Dimension& dim, const int& nbElements, const std::string& name = std::string(""))
48  throw (XAO_Exception);
49 
53  virtual ~Group();
54 
59  const std::string getName()
60  {
61  return m_name;
62  }
67  void setName(const std::string& name)
68  {
69  m_name = name;
70  }
71 
76  const XAO::Dimension getDimension()
77  {
78  return m_dimension;
79  }
80 
85  const int getNbElements()
86  {
87  return m_nbElements;
88  }
89 
94  const int count() const
95  {
96  return m_elements.size();
97  }
98 
105  const int get(const int& index)
106  {
107  checkIndex(index);
108  std::set<int>::iterator it = m_elements.begin();
109  std::advance(it, index);
110  return (*it);
111  }
112 
117  void add(const int& value);
118 
123  void remove(const int& value);
124 
129  std::set<int>::iterator begin() { return m_elements.begin(); }
130 
135  std::set<int>::iterator end() { return m_elements.end(); }
136 
137  private:
143  void checkIndex(const int& element)
144  throw (XAO_Exception);
145 
146  private:
148  std::string m_name;
154  int m_count;
156  std::set<int> m_elements;
157  };
158 }
159 
160 #endif