Container.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2006 by Basler Vision Technologies
00003 //  Section:  Vision Components
00004 //  Project:  GenApi
00005 //    Author:  Alex Happe
00006 //  $Header$
00007 //
00008 //  License: This file is published under the license of the EMVA GenICam  Standard Group.
00009 //  A text file describing the legal terms is included in  your installation as 'GenICam_license.pdf'.
00010 //  If for some reason you are missing  this file please contact the EMVA or visit the website
00011 //  (http://www.genicam.org) for a full copy.
00012 //
00013 //  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
00014 //  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00015 //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016 //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD  GROUP
00017 //  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,
00018 //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED TO,
00019 //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS;
00020 //  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  THEORY OF LIABILITY,
00021 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)
00022 //  ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023 //  POSSIBILITY OF SUCH DAMAGE.
00024 //-----------------------------------------------------------------------------
00031 #ifndef GENICAM_GENAPI_NODEVECTOR_H
00032 #define GENICAM_GENAPI_NODEVECTOR_H
00033 
00034 
00035 #include <GenApi/GenApiDll.h>
00036 #include <GenICamFwd.h>
00037 
00038 #include <vector>
00039 
00040 #ifndef _WIN32
00041 #    include <stdint.h>
00042 #endif
00043 
00044 #if defined ( __GNUC__ ) && !defined (VXWORKS) && !defined ( __APPLE__ )
00045   using namespace __gnu_cxx;
00046 #endif
00047 
00048 #if defined ( __GNUC__ ) && defined ( __linux__)
00049 #    include <cstddef>
00050 #endif
00051 
00052 #if defined (_WIN32) || (defined (__GNUC__) && (defined (__linux__) || defined (__APPLE__) || defined(VXWORKS)))
00053 
00054 // conversion from 'uintptr_t' to 'void *' of greater size
00055 // This is a portability warning
00056 #ifdef _MSC_VER
00057 #   pragma warning( disable : 4312 )
00058 #endif
00059 
00060 namespace GENAPI_NAMESPACE
00061 {
00062     struct INode;
00063     struct IValue;
00064 
00065 
00066     //*************************************************************
00067     // N O D E _ V E C T O R
00068     //*************************************************************
00069 
00074     class GENAPI_DECL node_vector
00075     {
00076         typedef INode* T;
00077 
00078         // Nested types
00079         // ---------------------------------------------------------------------------
00080     public:
00081         class GENAPI_DECL const_iterator
00082         {
00083             // iterator traits
00084             // ------------------------------------------------------------------------
00085         public:
00086             typedef std::random_access_iterator_tag iterator_category;
00087             typedef T value_type;
00088             typedef ptrdiff_t difference_type;
00089             typedef T* pointer;
00090             typedef T& reference;
00091             // Ctor / Dtor
00092             // -------------------------------------------------------------------------
00093         public:
00094             const_iterator    ( T *pPtr = 0 );
00095 
00096             // Operators
00097             // -------------------------------------------------------------------------
00098         public:
00099             const T &               operator *        ( void )                  const;
00100             const_iterator &        operator ++       ( void );
00101             const_iterator          operator ++       ( int );
00102             const_iterator &        operator --       ( void );
00103             const_iterator          operator --       ( int );
00104             const_iterator &        operator +=       ( intptr_t iInc );
00105             const_iterator          operator +=       ( intptr_t iInc )         const;
00106             const_iterator          operator +        ( intptr_t iInc )         const;
00107             const_iterator &        operator -=       ( intptr_t iDec );
00108             const_iterator          operator -=       ( intptr_t iDec )         const;
00109             intptr_t                operator -        ( const const_iterator &iter ) const;
00110             const_iterator          operator -        ( intptr_t iDec )         const;
00111             const T &               operator []       ( intptr_t iIndex )       const;
00112             bool                    operator ==       ( const const_iterator &iter ) const;
00113             bool                    operator !=       ( const const_iterator &iter ) const;
00114             bool                    operator <        ( const const_iterator &iter ) const;
00115             bool                    operator >        ( const const_iterator &iter ) const;
00116             bool                    operator <=       ( const const_iterator &iter ) const;
00117             bool                    operator >=       ( const const_iterator &iter ) const;
00118             GENAPI_DECL
00119             friend const_iterator   operator +        ( intptr_t iInc, const const_iterator &iter);
00120 
00121             // Member
00122             // -------------------------------------------------------------------------
00123         protected:
00124             T *              _ps;
00125         };
00126 
00127         class GENAPI_DECL iterator :
00128             public const_iterator
00129         {
00130         public:
00131             // iterator traits
00132             // -------------------------------------------------------------------------
00133             typedef std::random_access_iterator_tag iterator_category;
00134             typedef T value_type;
00135             typedef const_iterator::difference_type difference_type;
00136             typedef const_iterator::pointer pointer;
00137             typedef const_iterator::reference reference;
00138             // Ctor / Dtor
00139             // -------------------------------------------------------------------------
00140         public:
00141                                     iterator          ( T *pPtr = 0 );
00142 
00143             // Operators
00144             // -------------------------------------------------------------------------
00145         public:
00146             T &                     operator *        ( void )                  const;
00147             iterator &              operator ++       ( void );
00148             iterator                operator ++       ( int );
00149             iterator &              operator --       ( void );
00150             iterator                operator --       ( int );
00151             iterator &              operator +=       ( intptr_t iInc );
00152             iterator                operator +=       ( intptr_t iInc )         const;
00153             iterator                operator +        ( intptr_t iInc )         const;
00154             iterator &              operator -=       ( intptr_t iDec );
00155             iterator                operator -=       ( intptr_t iDec )         const;
00156             intptr_t                operator -        ( const iterator &iter )  const;
00157             iterator                operator -        ( intptr_t iDec )         const;
00158             T &                     operator []       ( intptr_t iIndex )       const;
00159             GENAPI_DECL
00160             friend iterator     operator +        ( intptr_t iInc, const iterator &iter);
00161         };
00162 
00163         // Ctor / Dtor
00164         // ---------------------------------------------------------------------------
00165     public:
00166                                   node_vector       ( void );
00167         explicit                  node_vector       ( size_t uiSize);
00168                                   node_vector       ( const node_vector &obj);
00169         virtual                   ~node_vector      ( void );
00170 
00171         // Element access
00172         // ---------------------------------------------------------------------------
00173     public:
00174         virtual void              assign            ( size_t n, const T &val );
00175         virtual void              clear             ( void );
00176         virtual iterator          erase             ( iterator pos );
00177         virtual T &               at                ( size_t uiIndex );
00178         virtual const T &         at                ( size_t uiIndex )        const;
00179         virtual T &               back              ( void );
00180         virtual const T &         back              ( void )                  const;
00181         virtual iterator          begin             ( void );
00182         virtual const_iterator    begin             ( void )                  const;
00183         virtual size_t            capacity          ( void )                  const;
00184         virtual iterator          end               ( void );
00185         virtual const_iterator    end               ( void )                  const;
00186         virtual T &               front             ( void );
00187         virtual const T &         front             ( void )                  const;
00188         virtual size_t            max_size          ( void )                  const;
00189         virtual size_t            size              ( void )                  const;
00190         virtual iterator          insert            ( iterator pos,  const T& val) ;
00191         virtual bool              empty             ( void )                  const;
00192         virtual void              pop_back          ( void );
00193         virtual void              push_back         ( const T &val );
00194         virtual void              resize            ( size_t uiSize );
00195         virtual void              reserve           ( size_t uiSize );
00196 
00197         // Do not use - only left in for backwards compatibility!
00198         virtual void              erase             (size_t uiIndex);
00199         virtual void              insert            (size_t uiIndex, const T &val);
00200 
00201 // Operators
00202         // ---------------------------------------------------------------------------
00203     public:
00204         node_vector &             operator =        ( const node_vector &obj );
00205         T &                       operator []       ( size_t uiIndex );
00206         const T &                 operator []       ( size_t uiIndex )        const;
00207         void                      operator delete   ( void *pWhere );
00208         void *                    operator new      ( size_t uiSize );
00209 
00210         // Member
00211         // ---------------------------------------------------------------------------
00212     private:
00213        typedef std::vector<T, std::allocator<T> > vector_t;
00214        vector_t *_pv;
00215     };
00216 
00217 
00218 
00219     //*************************************************************
00220     // V A L U E _ V E C T O R
00221     //*************************************************************
00222 
00227     class GENAPI_DECL value_vector
00228     {
00229         typedef IValue* T;
00230         // Nested types
00231         // ---------------------------------------------------------------------------
00232     public:
00233         class GENAPI_DECL const_iterator
00234         {
00235             // iterator traits
00236             // ------------------------------------------------------------------------
00237         public:
00238             typedef std::random_access_iterator_tag iterator_category;
00239             typedef T value_type;
00240             typedef ptrdiff_t difference_type;
00241             typedef T* pointer;
00242             typedef T& reference;
00243 
00244             // Ctor / Dtor
00245             // -------------------------------------------------------------------------
00246         public:
00247             const_iterator    ( T *pPtr = 0 );
00248 
00249             // Operators
00250             // -------------------------------------------------------------------------
00251         public:
00252             const T &               operator *        ( void )                  const;
00253             const_iterator &        operator ++       ( void );
00254             const_iterator          operator ++       ( int );
00255             const_iterator &        operator --       ( void );
00256             const_iterator          operator --       ( int );
00257             const_iterator &        operator +=       ( intptr_t iInc );
00258             const_iterator          operator +=       ( intptr_t iInc )         const;
00259             const_iterator          operator +        ( intptr_t iInc )         const;
00260             const_iterator &        operator -=       ( intptr_t iDec );
00261             const_iterator          operator -=       ( intptr_t iDec )         const;
00262             intptr_t                operator -        ( const const_iterator &iter ) const;
00263             const_iterator          operator -        ( intptr_t iDec )         const;
00264             const T &               operator []       ( intptr_t iIndex )       const;
00265             bool                    operator ==       ( const const_iterator &iter ) const;
00266             bool                    operator !=       ( const const_iterator &iter ) const;
00267             bool                    operator <        ( const const_iterator &iter ) const;
00268             bool                    operator >        ( const const_iterator &iter ) const;
00269             bool                    operator <=       ( const const_iterator &iter ) const;
00270             bool                    operator >=       ( const const_iterator &iter ) const;
00271             GENAPI_DECL
00272             friend const_iterator   operator +        ( intptr_t iInc, const const_iterator &iter);
00273 
00274             // Member
00275             // -------------------------------------------------------------------------
00276         protected:
00277             T *              _ps;
00278         };
00279 
00280         class GENAPI_DECL iterator :
00281             public const_iterator
00282         {
00283         public:
00284             // iterator traits
00285             // -------------------------------------------------------------------------
00286             typedef std::random_access_iterator_tag iterator_category;
00287             typedef T value_type;
00288             typedef const_iterator::difference_type difference_type;
00289             typedef const_iterator::pointer pointer;
00290             typedef const_iterator::reference reference;
00291             // Ctor / Dtor
00292             // -------------------------------------------------------------------------
00293         public:
00294             iterator          ( T *pPtr = 0 );
00295 
00296             // Operators
00297             // -------------------------------------------------------------------------
00298         public:
00299             T &                     operator *        ( void )                  const;
00300             iterator &              operator ++       ( void );
00301             iterator                operator ++       ( int );
00302             iterator &              operator --       ( void );
00303             iterator                operator --       ( int );
00304             iterator &              operator +=       ( intptr_t iInc );
00305             iterator                operator +=       ( intptr_t iInc )         const;
00306             iterator                operator +        ( intptr_t iInc )         const;
00307             iterator &              operator -=       ( intptr_t iDec );
00308             iterator                operator -=       ( intptr_t iDec )         const;
00309             intptr_t                operator -        ( const iterator &iter )  const;
00310             iterator                operator -        ( intptr_t iDec )         const;
00311             T &                     operator []       ( intptr_t iIndex )       const;
00312             GENAPI_DECL
00313             friend iterator         operator +        ( intptr_t iInc, const iterator &iter);
00314         };
00315 
00316         // Ctor / Dtor
00317         // ---------------------------------------------------------------------------
00318     public:
00319         value_vector   ( void );
00320         explicit                  value_vector   ( size_t uiSize);
00321         value_vector   ( const value_vector &obj);
00322         virtual                   ~value_vector  ( void );
00323 
00324         // Element access
00325         // ---------------------------------------------------------------------------
00326     public:
00327         virtual void              assign            ( size_t n, const T &obj );
00328         virtual void              clear             ( void );
00329         virtual iterator          erase             ( iterator pos );
00330         virtual T &               at                ( size_t uiIndex );
00331         virtual const T &         at                ( size_t uiIndex )        const;
00332         virtual T &               back              ( void );
00333         virtual const T &         back              ( void )                  const;
00334         virtual iterator          begin             ( void );
00335         virtual const_iterator    begin             ( void )                  const;
00336         virtual size_t            capacity          ( void )                  const;
00337         virtual iterator          end               ( void );
00338         virtual const_iterator    end               ( void )                  const;
00339         virtual T &               front             ( void );
00340         virtual const T &         front             ( void )                  const;
00341         virtual size_t            max_size          ( void )                  const;
00342         virtual size_t            size              ( void )                  const;
00343         virtual iterator          insert            ( iterator pos,  const T& val) ;
00344         virtual bool              empty             ( void )                  const;
00345         virtual void              pop_back          ( void );
00346         virtual void              push_back         ( const T &val );
00347         virtual void              resize            ( size_t uiSize, const T &val );
00348         virtual void              reserve           ( size_t uiSize );
00349 
00350 
00351         // Do not use - only left in for backwards compatibility!
00352         virtual void              erase             (size_t uiIndex);
00353         virtual void              insert            (size_t uiIndex, const T &val);
00354 
00355 // Operators
00356         // ---------------------------------------------------------------------------
00357     public:
00358         value_vector &            operator =        ( const value_vector &obj );
00359         T &                       operator []       ( size_t uiIndex );
00360         const T &                 operator []       ( size_t uiIndex )        const;
00361         void                      operator delete   ( void *pWhere );
00362         void *                    operator new      ( size_t uiSize );
00363 
00364         // Member
00365         // ---------------------------------------------------------------------------
00366     private:
00367        typedef std::vector<T, std::allocator<T> > vector_t;
00368        vector_t *_pv;
00369     };
00370 
00372     typedef value_vector FeatureList_t;
00373 } // namespace GenApi;
00374 
00375 
00376 #else
00377 #   error Unknown platform
00378 #endif
00379 
00380 #endif // GENICAM_GENAPI_NODEVECTOR_H


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 18:42:46