Container.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 by Basler Vision Technologies
3 // Section: Vision Components
4 // Project: GenApi
5 // Author: Alex Happe
6 // $Header$
7 //
8 // License: This file is published under the license of the EMVA GenICam Standard Group.
9 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
10 // If for some reason you are missing this file please contact the EMVA or visit the website
11 // (http://www.genicam.org) for a full copy.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
14 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
17 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 // POSSIBILITY OF SUCH DAMAGE.
24 //-----------------------------------------------------------------------------
31 #ifndef GENICAM_GENAPI_NODEVECTOR_H
32 #define GENICAM_GENAPI_NODEVECTOR_H
33 
34 
35 #include <GenApi/GenApiDll.h>
36 #include <GenICamFwd.h>
37 
38 #include <vector>
39 
40 #ifndef _WIN32
41 # include <stdint.h>
42 #endif
43 
44 #if defined ( __GNUC__ ) && !defined (VXWORKS) && !defined ( __APPLE__ )
45  using namespace __gnu_cxx;
46 #endif
47 
48 #if defined ( __GNUC__ ) && defined ( __linux__)
49 # include <cstddef>
50 #endif
51 
52 #if defined (_WIN32) || (defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__) || defined(VXWORKS)))
53 
54 // conversion from 'uintptr_t' to 'void *' of greater size
55 // This is a portability warning
56 #ifdef _MSC_VER
57 # pragma warning( disable : 4312 )
58 #endif
59 
60 namespace GENAPI_NAMESPACE
61 {
62  struct INode;
63  struct IValue;
64 
65 
66  //*************************************************************
67  // N O D E _ V E C T O R
68  //*************************************************************
69 
74  class GENAPI_DECL node_vector
75  {
76  typedef INode* T;
77 
78  // Nested types
79  // ---------------------------------------------------------------------------
80  public:
81  class GENAPI_DECL const_iterator
82  {
83  // iterator traits
84  // ------------------------------------------------------------------------
85  public:
86  typedef std::random_access_iterator_tag iterator_category;
87  typedef T value_type;
88  typedef ptrdiff_t difference_type;
89  typedef T* pointer;
90  typedef T& reference;
91  // Ctor / Dtor
92  // -------------------------------------------------------------------------
93  public:
94  const_iterator ( T *pPtr = 0 );
95 
96  // Operators
97  // -------------------------------------------------------------------------
98  public:
99  const T & operator * ( void ) const;
100  const_iterator & operator ++ ( void );
101  const_iterator operator ++ ( int );
102  const_iterator & operator -- ( void );
103  const_iterator operator -- ( int );
104  const_iterator & operator += ( intptr_t iInc );
105  const_iterator operator += ( intptr_t iInc ) const;
106  const_iterator operator + ( intptr_t iInc ) const;
107  const_iterator & operator -= ( intptr_t iDec );
108  const_iterator operator -= ( intptr_t iDec ) const;
109  intptr_t operator - ( const const_iterator &iter ) const;
110  const_iterator operator - ( intptr_t iDec ) const;
111  const T & operator [] ( intptr_t iIndex ) const;
112  bool operator == ( const const_iterator &iter ) const;
113  bool operator != ( const const_iterator &iter ) const;
114  bool operator < ( const const_iterator &iter ) const;
115  bool operator > ( const const_iterator &iter ) const;
116  bool operator <= ( const const_iterator &iter ) const;
117  bool operator >= ( const const_iterator &iter ) const;
119  friend const_iterator operator + ( intptr_t iInc, const const_iterator &iter);
120 
121  // Member
122  // -------------------------------------------------------------------------
123  protected:
124  T * _ps;
125  };
126 
127  class GENAPI_DECL iterator :
128  public const_iterator
129  {
130  public:
131  // iterator traits
132  // -------------------------------------------------------------------------
133  typedef std::random_access_iterator_tag iterator_category;
134  typedef T value_type;
135  typedef const_iterator::difference_type difference_type;
136  typedef const_iterator::pointer pointer;
137  typedef const_iterator::reference reference;
138  // Ctor / Dtor
139  // -------------------------------------------------------------------------
140  public:
141  iterator ( T *pPtr = 0 );
142 
143  // Operators
144  // -------------------------------------------------------------------------
145  public:
146  T & operator * ( void ) const;
147  iterator & operator ++ ( void );
148  iterator operator ++ ( int );
149  iterator & operator -- ( void );
150  iterator operator -- ( int );
151  iterator & operator += ( intptr_t iInc );
152  iterator operator += ( intptr_t iInc ) const;
153  iterator operator + ( intptr_t iInc ) const;
154  iterator & operator -= ( intptr_t iDec );
155  iterator operator -= ( intptr_t iDec ) const;
156  intptr_t operator - ( const iterator &iter ) const;
157  iterator operator - ( intptr_t iDec ) const;
158  T & operator [] ( intptr_t iIndex ) const;
160  friend iterator operator + ( intptr_t iInc, const iterator &iter);
161  };
162 
163  // Ctor / Dtor
164  // ---------------------------------------------------------------------------
165  public:
166  node_vector ( void );
167  explicit node_vector ( size_t uiSize);
168  node_vector ( const node_vector &obj);
169  virtual ~node_vector ( void );
170 
171  // Element access
172  // ---------------------------------------------------------------------------
173  public:
174  virtual void assign ( size_t n, const T &val );
175  virtual void clear ( void );
176  virtual iterator erase ( iterator pos );
177  virtual T & at ( size_t uiIndex );
178  virtual const T & at ( size_t uiIndex ) const;
179  virtual T & back ( void );
180  virtual const T & back ( void ) const;
181  virtual iterator begin ( void );
182  virtual const_iterator begin ( void ) const;
183  virtual size_t capacity ( void ) const;
184  virtual iterator end ( void );
185  virtual const_iterator end ( void ) const;
186  virtual T & front ( void );
187  virtual const T & front ( void ) const;
188  virtual size_t max_size ( void ) const;
189  virtual size_t size ( void ) const;
190  virtual iterator insert ( iterator pos, const T& val) ;
191  virtual bool empty ( void ) const;
192  virtual void pop_back ( void );
193  virtual void push_back ( const T &val );
194  virtual void resize ( size_t uiSize );
195  virtual void reserve ( size_t uiSize );
196 
197  // Do not use - only left in for backwards compatibility!
198  virtual void erase (size_t uiIndex);
199  virtual void insert (size_t uiIndex, const T &val);
200 
201 // Operators
202  // ---------------------------------------------------------------------------
203  public:
204  node_vector & operator = ( const node_vector &obj );
205  T & operator [] ( size_t uiIndex );
206  const T & operator [] ( size_t uiIndex ) const;
207  void operator delete ( void *pWhere );
208  void * operator new ( size_t uiSize );
209 
210  // Member
211  // ---------------------------------------------------------------------------
212  private:
213  typedef std::vector<T, std::allocator<T> > vector_t;
214  vector_t *_pv;
215  };
216 
217 
218 
219  //*************************************************************
220  // V A L U E _ V E C T O R
221  //*************************************************************
222 
227  class GENAPI_DECL value_vector
228  {
229  typedef IValue* T;
230  // Nested types
231  // ---------------------------------------------------------------------------
232  public:
233  class GENAPI_DECL const_iterator
234  {
235  // iterator traits
236  // ------------------------------------------------------------------------
237  public:
238  typedef std::random_access_iterator_tag iterator_category;
239  typedef T value_type;
240  typedef ptrdiff_t difference_type;
241  typedef T* pointer;
242  typedef T& reference;
243 
244  // Ctor / Dtor
245  // -------------------------------------------------------------------------
246  public:
247  const_iterator ( T *pPtr = 0 );
248 
249  // Operators
250  // -------------------------------------------------------------------------
251  public:
252  const T & operator * ( void ) const;
253  const_iterator & operator ++ ( void );
254  const_iterator operator ++ ( int );
255  const_iterator & operator -- ( void );
256  const_iterator operator -- ( int );
257  const_iterator & operator += ( intptr_t iInc );
258  const_iterator operator += ( intptr_t iInc ) const;
259  const_iterator operator + ( intptr_t iInc ) const;
260  const_iterator & operator -= ( intptr_t iDec );
261  const_iterator operator -= ( intptr_t iDec ) const;
262  intptr_t operator - ( const const_iterator &iter ) const;
263  const_iterator operator - ( intptr_t iDec ) const;
264  const T & operator [] ( intptr_t iIndex ) const;
265  bool operator == ( const const_iterator &iter ) const;
266  bool operator != ( const const_iterator &iter ) const;
267  bool operator < ( const const_iterator &iter ) const;
268  bool operator > ( const const_iterator &iter ) const;
269  bool operator <= ( const const_iterator &iter ) const;
270  bool operator >= ( const const_iterator &iter ) const;
272  friend const_iterator operator + ( intptr_t iInc, const const_iterator &iter);
273 
274  // Member
275  // -------------------------------------------------------------------------
276  protected:
277  T * _ps;
278  };
279 
280  class GENAPI_DECL iterator :
281  public const_iterator
282  {
283  public:
284  // iterator traits
285  // -------------------------------------------------------------------------
286  typedef std::random_access_iterator_tag iterator_category;
287  typedef T value_type;
288  typedef const_iterator::difference_type difference_type;
289  typedef const_iterator::pointer pointer;
290  typedef const_iterator::reference reference;
291  // Ctor / Dtor
292  // -------------------------------------------------------------------------
293  public:
294  iterator ( T *pPtr = 0 );
295 
296  // Operators
297  // -------------------------------------------------------------------------
298  public:
299  T & operator * ( void ) const;
300  iterator & operator ++ ( void );
301  iterator operator ++ ( int );
302  iterator & operator -- ( void );
303  iterator operator -- ( int );
304  iterator & operator += ( intptr_t iInc );
305  iterator operator += ( intptr_t iInc ) const;
306  iterator operator + ( intptr_t iInc ) const;
307  iterator & operator -= ( intptr_t iDec );
308  iterator operator -= ( intptr_t iDec ) const;
309  intptr_t operator - ( const iterator &iter ) const;
310  iterator operator - ( intptr_t iDec ) const;
311  T & operator [] ( intptr_t iIndex ) const;
313  friend iterator operator + ( intptr_t iInc, const iterator &iter);
314  };
315 
316  // Ctor / Dtor
317  // ---------------------------------------------------------------------------
318  public:
319  value_vector ( void );
320  explicit value_vector ( size_t uiSize);
321  value_vector ( const value_vector &obj);
322  virtual ~value_vector ( void );
323 
324  // Element access
325  // ---------------------------------------------------------------------------
326  public:
327  virtual void assign ( size_t n, const T &obj );
328  virtual void clear ( void );
329  virtual iterator erase ( iterator pos );
330  virtual T & at ( size_t uiIndex );
331  virtual const T & at ( size_t uiIndex ) const;
332  virtual T & back ( void );
333  virtual const T & back ( void ) const;
334  virtual iterator begin ( void );
335  virtual const_iterator begin ( void ) const;
336  virtual size_t capacity ( void ) const;
337  virtual iterator end ( void );
338  virtual const_iterator end ( void ) const;
339  virtual T & front ( void );
340  virtual const T & front ( void ) const;
341  virtual size_t max_size ( void ) const;
342  virtual size_t size ( void ) const;
343  virtual iterator insert ( iterator pos, const T& val) ;
344  virtual bool empty ( void ) const;
345  virtual void pop_back ( void );
346  virtual void push_back ( const T &val );
347  virtual void resize ( size_t uiSize, const T &val );
348  virtual void reserve ( size_t uiSize );
349 
350 
351  // Do not use - only left in for backwards compatibility!
352  virtual void erase (size_t uiIndex);
353  virtual void insert (size_t uiIndex, const T &val);
354 
355 // Operators
356  // ---------------------------------------------------------------------------
357  public:
358  value_vector & operator = ( const value_vector &obj );
359  T & operator [] ( size_t uiIndex );
360  const T & operator [] ( size_t uiIndex ) const;
361  void operator delete ( void *pWhere );
362  void * operator new ( size_t uiSize );
363 
364  // Member
365  // ---------------------------------------------------------------------------
366  private:
367  typedef std::vector<T, std::allocator<T> > vector_t;
368  vector_t *_pv;
369  };
370 
372  typedef value_vector FeatureList_t;
373 } // namespace GenApi;
374 
375 
376 #else
377 # error Unknown platform
378 #endif
379 
380 #endif // GENICAM_GENAPI_NODEVECTOR_H
bool operator!=(const MyAlloc< T1 > &, const MyAlloc< T2 > &)
Definition: gcmemory.h:103
virtual void operator=(bool Value)
Set node value.
Definition: IBoolean.h:64
bool operator==(const MyAlloc< T1 > &, const MyAlloc< T2 > &)
Definition: gcmemory.h:98
#define GENAPI_DECL
Definition: GenApiDll.h:55
interface GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
Definition: IValue.h:61
Forward declarations for GenICam types.
virtual GENICAM_NAMESPACE::gcstring operator*()=0
Get string node value.
declspec&#39;s to be used for GenApi Windows dll
interface GENAPI_DECL_ABSTRACT INode
Interface common to all nodes.
Definition: INode.h:60
Part of the generic device API.
Definition: Autovector.h:48


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:53