anatomist  5.1.2
3D neuroimaging data viewer
globjectvector.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_GLOBJECTVECTOR_H
35 #define ANA_MOBJECT_GLOBJECTVECTOR_H
36 
39 
40 namespace anatomist
41 {
42 
43  class GLObjectVector : public GLMObject
44  {
45  public:
47  virtual ~GLObjectVector();
48 
49  virtual int MType() const { return( AObject::VECTOR ); }
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  int pos = -1 );
59  virtual void insert( AObject *, int pos );
60  virtual const_iterator find( const AObject * ) const;
62  virtual void erase( iterator & );
63  virtual bool CanRemove( AObject *obj );
64 
65  protected:
67  typedef std::list<carto::shared_ptr<AObject> > datatype;
69  };
70 
71 
72  inline size_t GLObjectVector::size() const
73  {
74  return( _data.size() );
75  }
76 
77 
79  {
80  return( iterator( new ObjectVectorIterator( _data.begin() ) ) );
81  }
82 
83 
85  {
86  return( const_iterator
87  ( new const_ObjectVectorIterator( _data.begin() ) ) );
88  }
89 
90 
92  {
93  return( iterator( new ObjectVectorIterator( _data.end() ) ) );
94  }
95 
96 
98  {
99  return( const_iterator( new const_ObjectVectorIterator( _data.end() ) ) );
100  }
101 
102 
103  inline void GLObjectVector::insert( AObject * x )
104  {
107  _insertObject( x );
108  }
109 
110 }
111 
112 
113 #endif
114 
115 
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 bool CanRemove(AObject *obj)
virtual iterator begin()
virtual void erase(iterator &)
std::list< carto::shared_ptr< AObject > > datatype
Data storage type, to be redefined by children classes.
virtual int MType() const
Precise type of multi-object.
virtual void insert(AObject *)
virtual const_iterator find(const AObject *) const
virtual const_iterator find(const carto::shared_ptr< AObject > &) const
virtual iterator end()
virtual void insert(const carto::shared_ptr< AObject > &, int pos=-1)
virtual void insert(AObject *, int pos)
virtual size_t size() 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