Go to the documentation of this file.
44 #ifndef GNSSTK_VECTOR_HPP
45 #define GNSSTK_VECTOR_HPP
91 VectorException e(
"Vector(size_t) failed to allocate");
106 VectorException e(
"Vector<T>(size_t, const T) failed to allocate");
109 this->assignFrom(defaultValue);
122 VectorException e(
"Vector<T>(ConstVectorBase) failed to allocate");
137 VectorException e(
"Vector(Vector) failed to allocate");
152 VectorException e(
"Vector(valarray) failed to allocate");
163 size_t num) :
v(
NULL),
s(0)
166 if ( top >= vec.
size() ||
167 top + num > vec.
size())
169 VectorException e(
"Invalid dimensions or size for Vector(VectorBase)");
176 VectorException e(
"Vector(subvector) failed to allocate");
180 for(i = 0; i < num; i++)
209 size_t max_size()
const {
return std::numeric_limits<size_t>().max(); }
230 {
resize(x.
s);
return this->assignFrom(x); }
235 {
resize(x.
size());
return this->assignFrom(x); }
239 {
resize(x.size());
return this->assignFrom(x); }
242 {
return this->assignFrom(x); }
245 {
return this->assignFrom(x); }
251 size_t vs = x.
size();
254 for (i = 0; i < vs; i++)
270 VectorException e(
"Vector.resize(size_t) failed to allocate");
282 for(
size_t i = 0; i <
s; i++)
290 std::vector<T> std_vec;
291 for(
size_t i = 0; i <
s; i++)
292 std_vec.push_back(
v[i] );
299 size_t vs = this->
size();
300 size_t bs = b.
size();
301 size_t rows = vs + bs;
304 for (i = 0; i < vs; i++)
305 toReturn[i] = (*
this)[i];
307 for (i = 0; i < bs; i++)
308 toReturn[i+vs] = b[i];
318 return (*
this) <<
Vector(1,b);
325 size_t vs = this->
size();
326 size_t bs = b.
size();
327 size_t rows = vs + bs;
330 for (i = 0; i < vs; i++)
331 toReturn[i] = (*
this)[i];
333 for (i = 0; i < bs; i++)
334 toReturn[i+vs] = b[i];
343 size_t vs = this->
size();
344 size_t rows = vs + 1;
347 for (i = 0; i < vs; i++)
348 toReturn[i] = (*
this)[i];
350 toReturn[rows - 1] = b;
398 { this->vecSliceCheck(vv.
size()); }
403 {
return this->assignFrom(x); }
407 {
return this->assignFrom(x); }
411 {
return this->assignFrom(x); }
415 {
return this->assignFrom(x); }
431 inline size_t size()
const {
return s.size(); }
433 inline size_t start()
const {
return s.start(); }
436 inline size_t stride()
const {
return s.stride(); }
474 inline size_t size()
const {
return s.size(); }
476 inline size_t start()
const {
return s.start(); }
479 inline size_t stride()
const {
return s.stride(); }
ConstVectorSlice(const Vector< T > &vv, const std::slice &ss)
Uses the given slice and vector.
size_t size() const
returns the number of elements in the slice
T * iterator
STL iterator type.
iterator end()
STL iterator end.
VectorSlice()
Default constructor.
const_iterator end() const
STL const iterator end.
T operator[](size_t i) const
Returns a const version of the i'th slice element.
VectorSlice & operator=(const ConstVectorBase< T, V > &x)
Assign the elements of this slice from another vector.
VectorSlice & operator=(const T *x)
Assign (*this).size() elements from x to (*this).
size_t start() const
returns the index in the vector of the first element.
T & operator()(size_t i)
Non-const operator ()
T operator()(size_t i) const
Returns a const version of the i'th slice element.
T value_type
STL value type.
Vector< T > * v
the vector used as a source for the slice
Vector & resize(const size_t index)
Vector & operator=(const Vector &x)
*this will be resized if it isn't as large as x.
const_iterator begin() const
STL const iterator begin.
Vector(const std::valarray< T > &r)
const typedef T & const_reference
STL const reference type.
size_t s
The size of the vector.
Vector operator&&(const Vector &b)
Returns the concatenation of this Vector and Vector b.
std::slice s
the slice specification.
bool rangeCheck(const size_t index) const
value_type front()
STL front.
Vector & operator=(const std::valarray< T > &x)
*this will be resized if it isn't as large as x.
Vector & resize(const size_t index, const T defaultValue)
resize with new default value
std::vector< T > toStdVector()
Vector operator&&(const T &b)
Returns the concatenation of this Vector and a scalar of type T.
T & operator[](size_t i)
Returns the modifiable i'th element of the slice.
size_t start() const
returns the index in the vector of the first element.
Vector & operator=(const T *x)
Only (*this).size() elements will be assigned.
Vector & operator<<(const T &b)
Returns the concatenation of this Vector and a scalar of type T.
ConstVectorSlice()
default constructor
Vector(size_t siz, const T defaultValue)
Vector(const ConstVectorBase< T, E > &r)
size_t size() const
returns the number of elements in the slice
VectorSlice & operator=(const T x)
Assign all the elements of this slice to x.
std::slice s
the slice specification.
Vector(const ConstVectorBase< T, E > &vec, size_t top, size_t num)
subvector constructor
Vector & operator=(const T x)
Only (*this).size() elements will be assigned.
Vector()
Default constructor.
size_t size() const
Returns the size of the base class.
VectorSlice & operator=(const std::valarray< T > &x)
Assign the elements of this slice from a valarray.
T & operator[](size_t i)
Non-const operator [].
bool empty() const
STL empty.
T & reference
STL reference type.
void vecSliceCheck(size_t sourceSize) const
Vector & operator<<(const Vector &b)
size_t size() const
STL size.
Vector(size_t siz)
Constructor given an initial size.
Vector & operator=(const ConstVectorBase< T, E > &x)
*this will be resized if it isn't as large as x.
#define GNSSTK_THROW(exc)
size_t max_size() const
STL max_size.
T & operator()(size_t i)
Returns the modifiable i'th element of the slice.
const_reference front() const
STL const front.
const typedef T * const_iterator
STL const iterator type.
const Vector< T > * v
Vectortor used as a source for this slice.
Vector & operator=(const std::vector< T > &x)
*this will be cleared and resized as necessary
ConstVectorSlice(const Vector< T > &vv)
Makes a slice of the whole vector.
VectorSlice(Vector< T > &vv, const std::slice &ss)
Makes a slice of the vector with the given std::slice.
VectorSlice(Vector< T > &vv)
Makes a slice of the whole vector.
iterator begin()
STL iterator begin.
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:42