CEPS  24.01
Cardiac ElectroPhysiology Simulator
HoldsAttributes.cpp
Go to the documentation of this file.
1 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2  This file is part of CEPS.
3 
4  CEPS is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  CEPS 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
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with CEPS (see file LICENSE at root of project).
16  If not, see <https://www.gnu.org/licenses/>.
17 
18 
19  Copyright 2019-2024 Inria, Universite de Bordeaux
20 
21  Authors, in alphabetical order:
22 
23  Pierre-Elliott BECUE, Florian CARO, Yves COUDIERE(*), Andjela DAVIDOVIC,
24  Charlie DOUANLA-LONTSI, Marc FUENTES, Mehdi JUHOOR, Michael LEGUEBE(*),
25  Pauline MIGERDITICHAN, Valentin PANNETIER(*), Nejib ZEMZEMI.
26  * : currently active authors
27 
28 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
32 
34  m_attributes(attributes)
35 {}
36 
38  m_attributes({})
39 {
40  setAttributes(attributes);
41 }
42 
44  m_attributes({})
45 {
46  setAttributes(attributes,n);
47 }
48 
51 {
52  return m_attributes.size();
53 }
54 
57 {
58  return m_attributes;
59 }
60 
63 {
64  return m_attributes;
65 }
66 
67 void
69 {
70  return setAttributes(attributes.begin(),attributes.end());
71 }
72 
73 void
75 {
76  return setAttributes(attributes.begin(),attributes.end());
77 }
78 
79 void
81 {
82  return setAttributes(attributes,attributes+n);
83 }
84 
85 void
87 {
88  m_attributes.insert(name);
89  return;
90 }
91 
92 void
94 {
95  return addAttributes(attributes.begin(),attributes.end());
96 }
97 
98 void
100 {
101  return addAttributes(attributes.begin(),attributes.end());
102 }
103 
104 void
106 {
107  return addAttributes(attributes,attributes+n);
108 }
109 
110 void
112 {
113  m_attributes.erase(name);
114  return;
115 }
116 
117 void
119 {
120  return removeAttributes(attributes.begin(),attributes.end());
121 }
122 
123 void
125 {
126  return removeAttributes(attributes.begin(),attributes.end());
127 }
128 
129 void
131 {
132  return removeAttributes(attributes,attributes+n);
133 }
134 
135 void
137 {
138  m_attributes.clear();
139  return;
140 }
141 
142 CepsBool
144 {
145  return m_attributes.contains(name);
146 }
147 
148 CepsBool
150 {
151  return hasAllAttributes(attributes.begin(), attributes.end());
152 }
153 
154 CepsBool
156 {
157  return hasAllAttributes(attributes, attributes+n);
158 }
159 
160 CepsBool
162 {
163  return hasOneOfAttributes(attributes.begin(), attributes.end());
164 }
165 
166 CepsBool
168 {
169  return hasOneOfAttributes(attributes.begin(), attributes.end());
170 }
171 
172 CepsBool
174 {
175  return hasOneOfAttributes (Attributes, Attributes + n);
176 }
177 
178 CepsBool
180 {
181  return hasAttribute(CepsUniversal);
182 }
183 
184 void
186 {
187  clearAttributes();
188  return;
189 }
std::set< _Type, _Compare, _Alloc > CepsSet
C++ set.
Definition: CepsTypes.hpp:209
std::vector< _Type, _Alloc > CepsVector
C++ vector.
Definition: CepsTypes.hpp:155
bool CepsBool
Booleans.
Definition: CepsTypes.hpp:124
CepsInt CepsAttribute
Used to define regions.
Definition: CepsTypes.hpp:215
std::make_unsigned_t< CepsInt > CepsUInt
Unsigned version on CepsInt.
Definition: CepsTypes.hpp:109
constexpr CepsAttribute CepsUniversal
This attribute means "everywhere".
Definition: CepsTypes.hpp:232
CepsBool hasAllAttributes(const CepsVector< CepsAttribute > &attributes) const
Tells if the entity has all the attributes in argument.
void addAttribute(const CepsAttribute &name)
Adds an attribute to the entity.
CepsBool hasOneOfAttributes(const CepsSet< CepsAttribute > &attributes) const
Tells if the entity has one of the attributes in argument.
void clearAttributes()
Removes all attributes from the entity.
void setAttributes(const CepsVector< CepsAttribute > &attributes)
Sets the attributes of the entity.
void addAttributes(const CepsVector< CepsAttribute > &attributes)
Adds several attributes to the entity.
void reset()
Equivalent to HoldsAttributes::clear()
CepsBool hasAttribute(const CepsAttribute &name) const
Tells if the entity has the attribute in argument.
CepsBool hasUniversalAttribute() const
Detect if the current entity has the attribute universal.
CepsSet< CepsAttribute > & getAttributes()
Returns the attributes of the entity.
void removeAttributes(const CepsSet< CepsAttribute > &attributes)
Removes several attributes from the entity.
HoldsAttributes()=default
Default constructor.
void removeAttribute(const CepsAttribute &name)
Removes an attribute from the entity.
CepsUInt getNumberOfAttributes() const
Returns number of attributes of the entity.