VectorWrapper.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
23 #ifndef ICL_CORE_VECTOR_WRAPPER_H_INCLUDED
24 #define ICL_CORE_VECTOR_WRAPPER_H_INCLUDED
25 
29 #define ICL_CORE_WRAP_VECTOR_HEADER(TWrapper, TVector, access, wrapped) \
30  typedef TVector::value_type value_type; \
31  typedef TVector::allocator_type allocator_type; \
32  typedef TVector::size_type size_type; \
33  typedef TVector::difference_type difference_type; \
34  typedef TVector::reference reference; \
35  typedef TVector::const_reference const_reference; \
36  typedef TVector::pointer pointer; \
37  typedef TVector::const_pointer const_pointer; \
38  typedef TVector::iterator iterator; \
39  typedef TVector::const_iterator const_iterator; \
40  typedef TVector::reverse_iterator reverse_iterator; \
41  typedef TVector::const_reverse_iterator const_reverse_iterator
42 
43 
48 #define ICL_CORE_WRAP_VECTOR_HEADER_TYPENAME(TWrapper, TVector, access, wrapped) \
49  typedef typename TVector::value_type value_type; \
50  typedef typename TVector::allocator_type allocator_type; \
51  typedef typename TVector::size_type size_type; \
52  typedef typename TVector::difference_type difference_type; \
53  typedef typename TVector::reference reference; \
54  typedef typename TVector::const_reference const_reference; \
55  typedef typename TVector::pointer pointer; \
56  typedef typename TVector::const_pointer const_pointer; \
57  typedef typename TVector::iterator iterator; \
58  typedef typename TVector::const_iterator const_iterator; \
59  typedef typename TVector::reverse_iterator reverse_iterator; \
60  typedef typename TVector::const_reverse_iterator const_reverse_iterator
61 
62 
67 #define ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped) \
68  void assign(size_type count, const value_type& value) \
69  { wrapped.assign(count, value); } \
70  template <class TInputIterator> \
71  void assign(TInputIterator first, TInputIterator last) \
72  { wrapped.template assign<TInputIterator>(first, last); } \
73  allocator_type get_allocator() const \
74  { return wrapped.get_allocator(); } \
75  \
76  reference at(size_type pos) { return wrapped.at(pos); } \
77  const_reference at(size_type pos) const { return wrapped.at(pos); } \
78  reference operator [] (size_type pos) { return wrapped[pos]; } \
79  const_reference operator [] (size_type pos) const \
80  { return wrapped[pos]; } \
81  \
82  reference front() { return wrapped.front(); } \
83  const_reference front() const { return wrapped.front(); } \
84  reference back() { return wrapped.back(); } \
85  const_reference back() const { return wrapped.back(); } \
86  iterator begin() { return wrapped.begin(); } \
87  const_iterator begin() const { return wrapped.begin(); } \
88  iterator end() { return wrapped.end(); } \
89  const_iterator end() const { return wrapped.end(); } \
90  reverse_iterator rbegin() { return wrapped.rbegin(); } \
91  const_reverse_iterator rbegin() const { return wrapped.rbegin(); } \
92  reverse_iterator rend() { return wrapped.rend(); } \
93  const_reverse_iterator rend() const { return wrapped.rend(); } \
94  \
95  bool empty() const { return wrapped.empty(); } \
96  size_type size() const { return wrapped.size(); } \
97  size_type max_size() const { return wrapped.max_size(); } \
98  void reserve(size_type size) { wrapped.reserve(size); } \
99  size_type capacity() const { return wrapped.capacity(); } \
100  \
101  void clear() { wrapped.clear(); } \
102  iterator insert(iterator pos, const value_type& value) \
103  { return wrapped.insert(pos, value); } \
104  void insert(iterator pos, size_type count, const value_type& value) \
105  { wrapped.insert(pos, count, value); } \
106  template <class TInputIterator> \
107  void insert(iterator pos, TInputIterator first, TInputIterator last) \
108  { wrapped.template insert<TInputIterator>(pos, first, last); } \
109  \
110  iterator erase(iterator pos) { return wrapped.erase(pos); } \
111  iterator erase(iterator first, iterator last) \
112  { return wrapped.erase(first, last); } \
113  void push_back(const value_type& value) { wrapped.push_back(value); } \
114  void pop_back() { wrapped.pop_back(); } \
115  void resize(size_type count, value_type value = value_type()) \
116  { wrapped.resize(count, value); } \
117  void swap(TWrapper& other) { wrapped.swap(other.wrapped); } \
118 access: \
119  TVector wrapped
120 
121 
125 #define ICL_CORE_WRAP_VECTOR_CTOR(TWrapper, TVector, access, wrapped) \
126  TWrapper(const TVector& other) : wrapped(other) { } \
127  explicit TWrapper(const allocator_type& alloc = allocator_type()) \
128  : wrapped(alloc) \
129  { } \
130  explicit TWrapper(size_type count, \
131  const value_type& value = value_type()) \
132  : wrapped(count, value) \
133  { } \
134  template <class TInputIterator> \
135  TWrapper(TInputIterator first, TInputIterator last, \
136  const allocator_type& alloc = allocator_type()) \
137  : wrapped(first, last, alloc) \
138  { }
139 
140 
145 #define ICL_CORE_WRAP_VECTOR_CTOR_INIT(TWrapper, TVector, access, wrapped, ...) \
146  TWrapper(const TVector& other) \
147  : wrapped(other), __VA_ARGS__ \
148  { } \
149  explicit TWrapper(const allocator_type& alloc = allocator_type()) \
150  : wrapped(alloc), __VA_ARGS__ \
151  { } \
152  explicit TWrapper(size_type count, \
153  const value_type& value = value_type()) \
154  : wrapped(count, value), __VA_ARGS__ \
155  { } \
156  template <class TInputIterator> \
157  TWrapper(TInputIterator first, TInputIterator last, \
158  const allocator_type& alloc = allocator_type()) \
159  : wrapped(first, last, alloc), __VA_ARGS__ \
160  { } \
161  \
162 
163 
184 #define ICL_CORE_WRAP_VECTOR(TWrapper, TVector, access, wrapped) \
185  ICL_CORE_WRAP_VECTOR_HEADER(TWrapper, TVector, acccess, wrapped); \
186  ICL_CORE_WRAP_VECTOR_CTOR(TWrapper, TVector, access, wrapped) \
187  ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
188 
189 
211 #define ICL_CORE_WRAP_VECTOR_TYPENAME(TWrapper, TVector, access, wrapped) \
212  ICL_CORE_WRAP_VECTOR_HEADER_TYPENAME(TWrapper, TVector, acccess, wrapped); \
213  ICL_CORE_WRAP_VECTOR_CTOR(TWrapper, TVector, access, wrapped) \
214  ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
215 
216 
239 #define ICL_CORE_WRAP_VECTOR_INIT(TWrapper, TVector, access, wrapped, ...) \
240  ICL_CORE_WRAP_VECTOR_HEADER(TWrapper, TVector, access, wrapped); \
241  ICL_CORE_WRAP_VECTOR_CTOR_INIT(TWrapper, TVector, access, wrapped, __VA_ARGS__) \
242  ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
243 
244 
268 #define ICL_CORE_WRAP_VECTOR_TYPENAME_INIT(TWrapper, TVector, access, wrapped, ...) \
269  ICL_CORE_WRAP_VECTOR_HEADER_TYPENAME(TWrapper, TVector, access, wrapped); \
270  ICL_CORE_WRAP_VECTOR_CTOR_INIT(TWrapper, TVector, access, wrapped, __VA_ARGS__) \
271  ICL_CORE_WRAP_VECTOR_BODY(TWrapper, TVector, access, wrapped)
272 
273 
274 
275 #endif // ICL_CORE_VECTOR_WRAPPER_H_INCLUDED


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58