Go to the documentation of this file.
44 #ifndef GNSSTK_VECTOR_BASE_HPP
45 #define GNSSTK_VECTOR_BASE_HPP
51 #include "gnsstk_export.h"
104 template <
class T,
class BaseClass>
113 {
return static_cast<const BaseClass*
>(
this)->
size(); }
127 const BaseClass& b =
static_cast<const BaseClass&
>(*this);
131 VectorException e(
"Invalid ConstVectorBase index");
154 template <
class T,
class BaseClass>
171 BaseClass& me =
static_cast<BaseClass&
>(*this);
173 for (i = 0; i < me.size(); i++)
179 #define VecBaseArrayAssignMacroDontCheckRange(func) \
180 BaseClass& me = static_cast<BaseClass&>(*this); \
181 size_t i; for (i=0; i < me.size(); i++) { \
187 #define VecBaseArrayAssignMacro(func) \
188 BaseClass& me = static_cast<BaseClass&>(*this); \
189 if (x.size() != me.size()) \
191 VectorException e("Unequal lengths for vectors"); \
194 size_t i; for (i=0; i < me.size(); i++) me[i] func x[i]; \
197 #define VecBaseArrayAssignMacro(func) \
198 VecBaseArrayAssignMacroDontCheckRange(func)
201 #define VecBaseAtomicAssignMacro(func) \
202 BaseClass& me = static_cast<BaseClass&>(*this); \
203 size_t i; for (i=0; i < me.size(); i++) me[i] func x; \
206 #define VecBaseNewAssignOperator(funcName, op) \
208 template <class E> BaseClass& funcName(const ConstVectorBase<T, E>& x) \
209 { VecBaseArrayAssignMacro(op) } \
211 BaseClass& funcName(const std::valarray<T>& x) \
212 { VecBaseArrayAssignMacro(op) } \
214 BaseClass& funcName(const T* x) \
215 { VecBaseArrayAssignMacroDontCheckRange(op) } \
217 BaseClass& funcName(T x) \
218 { VecBaseAtomicAssignMacro(op) }
243 BaseClass me =
static_cast<BaseClass
>(*this);
245 for (i=0; i < me.size(); i++) me(i) *= x;
255 BaseClass& b =
static_cast<BaseClass&
>(*this);
259 VectorException e(
"Invalid VectorBase index");
270 template <
class BaseClass>
279 {
return static_cast<const BaseClass*
>(
this)->
size(); }
282 {
return static_cast<const BaseClass*
>(
this)->
start(); }
286 {
return static_cast<const BaseClass*
>(
this)->
stride(); }
296 if ( (
start() >= sourceSize) ||
299 VectorException e(
"Invalid range for slice");
310 template <
class T,
class BaseClass>
322 template <
class T,
class BaseClass>
336 #endif //GNSSTK_VECTOR_BASE_HPP
const BaseClass operator-() const
unary minus: multiplies each element in this matrix by -1.
VecBaseNewAssignOperator(assignFrom,=)
T & operator[](size_t i)
returns a modifiable version of the element at index i.
NEW_EXCEPTION_CLASS(FileSpecException, gnsstk::Exception)
T constVectorRef(size_t i) const
size_t start() const
the start index in the BaseClass vector for this slice.
size_t size() const
Returns the size of the base class.
T operator[](size_t i) const
returns the element at index i
void vecSliceCheck(size_t sourceSize) const
ConstVectorBase()
Constructor.
RefVectorBase()
constructor
T & operator()(size_t i)
returns a modifiable version of the element at index i.
#define GNSSTK_THROW(exc)
size_t size() const
the number of elements in the slice.
static GNSSTK_EXPORT double zeroTolerance
T operator()(size_t i) const
returns the element at index i
VectorSliceBase()
constructor
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:42