rtcArray1.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009
00003  * Robert Bosch LLC
00004  * Research and Technology Center North America
00005  * Palo Alto, California
00006  *
00007  * All rights reserved.
00008  *
00009  *------------------------------------------------------------------------------
00010  * project ....: Autonomous Technologies
00011  * file .......: rtcArray1.h
00012  * authors ....: Benjamin Pitzer
00013  * organization: Robert Bosch LLC
00014  * creation ...: 08/16/2006
00015  * modified ...: $Date: 2009-01-21 18:19:16 -0800 (Wed, 21 Jan 2009) $
00016  * changed by .: $Author: benjaminpitzer $
00017  * revision ...: $Revision: 14 $
00018  */
00019 #ifndef RTC_ARRAY1_H
00020 #define RTC_ARRAY1_H
00021 
00022 //== INCLUDES ==================================================================
00023 #include "rtc/rtcMath.h"
00024 #include "rtc/rtcArray.h"
00025 
00026 //== NAMESPACES ================================================================
00027 namespace rtc {
00028 
00029 // Forward declarations
00030 template <class T, int K> class Array; // K-dimensional array
00031 template <class T> class Array1; // 1-dimensional array
00032 
00036 template <class T>
00037 class Array1: public Array<T,1> {
00038 public:
00040   Array1();
00041   Array1(int len);
00042   Array1(int len, const T* d);
00043   Array1(int len, const T a);
00044   Array1(const Array<T,1>& a);
00045 
00047   void setSize(int len);
00048 
00050   int size() const;
00051 
00053   using Array<T,1>::x;
00054   using Array<T,1>::reset;
00055   using Array<T,1>::at;
00056 protected:
00058   using Array<T,1>::dim;
00059   using Array<T,1>::mul;
00060   using Array<T,1>::len;
00061 };
00062 
00063 // Declare a few common typdefs
00064 typedef Array1<bool> Array1b;
00065 typedef Array1<char> Array1c;
00066 typedef Array1<unsigned char> Array1uc;
00067 typedef Array1<int> Array1i;
00068 typedef Array1<float> Array1f;
00069 typedef Array1<double> Array1d;
00070 
00071 //==============================================================================
00072 // Array1<T>
00073 //==============================================================================
00074 // Constructors/Destructor
00075 
00078 template <class T>
00079 inline Array1<T>::Array1() : Array<T,1>() {}
00080 
00084 template <class T>
00085 inline Array1<T>::Array1(int len_) : Array<T,1>() {
00086   setSize(len_);
00087 }
00088 
00093 template <class T>
00094 inline Array1<T>::Array1(int _len, const T* d) {
00095   setSize(_len);
00096   Array<T,1>::set(d);
00097 }
00098 
00103 template <class T>
00104 inline Array1<T>::Array1(int _len, const T a) {
00105   setSize(_len);
00106   Array<T,1>::set(a);
00107 }
00108 
00112 template <class T>
00113 inline Array1<T>::Array1(const Array<T,1>& a) : Array<T,1>(a) {}
00114 
00118 template <class T>
00119 inline void Array1<T>::setSize(int len_)  {
00120   Array<T,1>::setSize(Vec<int,1>(len_));
00121 }
00122 
00123 // Accessors
00124 
00128 template <class T>
00129 inline int Array1<T>::size() const {
00130   return len;
00131 }
00132 
00133 //==============================================================================
00134 } // namespace rtc
00135 //==============================================================================
00136 #endif // RTC_ARRAY1_H defined
00137 //==============================================================================
00138 


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:34