Main MRPT website > C++ reference
MRPT logo
CArray.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (c) 2005-2013, Individual contributors, see AUTHORS file |
7  | Copyright (c) 2005-2013, MAPIR group, University of Malaga |
8  | Copyright (c) 2012-2013, University of Almeria |
9  | All rights reserved. |
10  | |
11  | Redistribution and use in source and binary forms, with or without |
12  | modification, are permitted provided that the following conditions are |
13  | met: |
14  | * Redistributions of source code must retain the above copyright |
15  | notice, this list of conditions and the following disclaimer. |
16  | * Redistributions in binary form must reproduce the above copyright |
17  | notice, this list of conditions and the following disclaimer in the |
18  | documentation and/or other materials provided with the distribution. |
19  | * Neither the name of the copyright holders nor the |
20  | names of its contributors may be used to endorse or promote products |
21  | derived from this software without specific prior written permission.|
22  | |
23  | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
24  | 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
25  | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR|
26  | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE |
27  | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL|
28  | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR|
29  | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
30  | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
31  | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
32  | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
33  | POSSIBILITY OF SUCH DAMAGE. |
34  +---------------------------------------------------------------------------+ */
35 #ifndef _MRPT_CArray_H
36 #define _MRPT_CArray_H
37 
38 #include <mrpt/utils/utils_defs.h>
39 #include <mrpt/math/math_frwds.h>
41 #include <mrpt/utils/CSerializable.h> // Used only for the extension to TTypeName
42 
43 namespace mrpt
44 {
45 namespace math
46 {
47  // ---------------- CArray -------------------------
48  /** A STL container (as wrapper) for arrays of constant size defined at compile time - <b>Users will most likely prefer to use CArrayPOD and its derived classes instead</b>.
49  *
50  * This code is an adapted version from Boost, modifed for its integration
51  * within MRPT (JLBC, Dec/2009) (Renamed array -> CArray to avoid possible potential conflicts).
52  *
53  * See
54  * http://www.josuttis.com/cppcode
55  * for details and the latest version.
56  * See
57  * http://www.boost.org/libs/array for Documentation.
58  * for documentation.
59  *
60  * (C) Copyright Nicolai M. Josuttis 2001.
61  * Permission to copy, use, modify, sell and distribute this software
62  * is granted provided this copyright notice appears in all copies.
63  * This software is provided "as is" without express or implied
64  * warranty, and with no claim as to its suitability for any purpose.
65  *
66  * 29 Jan 2004 - minor fixes (Nico Josuttis)
67  * 04 Dec 2003 - update to synch with library TR1 (Alisdair Meredith)
68  * 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries.
69  * 05 Aug 2001 - minor update (Nico Josuttis)
70  * 20 Jan 2001 - STLport fix (Beman Dawes)
71  * 29 Sep 2000 - Initial Revision (Nico Josuttis)
72  *
73  * Jan 30, 2004
74  *
75  * \note This class DOES NOT support mathematical operations on its elements: it's a generic container, it doesn't assume they are numerical.
76  * \note For a summary and classification of all MRPT vector, array and matrix classes see: http://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes
77  *
78  * \sa CArrayNumeric (for another, non-related base template class that DOES support maths)
79  * \ingroup mrpt_base_grp
80  */
81  template <typename T, std::size_t N>
82  class CArray {
83  public:
84  T elems[N]; // fixed-size array of elements of type T
85 
86  public:
87  // type definitions
88  typedef T value_type;
89  typedef T* iterator;
90  typedef const T* const_iterator;
91  typedef T& reference;
92  typedef const T& const_reference;
93  typedef std::size_t size_type;
94  typedef std::ptrdiff_t difference_type;
95 
96  // iterator support
97  inline iterator begin() { return elems; }
98  inline const_iterator begin() const { return elems; }
99  inline iterator end() { return elems+N; }
100  inline const_iterator end() const { return elems+N; }
101 
102  // reverse iterator support
103 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
104  typedef std::reverse_iterator<iterator> reverse_iterator;
105  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
106 #elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
107  // workaround for broken reverse_iterator in VC7
108  typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
110  typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
112 #else
113  // workaround for broken reverse_iterator implementations
114  typedef std::reverse_iterator<iterator,T> reverse_iterator;
115  typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
116 #endif
117 
120  return const_reverse_iterator(end());
121  }
124  return const_reverse_iterator(begin());
125  }
126 
127  // operator[]
128  inline reference operator[](size_type i) { return elems[i]; }
129  inline const_reference operator[](size_type i) const { return elems[i]; }
130 
131  // at() with range check
132  reference at(size_type i) { rangecheck(i); return elems[i]; }
133  const_reference at(size_type i) const { rangecheck(i); return elems[i]; }
134 
135  // front() and back()
136  reference front() { return elems[0]; }
137  const_reference front() const { return elems[0]; }
138  reference back() { return elems[N-1]; }
139  const_reference back() const { return elems[N-1]; }
140 
141  // size is constant
142  static inline size_type size() { return N; }
143  static bool empty() { return false; }
144  static size_type max_size() { return N; }
145  enum { static_size = N };
146 
147  /** This method has no effects in this class, but raises an exception if the expected size does not match */
148  inline void resize(const size_t nElements) {
149  if (nElements!=N)
150  throw std::logic_error(format("Try to change the size of a %u-CArray to %u.",static_cast<unsigned>(N),static_cast<unsigned>(nElements)));
151  }
152 
153  // swap (note: linear complexity in N, constant for given instantiation)
154  void swap (CArray<T,N>& y) {
155  std::swap_ranges(begin(),end(),y.begin());
156  }
157 
158  // direct access to data (read-only)
159  const T* data() const { return elems; }
160 
161  // use array as C array (direct read/write access to data)
162  T* data() { return elems; }
163 
164  // assignment with type conversion
165  template <typename T2>
167  std::copy(rhs.begin(),rhs.end(), begin());
168  return *this;
169  }
170 
171  // assign one value to all elements
172  inline void assign (const T& value)
173  {
174  for (size_t i=0;i<N;i++) elems[i]=value;
175  }
176  // assign (compatible with std::vector's one) (by JLBC for MRPT)
177  void assign (const size_t n, const T& value)
178  {
179  ASSERTDEB_(N==n);
180  for (size_t i=0;i<N;i++) elems[i]=value;
181  }
182 
183  //assign a range of values corresponding to a pair of iterators (by PMO for MRPT)
184  template<typename I> void assign(I b,const I &e) {
185  ASSERTDEB_(std::distance(b,e)==N);
186  for (iterator i=begin();i<end();++i) *i=*(b++);
187  }
188 
189  private:
190  // check range (may be private because it is static)
191  static void rangecheck (size_type i) {
192  if (i >= size()) {
193  throw std::out_of_range("CArray<>: index out of range");
194  }
195  }
196 
197  };
198 
199 // partial specialization for arrays of size 0
200  template <typename T>
201  class CArray<T,0> {
202  public:
203  char c; // to ensure different array intances return unique values for begin/end
204 
205  public:
206  // type definitions
207  typedef T value_type;
208  typedef T* iterator;
209  typedef const T* const_iterator;
210  typedef T& reference;
211  typedef const T& const_reference;
212  typedef std::size_t size_type;
213  typedef std::ptrdiff_t difference_type;
214 
215  // iterator support
216  iterator begin() { return reinterpret_cast< iterator >( &c ); }
217  const_iterator begin() const { return reinterpret_cast< const_iterator >( &c ); }
218  iterator end() { return reinterpret_cast< iterator >( &c ); }
219  const_iterator end() const { return reinterpret_cast< const_iterator >( &c ); }
220 
221  // reverse iterator support
222 #if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
223  typedef std::reverse_iterator<iterator> reverse_iterator;
224  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
225 #elif defined(_MSC_VER) && (_MSC_VER == 1300) && defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_DINKUMWARE_STDLIB == 310)
226  // workaround for broken reverse_iterator in VC7
227  typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, iterator,
229  typedef std::reverse_iterator<std::_Ptrit<value_type, difference_type, const_iterator,
231 #else
232  // workaround for broken reverse_iterator implementations
233  typedef std::reverse_iterator<iterator,T> reverse_iterator;
234  typedef std::reverse_iterator<const_iterator,T> const_reverse_iterator;
235 #endif
236 
239  return const_reverse_iterator(end());
240  }
243  return const_reverse_iterator(begin());
244  }
245 
246  // at() with range check
248  throw std::out_of_range("CArray<0>: index out of range");
249  }
251  throw std::out_of_range("<0>: index out of range");
252  }
253 
254  // size is constant
255  static size_type size() { return 0; }
256  static bool empty() { return true; }
257  static size_type max_size() { return 0; }
258  enum { static_size = 0 };
259 
260  // swap
261  void swap (CArray<T,0>& y) {
262  // could swap value of c, but value is not part of documented array state
263  }
264 
265  // direct access to data
266  const T* data() const { return NULL; }
267  T* data() { return NULL; }
268 
269  // assignment with type conversion
270  template < typename T2 >
272  return *this;
273  }
274 
275  // Calling these operations are undefined behaviour for 0-size arrays,
276  // but Library TR1 requires their presence.
277  // operator[]
278  inline reference operator[](size_type i) { makes_no_sense(); static T dumm=0; return dumm; }
279  inline const_reference operator[](size_type i) const { makes_no_sense(); static T dumm=0; return dumm; }
280 
281  // front() and back()
282  reference front() { makes_no_sense(); }
283  const_reference front() const { makes_no_sense(); }
284  reference back() { makes_no_sense(); }
285  const_reference back() const { makes_no_sense(); }
286 
287  private:
288  // helper for operations that have undefined behaviour for 0-size arrays,
289  // assert( false ); added to make lack of support clear
290  static void makes_no_sense () {
291  //assert(true);
292  throw std::out_of_range("CArray<0>: index out of range");
293  }
294  };
295 
296  // comparisons
297  template<class T, std::size_t N>
298  bool operator== (const CArray<T,N>& x, const CArray<T,N>& y) {
299  return std::equal(x.begin(), x.end(), y.begin());
300  }
301  template<class T, std::size_t N>
302  bool operator< (const CArray<T,N>& x, const CArray<T,N>& y) {
303  return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end());
304  }
305  template<class T, std::size_t N>
306  bool operator!= (const CArray<T,N>& x, const CArray<T,N>& y) {
307  return !(x==y);
308  }
309  template<class T, std::size_t N>
310  bool operator> (const CArray<T,N>& x, const CArray<T,N>& y) {
311  return y<x;
312  }
313  template<class T, std::size_t N>
314  bool operator<= (const CArray<T,N>& x, const CArray<T,N>& y) {
315  return !(y<x);
316  }
317  template<class T, std::size_t N>
318  bool operator>= (const CArray<T,N>& x, const CArray<T,N>& y) {
319  return !(x<y);
320  }
321 
322 
323 
324 
325  // ---------------- CArrayNumeric -------------------------
326 
327  /** CArrayNumeric is an array for numeric types supporting several mathematical operations (actually, just a wrapper on Eigen::Matrix<T,N,1>)
328  * \sa CArrayFloat, CArrayDouble, CArray
329  */
330  template <typename T, std::size_t N>
331  class CArrayNumeric : public Eigen::Matrix<T,N,1>
332  {
333  public:
334  typedef T value_type;
335  typedef Eigen::Matrix<T,N,1> Base;
336 
337  CArrayNumeric() {} //!< Default constructor
338  /** Constructor from initial values ptr[0]-ptr[N-1] */
339  CArrayNumeric(const T*ptr) : Eigen::Matrix<T,N,1>(ptr) {}
340 
342 
343  /** Initialization from a vector-like source, that is, anything implementing operator[]. */
344  template <class ARRAYLIKE>
345  explicit CArrayNumeric(const ARRAYLIKE &obj) : Eigen::Matrix<T,N,1>(obj) {}
346 
347  template<typename OtherDerived>
348  inline CArrayNumeric<T,N> & operator= (const Eigen::MatrixBase <OtherDerived>& other) {
349  Base::operator=(other);
350  return *this;
351  }
352 
353  };
354 
355  // -------------- Partial specializations of CArrayNumeric -----------
356 
357  /** A partial specialization of CArrayNumeric for float numbers.
358  * \sa CArrayNumeric, CArray */
359  template <std::size_t N>
360  class CArrayFloat : public CArrayNumeric<float,N>
361  {
362  public:
365 
366  CArrayFloat() {} //!< Default constructor
367  CArrayFloat(const float*ptr) : CArrayNumeric<float,N>(ptr) {} //!< Constructor from initial values ptr[0]-ptr[N-1]
368 
370 
371  /** Initialization from a vector-like source, that is, anything implementing operator[]. */
372  template <class ARRAYLIKE>
373  explicit CArrayFloat(const ARRAYLIKE &obj) : CArrayNumeric<float,N>(obj) {}
374  MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(CArrayFloat) // Implements ctor and "operator =" for any other Eigen class
375  };
376 
377  /** A partial specialization of CArrayNumeric for double numbers.
378  * \sa CArrayNumeric, CArray */
379  template <std::size_t N>
380  class CArrayDouble : public CArrayNumeric<double,N>
381  {
382  public:
385 
386  CArrayDouble() {} //!< Default constructor
387  CArrayDouble(const double*ptr) : CArrayNumeric<double,N>(ptr) {} //!< Constructor from initial values ptr[0]-ptr[N-1]
388 
390 
391  /** Initialization from a vector-like source, that is, anything implementing operator[]. */
392  template <class ARRAYLIKE>
393  explicit CArrayDouble(const ARRAYLIKE &obj) : CArrayNumeric<double,N>(obj) {}
394  MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(CArrayDouble) // Implements ctor and "operator =" for any other Eigen class
395  };
396 
397  /** A partial specialization of CArrayNumeric for int numbers.
398  * \sa CArrayNumeric, CArray */
399  template <std::size_t N>
400  class CArrayInt : public CArrayNumeric<int,N>
401  {
402  public:
405 
406  CArrayInt() {} //!< Default constructor
407  CArrayInt(const int*ptr) : CArrayNumeric<int,N>(ptr) {} //!< Constructor from initial values ptr[0]-ptr[N-1]
408  MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(CArrayInt) // Implements ctor and "operator =" for any other Eigen class
409  };
410 
411  /** A partial specialization of CArrayNumeric for unsigned int numbers.
412  * \sa CArrayNumeric, CArray */
413  template <std::size_t N>
414  class CArrayUInt : public CArrayNumeric<unsigned int,N>
415  {
416  public:
419 
420  CArrayUInt() {} //!< Default constructor
421  CArrayUInt(const unsigned int*ptr) : CArrayNumeric<unsigned int,N>(ptr) {} //!< Constructor from initial values ptr[0]-ptr[N-1]
422  MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(CArrayUInt) // Implements ctor and "operator =" for any other Eigen class
423  };
424 
425  /** Auxiliary class used in CMatrixTemplate:size(), CMatrixTemplate::resize(), CMatrixFixedNumeric::size(), CMatrixFixedNumeric::resize(), to mimic the behavior of STL-containers */
426  struct CMatrixTemplateSize : public Eigen::Matrix<size_t,2,1>
427  {
428  typedef Eigen::Matrix<size_t,2,1> Base;
430 
431  inline CMatrixTemplateSize() : Eigen::Matrix<size_t,2,1>() {}
432  inline CMatrixTemplateSize(const size_t *d) : Eigen::Matrix<size_t,2,1>(d) {}
433 
434  inline bool operator==(const CMatrixTemplateSize&o) const { return Eigen::Matrix<size_t,2,1>::operator()(0)==o[0] && Eigen::Matrix<size_t,2,1>::operator()(1)==o[1]; }
435  inline bool operator!=(const CMatrixTemplateSize&o) const { return !(*this==o); }
436  /** This operator allows the size(N,M) to be compared with a plain size_t N*M */
437  inline operator size_t(void) const { return Eigen::Matrix<size_t,2,1>::operator()(0)*Eigen::Matrix<size_t,2,1>::operator()(1); }
438  MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(CMatrixTemplateSize) // Implements ctor and "operator =" for any other Eigen class
439  };
440 
441 } // End of namespace
442 
443  namespace utils
444  {
445  // Extensions to mrpt::utils::TTypeName for matrices:
446  template<typename T,size_t N> struct TTypeName <mrpt::math::CArrayNumeric<T,N> > {
447  static std::string get() { return mrpt::format("CArrayNumeric<%s,%u>",TTypeName<T>::get().c_str(),static_cast<unsigned int>(N)); } };
448  template<size_t N> struct TTypeName <mrpt::math::CArrayDouble<N> > {
449  static std::string get() { return mrpt::format("CArrayNumeric<double,%u>",static_cast<unsigned int>(N)); } };
450  template<size_t N> struct TTypeName <mrpt::math::CArrayFloat<N> > {
451  static std::string get() { return mrpt::format("CArrayNumeric<float,%u>",static_cast<unsigned int>(N)); } };
452  }
453 
454 
455 } // End of namespace
456 
457 
458 #endif
bool operator!=(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:306
const_reference back() const
Definition: CArray.h:285
CArrayDouble(const double *ptr)
Constructor from initial values ptr[0]-ptr[N-1].
Definition: CArray.h:387
const_reference operator[](size_type i) const
Definition: CArray.h:129
const_reference at(size_type i) const
Definition: CArray.h:250
static bool empty()
Definition: CArray.h:256
reference back()
Definition: CArray.h:138
CArrayNumeric()
Default constructor.
Definition: CArray.h:337
static size_type size()
Definition: CArray.h:255
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: CArray.h:224
static bool empty()
Definition: CArray.h:143
CArrayInt< N > mrpt_autotype
Definition: CArray.h:404
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:72
std::ptrdiff_t difference_type
Definition: CArray.h:213
std::reverse_iterator< iterator > reverse_iterator
Definition: CArray.h:223
const T * const_iterator
Definition: CArray.h:90
std::reverse_iterator< iterator > reverse_iterator
Definition: CArray.h:104
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Auxiliary class used in CMatrixTemplate:size(), CMatrixTemplate::resize(), CMatrixFixedNumeric::size(...
Definition: CArray.h:426
This file implements several operations that operate element-wise on individual or pairs of container...
bool operator!=(const CMatrixTemplateSize &o) const
Definition: CArray.h:435
static void makes_no_sense()
Definition: CArray.h:290
CArrayNumeric is an array for numeric types supporting several mathematical operations (actually...
Definition: CArray.h:331
bool operator>(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:310
A partial specialization of CArrayNumeric for unsigned int numbers.
Definition: CArray.h:414
CArrayNumeric(const ARRAYLIKE &obj)
Initialization from a vector-like source, that is, anything implementing operator[].
Definition: CArray.h:345
std::size_t size_type
Definition: CArray.h:212
CArrayInt(const int *ptr)
Constructor from initial values ptr[0]-ptr[N-1].
Definition: CArray.h:407
CArrayFloat()
Default constructor.
Definition: CArray.h:366
void swap(CArray< T, N > &y)
Definition: CArray.h:154
bool operator>=(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:318
const T * data() const
Definition: CArray.h:266
void swap(CArray< T, 0 > &y)
Definition: CArray.h:261
#define MRPT_EIGEN_DERIVED_CLASS_CTOR_OPERATOR_EQUAL(_CLASS_)
const T & const_reference
Definition: CArray.h:92
void assign(const size_t n, const T &value)
Definition: CArray.h:177
reference at(size_type i)
Definition: CArray.h:132
const_iterator end() const
Definition: CArray.h:219
static size_type max_size()
Definition: CArray.h:257
reverse_iterator rend()
Definition: CArray.h:122
CArrayFloat(const ARRAYLIKE &obj)
Initialization from a vector-like source, that is, anything implementing operator[].
Definition: CArray.h:373
std::size_t size_type
Definition: CArray.h:93
A partial specialization of CArrayNumeric for int numbers.
Definition: CArray.h:400
reverse_iterator rbegin()
Definition: CArray.h:118
reference at(size_type i)
Definition: CArray.h:247
Eigen::Matrix< size_t, 2, 1 > Base
Definition: CArray.h:428
reference operator[](size_type i)
Definition: CArray.h:278
const_reference front() const
Definition: CArray.h:137
CArrayFloat(const float *ptr)
Constructor from initial values ptr[0]-ptr[N-1].
Definition: CArray.h:367
std::ptrdiff_t difference_type
Definition: CArray.h:94
bool operator==(const CArray< T, N > &x, const CArray< T, N > &y)
Definition: CArray.h:298
A partial specialization of CArrayNumeric for float numbers.
Definition: CArray.h:360
#define MRPT_MATRIX_CONSTRUCTORS_FROM_POSES(_CLASS_)
const_reference operator[](size_type i) const
Definition: CArray.h:279
const_reference at(size_type i) const
Definition: CArray.h:133
static size_type max_size()
Definition: CArray.h:144
const T * data() const
Definition: CArray.h:159
void assign(I b, const I &e)
Definition: CArray.h:184
CArrayUInt< N > mrpt_autotype
Definition: CArray.h:418
const_reference back() const
Definition: CArray.h:139
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
CArrayNumeric< T, N > & operator=(const Eigen::MatrixBase< OtherDerived > &other)
Definition: CArray.h:348
CMatrixTemplateSize mrpt_autotype
Definition: CArray.h:429
const_reference front() const
Definition: CArray.h:283
CArrayNumeric< unsigned int, N > Base
Definition: CArray.h:417
CArrayNumeric< double, N > Base
Definition: CArray.h:383
const_iterator end() const
Definition: CArray.h:100
CArrayDouble()
Default constructor.
Definition: CArray.h:386
CArrayDouble< N > mrpt_autotype
Definition: CArray.h:384
void assign(const T &value)
Definition: CArray.h:172
const_iterator begin() const
Definition: CArray.h:217
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition: CArray.h:105
reverse_iterator rend()
Definition: CArray.h:241
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define ASSERTDEB_(f)
Defines an assertion mechanism - only when compiled in debug.
CArrayDouble(const ARRAYLIKE &obj)
Initialization from a vector-like source, that is, anything implementing operator[].
Definition: CArray.h:393
CArray< T, N > & operator=(const CArray< T2, N > &rhs)
Definition: CArray.h:166
iterator begin()
Definition: CArray.h:97
A STL container (as wrapper) for arrays of constant size defined at compile time - Users will most li...
Definition: CArray.h:82
reference front()
Definition: CArray.h:136
const_reverse_iterator rend() const
Definition: CArray.h:123
CArrayUInt()
Default constructor.
Definition: CArray.h:420
CArrayNumeric(const T *ptr)
Constructor from initial values ptr[0]-ptr[N-1].
Definition: CArray.h:339
iterator end()
Definition: CArray.h:99
A partial specialization of CArrayNumeric for double numbers.
Definition: CArray.h:380
reference operator[](size_type i)
Definition: CArray.h:128
CArrayNumeric< float, N > Base
Definition: CArray.h:363
void resize(const size_t nElements)
This method has no effects in this class, but raises an exception if the expected size does not match...
Definition: CArray.h:148
const_reverse_iterator rend() const
Definition: CArray.h:242
const_reverse_iterator rbegin() const
Definition: CArray.h:238
reverse_iterator rbegin()
Definition: CArray.h:237
Eigen::Matrix< T, N, 1 > Base
Definition: CArray.h:335
const_iterator begin() const
Definition: CArray.h:98
bool operator==(const CMatrixTemplateSize &o) const
Definition: CArray.h:434
static size_type size()
Definition: CArray.h:142
CArrayInt()
Default constructor.
Definition: CArray.h:406
static void rangecheck(size_type i)
Definition: CArray.h:191
const T * const_iterator
Definition: CArray.h:209
CMatrixTemplateSize(const size_t *d)
Definition: CArray.h:432
const_reverse_iterator rbegin() const
Definition: CArray.h:119
const T & const_reference
Definition: CArray.h:211
CArrayNumeric< int, N > Base
Definition: CArray.h:403
CArrayUInt(const unsigned int *ptr)
Constructor from initial values ptr[0]-ptr[N-1].
Definition: CArray.h:421
double BASE_IMPEXP distance(const TPoint2D &p1, const TPoint2D &p2)
Gets the distance between two points in a 2D space.
CArrayFloat< N > mrpt_autotype
Definition: CArray.h:364



Page generated by Doxygen 1.8.14 for MRPT 1.0.2 SVN: at lun oct 28 00:52:41 CET 2019 Hosted on:
SourceForge.net Logo