anatomist  5.1.2
3D neuroimaging data viewer
globjectlist.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 ANA_MOBJECT_GLOBJECTLIST_H
35 #define ANA_MOBJECT_GLOBJECTLIST_H
36 
39 
40 namespace anatomist
41 {
42 
43  class GLObjectList : public GLMObject
44  {
45  public:
47  virtual ~GLObjectList();
48 
49  virtual int MType() const { return( AObject::LIST ); }
50 
51  virtual size_t size() const;
52  virtual iterator begin();
53  virtual const_iterator begin() const;
54  virtual iterator end();
55  virtual const_iterator end() const;
56  virtual void insert( AObject * );
57  virtual void insert( const carto::shared_ptr<AObject> &,
58  unsigned pos = 0 );
59  virtual void insert( AObject *, unsigned pos );
60  virtual const_iterator find( const AObject * ) const;
61  virtual void erase( iterator & );
62  virtual bool CanRemove( AObject *obj );
63 
64  protected:
66  typedef std::set<carto::shared_ptr<AObject> > datatype;
68  };
69 
70 
71  inline size_t GLObjectList::size() const
72  {
73  return( _data.size() );
74  }
75 
76 
78  {
79  return( iterator( new ObjectListIterator( _data.begin() ) ) );
80  }
81 
82 
84  {
85  return( const_iterator
86  ( new const_ObjectListIterator( _data.begin() ) ) );
87  }
88 
89 
91  {
92  return( iterator( new ObjectListIterator( _data.end() ) ) );
93  }
94 
95 
97  {
98  return( const_iterator( new const_ObjectListIterator( _data.end() ) ) );
99  }
100 
101 
102  inline void GLObjectList::insert( AObject * x )
103  {
106  _insertObject( x );
107  }
108 
109 }
110 
111 
112 #endif
113 
T * iterator
const T * const_iterator
Multi-object generic iterator.
Definition: MObject.h:115
Base Anatomist object (abstract)
Definition: Object.h:96
A Multi-object with OpenGL rendering capabilities.
Definition: glmobject.h:50
virtual iterator begin()
Definition: globjectlist.h:77
virtual void insert(AObject *)
Definition: globjectlist.h:102
virtual void insert(AObject *, unsigned pos)
virtual iterator end()
Definition: globjectlist.h:90
virtual void insert(const carto::shared_ptr< AObject > &, unsigned pos=0)
virtual int MType() const
Precise type of multi-object.
Definition: globjectlist.h:49
virtual void erase(iterator &)
virtual bool CanRemove(AObject *obj)
virtual size_t size() const
Definition: globjectlist.h:71
std::set< carto::shared_ptr< AObject > > datatype
Data storage type, to be redefined by children classes.
Definition: globjectlist.h:66
virtual const_iterator find(const AObject *) const
AIterator const_iterator
Definition: MObject.h:239
AIterator iterator
Definition: MObject.h:238
virtual void _insertObject(AObject *o)
must be called by all subclasses in their insert() implementation