aimsdata  4.7.0
Neuroimaging data handling
selection.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef AIMS_SELECTION_SELECTION_H
35 #define AIMS_SELECTION_SELECTION_H
36 
37 
38 #include <string>
39 #include <list>
40 
41 
42 namespace aims
43 {
44 
45  class Selection
46  {
47  public:
48  typedef std::list<std::string>::value_type value_type;
49  typedef std::list<std::string>::pointer pointer;
50  typedef std::list<std::string>::const_pointer const_pointer;
51  typedef std::list<std::string>::reference reference;
52  typedef std::list<std::string>::const_reference const_reference;
53 
54  typedef std::list<std::string>::difference_type difference_type;
55  typedef std::list<std::string>::size_type size_type;
56 
57  typedef std::list<std::string>::iterator iterator;
58  typedef std::list<std::string>::const_iterator const_iterator;
59  typedef std::list<std::string>::reverse_iterator reverse_iterator;
60  typedef std::list<std::string>::const_reverse_iterator
62 
63  iterator begin();
64  iterator end();
65  const_iterator begin() const;
66  const_iterator end() const;
67  reverse_iterator rbegin();
68  reverse_iterator rend();
71 
72  Selection();
73  Selection( const std::string & selname );
74  void select( const std::string& label );
75  void selectQuick( const std::string& label );
76  void unselect( const std::string& label );
77  iterator find( const std::string & label );
78  const_iterator find( const std::string & label ) const;
79  bool empty() const;
80  std::string name() const;
81 
82  private:
83  std::list<std::string> my_labels;
84  std::string my_name;
85  };
86 
87 
89  {
90  public:
91  typedef std::list<Selection>::value_type value_type;
92  typedef std::list<Selection>::pointer pointer;
93  typedef std::list<Selection>::const_pointer const_pointer;
94  typedef std::list<Selection>::reference reference;
95  typedef std::list<Selection>::const_reference const_reference;
96 
97  typedef std::list<Selection>::difference_type difference_type;
98  typedef std::list<Selection>::size_type size_type;
99 
100  typedef std::list<Selection>::iterator iterator;
101  typedef std::list<Selection>::const_iterator const_iterator;
102  typedef std::list<Selection>::reverse_iterator reverse_iterator;
103  typedef std::list<Selection>::const_reverse_iterator
105 
106  iterator begin();
107  iterator end();
108  const_iterator begin() const;
109  const_iterator end() const;
110  reverse_iterator rbegin();
111  reverse_iterator rend();
114 
115  void addSelection( const Selection& selection, bool enabledups = false );
116  void deleteSelection( Selection* );
117  void deleteSelection( iterator i );
118  void load( const std::string & filename );
119  void append( const std::string & filename );
120  void save( const std::string & filename ) const;
121  const_iterator findSelection( const Selection & ) const;
122  iterator findSelection( const Selection & );
123  iterator findSelection( const std::string & );
124  const_iterator findSelection( const std::string & ) const;
125  bool empty() const;
126 
127  private:
128  std::list<Selection> my_selections;
129  };
130 
131 
132 } // namespace aims
133 
134 
135 inline
137 {
138  return my_labels.begin();
139 }
140 
141 
142 inline
144 {
145  return my_labels.end();
146 }
147 
148 
149 inline
151 {
152  return my_labels.begin();
153 }
154 
155 
156 inline
158 {
159  return my_labels.end();
160 }
161 
162 
163 inline
165 {
166  return my_labels.rbegin();
167 }
168 
169 
170 inline
172 {
173  return my_labels.rend();
174 }
175 
176 
177 inline
179 {
180  return my_labels.rbegin();
181 }
182 
183 
184 inline
186 {
187  return my_labels.rend();
188 }
189 
190 
191 inline
193 {
194  return my_selections.begin();
195 }
196 
197 
198 inline
200 {
201  return my_selections.end();
202 }
203 
204 
205 inline
207 {
208  return my_selections.begin();
209 }
210 
211 
212 inline
214 {
215  return my_selections.end();
216 }
217 
218 
219 inline
221 {
222  return my_selections.rbegin();
223 }
224 
225 
226 inline
228 {
229  return my_selections.rend();
230 }
231 
232 
233 inline
235 {
236  return my_selections.rbegin();
237 }
238 
239 
240 inline
242 {
243  return my_selections.rend();
244 }
245 
246 
247 #endif
std::list< std::string >::size_type size_type
Definition: selection.h:55
std::list< std::string >::difference_type difference_type
Definition: selection.h:54
std::list< Selection >::reverse_iterator reverse_iterator
Definition: selection.h:102
std::list< std::string >::const_iterator const_iterator
Definition: selection.h:58
iterator begin()
Definition: selection.h:192
std::list< std::string >::const_reference const_reference
Definition: selection.h:52
std::list< std::string >::const_pointer const_pointer
Definition: selection.h:50
void unselect(const std::string &label)
reverse_iterator rbegin()
Definition: selection.h:220
std::list< Selection >::const_iterator const_iterator
Definition: selection.h:101
std::list< std::string >::value_type value_type
Definition: selection.h:48
bool empty() const
std::list< Selection >::value_type value_type
Definition: selection.h:91
std::list< Selection >::size_type size_type
Definition: selection.h:98
std::string name() const
The class for EcatSino data write operation.
Definition: border.h:42
std::list< Selection >::reference reference
Definition: selection.h:94
std::list< Selection >::const_reverse_iterator const_reverse_iterator
Definition: selection.h:104
reverse_iterator rend()
Definition: selection.h:171
std::list< std::string >::reference reference
Definition: selection.h:51
std::list< Selection >::const_reference const_reference
Definition: selection.h:95
std::list< std::string >::iterator iterator
Definition: selection.h:57
reverse_iterator rend()
Definition: selection.h:227
iterator end()
Definition: selection.h:199
iterator find(const std::string &label)
std::list< std::string >::reverse_iterator reverse_iterator
Definition: selection.h:59
std::list< Selection >::iterator iterator
Definition: selection.h:100
void select(const std::string &label)
iterator begin()
Definition: selection.h:136
std::list< std::string >::const_reverse_iterator const_reverse_iterator
Definition: selection.h:61
reverse_iterator rbegin()
Definition: selection.h:164
void selectQuick(const std::string &label)
iterator end()
Definition: selection.h:143
std::list< std::string >::pointer pointer
Definition: selection.h:49
std::list< Selection >::const_pointer const_pointer
Definition: selection.h:93
std::list< Selection >::difference_type difference_type
Definition: selection.h:97
std::list< Selection >::pointer pointer
Definition: selection.h:92