VectorWrapper.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2014 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #ifndef ICL_CORE_VECTOR_WRAPPER_H_INCLUDED
00024 #define ICL_CORE_VECTOR_WRAPPER_H_INCLUDED
00025 
00029 #define ICL_CORE_WRAP_VECTOR_HEADER(TWrapper, TVector, access, wrapped) \
00030   typedef TVector::value_type value_type;                               \
00031   typedef TVector::allocator_type allocator_type;                       \
00032   typedef TVector::size_type size_type;                                 \
00033   typedef TVector::difference_type difference_type;                     \
00034   typedef TVector::reference reference;                                 \
00035   typedef TVector::const_reference const_reference;                     \
00036   typedef TVector::pointer pointer;                                     \
00037   typedef TVector::const_pointer const_pointer;                         \
00038   typedef TVector::iterator iterator;                                   \
00039   typedef TVector::const_iterator const_iterator;                       \
00040   typedef TVector::reverse_iterator reverse_iterator;                   \
00041   typedef TVector::const_reverse_iterator const_reverse_iterator
00042 
00043 
00048 #define ICL_CORE_WRAP_VECTOR_HEADER_TYPENAME(TWrapper, TVector, access, wrapped) \
00049   typedef typename TVector::value_type value_type;                      \
00050   typedef typename TVector::allocator_type allocator_type;              \
00051   typedef typename TVector::size_type size_type;                        \
00052   typedef typename TVector::difference_type difference_type;            \
00053   typedef typename TVector::reference reference;                        \
00054   typedef typename TVector::const_reference const_reference;            \
00055   typedef typename TVector::pointer pointer;                            \
00056   typedef typename TVector::const_pointer const_pointer;                \
00057   typedef typename TVector::iterator iterator;                          \
00058   typedef typename TVector::const_iterator const_iterator;              \
00059   typedef typename TVector::reverse_iterator reverse_iterator;          \
00060   typedef typename TVector::const_reverse_iterator const_reverse_iterator
00061 
00062 
00067 #define ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)   \
00068   void assign(size_type count, const value_type& value)                 \
00069   { wrapped.assign(count, value); }                                     \
00070   template <class TInputIterator>                                       \
00071   void assign(TInputIterator first, TInputIterator last)                \
00072   { wrapped.assign<TInputIterator>(first, last); }                      \
00073   allocator_type get_allocator() const                                  \
00074   { return wrapped.get_allocator(); }                                   \
00075                                                                         \
00076   reference at(size_type pos) { return wrapped.at(pos); }               \
00077   const_reference at(size_type pos) const { return wrapped.at(pos); }   \
00078   reference operator [] (size_type pos) { return wrapped[pos]; }        \
00079   const_reference operator [] (size_type pos) const                     \
00080   { return wrapped[pos]; }                                              \
00081                                                                         \
00082   reference front() { return wrapped.front(); }                         \
00083   const_reference front() const { return wrapped.front(); }             \
00084   reference back() { return wrapped.back(); }                           \
00085   const_reference back() const { return wrapped.back(); }               \
00086   iterator begin() { return wrapped.begin(); }                          \
00087   const_iterator begin() const { return wrapped.begin(); }              \
00088   iterator end() { return wrapped.end(); }                              \
00089   const_iterator end() const { return wrapped.end(); }                  \
00090   reverse_iterator rbegin() { return wrapped.rbegin(); }                \
00091   const_reverse_iterator rbegin() const { return wrapped.rbegin(); }    \
00092   reverse_iterator rend() { return wrapped.rend(); }                    \
00093   const_reverse_iterator rend() const { return wrapped.rend(); }        \
00094                                                                         \
00095   bool empty() const { return wrapped.empty(); }                        \
00096   size_type size() const { return wrapped.size(); }                     \
00097   size_type max_size() const { return wrapped.max_size(); }             \
00098   void reserve(size_type size) { wrapped.reserve(size); }               \
00099   size_type capacity() const { return wrapped.capacity(); }             \
00100                                                                         \
00101   void clear() { wrapped.clear(); }                                     \
00102   iterator insert(iterator pos, const value_type& value)                \
00103   { return wrapped.insert(pos, value); }                                \
00104   void insert(iterator pos, size_type count, const value_type& value)   \
00105   { wrapped.insert(pos, count, value); }                                \
00106   template <class TInputIterator>                                       \
00107   void insert(iterator pos, TInputIterator first, TInputIterator last)  \
00108   { wrapped.insert<TInputIterator>(pos, first, last); }                 \
00109                                                                         \
00110   iterator erase(iterator pos) { return wrapped.erase(pos); }           \
00111   iterator erase(iterator first, iterator last)                         \
00112   { return wrapped.erase(first, last); }                                \
00113   void push_back(const value_type& value) { wrapped.push_back(value); } \
00114   void pop_back() { wrapped.pop_back(); }                               \
00115   void resize(size_type count, value_type value = value_type())         \
00116   { resize(count, value); }                                             \
00117   void swap(TWrapper& other) { wrapped.swap(other.wrapped); }           \
00118 access:                                                                 \
00119   TVector wrapped
00120 
00121 
00125 #define ICL_CORE_WRAP_VECTOR_CTOR(TWrapper, TVector, access, wrapped)   \
00126   TWrapper(const TVector& other) : wrapped(other) { }                   \
00127   explicit TWrapper(const allocator_type& alloc = allocator_type())     \
00128     : wrapped(alloc)                                                    \
00129   { }                                                                   \
00130   explicit TWrapper(size_type count,                                    \
00131                     const value_type& value = value_type())             \
00132     : wrapped(count, value)                                             \
00133   { }                                                                   \
00134   template <class TInputIterator>                                       \
00135   TWrapper(TInputIterator first, TInputIterator last,                   \
00136            const allocator_type& alloc = allocator_type())              \
00137     : wrapped(first, last, alloc)                                       \
00138   { }
00139 
00140 
00145 #define ICL_CORE_WRAP_VECTOR_CTOR_INIT(TWrapper, TVector, access, wrapped, ...) \
00146   TWrapper(const TVector& other)                                        \
00147     : wrapped(other), __VA_ARGS__                                       \
00148   { }                                                                   \
00149   explicit TWrapper(const allocator_type& alloc = allocator_type())     \
00150     : wrapped(alloc), __VA_ARGS__                                       \
00151   { }                                                                   \
00152   explicit TWrapper(size_type count,                                    \
00153                     const value_type& value = value_type())             \
00154     : wrapped(count, value), __VA_ARGS__                                \
00155   { }                                                                   \
00156   template <class TInputIterator>                                       \
00157   TWrapper(TInputIterator first, TInputIterator last,                   \
00158            const allocator_type& alloc = allocator_type())              \
00159     : wrapped(first, last, alloc), __VA_ARGS__                          \
00160   { }                                                                   \
00161                                                                         \
00162 
00163 
00184 #define ICL_CORE_WRAP_VECTOR(TWrapper, TVector, access, wrapped)        \
00185   ICL_CORE_WRAP_VECTOR_HEADER(TWrapper, TVector, acccess, wrapped);     \
00186   ICL_CORE_WRAP_VECTOR_CTOR(TWrapper, TVector, access, wrapped)         \
00187   ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
00188 
00189 
00211 #define ICL_CORE_WRAP_VECTOR_TYPENAME(TWrapper, TVector, access, wrapped) \
00212   ICL_CORE_WRAP_VECTOR_HEADER_TYPENAME(TWrapper, TVector, acccess, wrapped); \
00213   ICL_CORE_WRAP_VECTOR_CTOR(TWrapper, TVector, access, wrapped)         \
00214   ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
00215 
00216 
00239 #define ICL_CORE_WRAP_VECTOR_INIT(TWrapper, TVector, access, wrapped, ...) \
00240   ICL_CORE_WRAP_VECTOR_HEADER(TWrapper, TVector, access, wrapped);      \
00241   ICL_CORE_WRAP_VECTOR_CTOR_INIT(TWrapper, TVector, access, wrapped, __VA_ARGS__) \
00242   ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
00243 
00244 
00268 #define ICL_CORE_WRAP_VECTOR_TYPENAME_INIT(TWrapper, TVector, access, wrapped, ...) \
00269   ICL_CORE_WRAP_VECTOR_HEADER_TYPENAME(TWrapper, TVector, access, wrapped); \
00270   ICL_CORE_WRAP_VECTOR_CTOR_INIT(TWrapper, TVector, access, wrapped, __VA_ARGS__) \
00271   ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
00272 
00273 
00274 
00275 #endif // ICL_CORE_VECTOR_WRAPPER_H_INCLUDED


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:19