Public Types | Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
gnsstk::Vector< T > Class Template Reference

Detailed Description

template<class T>
class gnsstk::Vector< T >

This class pretty much duplicates std::valarray<T> except it's fully STL container compliant. Remember that operators +=, -=, *= and /= are provided by RefVectorBase.

See also
matvectest.cpp for examples

Definition at line 67 of file Vector.hpp.

#include <Vector.hpp>

Inheritance diagram for gnsstk::Vector< T >:
Inheritance graph
[legend]

Public Types

typedef T * iterator
 STL iterator type. More...
 
typedef T & reference
 STL reference type. More...
 
typedef T value_type
 STL value type. More...
 

Public Member Functions

iterator begin ()
 STL iterator begin. More...
 
const_iterator begin () const
 STL const iterator begin. More...
 
bool empty () const
 STL empty. More...
 
iterator end ()
 STL iterator end. More...
 
const_iterator end () const
 STL const iterator end. More...
 
value_type front ()
 STL front. More...
 
const_reference front () const
 STL const front. More...
 
size_t max_size () const
 STL max_size. More...
 
Vector operator&& (const T &b)
 Returns the concatenation of this Vector and a scalar of type T. More...
 
Vector operator&& (const Vector &b)
 Returns the concatenation of this Vector and Vector b. More...
 
T & operator() (size_t i)
 Non-const operator () More...
 
operator() (size_t i) const
 Const operator () More...
 
Vectoroperator<< (const T &b)
 Returns the concatenation of this Vector and a scalar of type T. More...
 
Vectoroperator<< (const Vector &b)
 
template<class E >
Vectoroperator= (const ConstVectorBase< T, E > &x)
 *this will be resized if it isn't as large as x. More...
 
Vectoroperator= (const std::valarray< T > &x)
 *this will be resized if it isn't as large as x. More...
 
Vectoroperator= (const std::vector< T > &x)
 *this will be cleared and resized as necessary More...
 
Vectoroperator= (const T *x)
 Only (*this).size() elements will be assigned. More...
 
Vectoroperator= (const T x)
 Only (*this).size() elements will be assigned. More...
 
Vectoroperator= (const Vector &x)
 *this will be resized if it isn't as large as x. More...
 
VectorSlice< T > operator[] (const std::slice &sli)
 Like valarray, lets you do vec[slice] to get a VectorSlice. More...
 
T & operator[] (size_t i)
 Non-const operator []. More...
 
operator[] (size_t i) const
 Const operator []. More...
 
Vectorresize (const size_t index)
 
Vectorresize (const size_t index, const T defaultValue)
 resize with new default value More...
 
size_t size () const
 STL size. More...
 
std::vector< T > toStdVector ()
 
 Vector ()
 Default constructor. More...
 
template<class E >
 Vector (const ConstVectorBase< T, E > &r)
 
template<class E >
 Vector (const ConstVectorBase< T, E > &vec, size_t top, size_t num)
 subvector constructor More...
 
 Vector (const std::valarray< T > &r)
 
 Vector (const Vector &r)
 
 Vector (size_t siz)
 Constructor given an initial size. More...
 
 Vector (size_t siz, const T defaultValue)
 
 ~Vector ()
 Destructor. More...
 
- Public Member Functions inherited from gnsstk::RefVectorBase< T, Vector< T > >
T & operator() (size_t i)
 returns a modifiable version of the element at index i. More...
 
const Vector< T > operator- () const
 unary minus: multiplies each element in this matrix by -1. More...
 
T & operator[] (size_t i)
 returns a modifiable version of the element at index i. More...
 
 RefVectorBase ()
 constructor More...
 
 VecBaseNewAssignOperator (assignFrom,=)
 
 VecBaseNewAssignOperator (operator*=, *=)
 
 VecBaseNewAssignOperator (operator+=,+=)
 
 VecBaseNewAssignOperator (operator-=, -=)
 
 VecBaseNewAssignOperator (operator/=,/=)
 
Vector< T > & zeroize ()
 
- Public Member Functions inherited from gnsstk::ConstVectorBase< T, Vector< T > >
 ConstVectorBase ()
 Constructor. More...
 
operator() (size_t i) const
 returns the element at index i More...
 
operator[] (size_t i) const
 returns the element at index i More...
 
size_t size () const
 Returns the size of the base class. More...
 

Public Attributes

const typedef T * const_iterator
 STL const iterator type. More...
 
const typedef T & const_reference
 STL const reference type. More...
 

Private Member Functions

bool rangeCheck (const size_t index) const
 

Private Attributes

size_t s
 The size of the vector. More...
 
T * v
 The vector. More...
 

Additional Inherited Members

- Static Public Attributes inherited from gnsstk::RefVectorBaseHelper
static GNSSTK_EXPORT double zeroTolerance = 10e-10
 
- Protected Member Functions inherited from gnsstk::RefVectorBase< T, Vector< T > >
T & vecRef (size_t i)
 
- Protected Member Functions inherited from gnsstk::ConstVectorBase< T, Vector< T > >
constVectorRef (size_t i) const
 

Member Typedef Documentation

◆ iterator

template<class T >
typedef T* gnsstk::Vector< T >::iterator

STL iterator type.

Definition at line 77 of file Vector.hpp.

◆ reference

template<class T >
typedef T& gnsstk::Vector< T >::reference

STL reference type.

Definition at line 73 of file Vector.hpp.

◆ value_type

template<class T >
typedef T gnsstk::Vector< T >::value_type

STL value type.

Definition at line 71 of file Vector.hpp.

Constructor & Destructor Documentation

◆ Vector() [1/7]

template<class T >
gnsstk::Vector< T >::Vector ( )
inline

Default constructor.

Definition at line 82 of file Vector.hpp.

◆ Vector() [2/7]

template<class T >
gnsstk::Vector< T >::Vector ( size_t  siz)
inline

Constructor given an initial size.

Definition at line 85 of file Vector.hpp.

◆ Vector() [3/7]

template<class T >
gnsstk::Vector< T >::Vector ( size_t  siz,
const defaultValue 
)
inline

Constructor given an initial size and default value for all elements.

Definition at line 100 of file Vector.hpp.

◆ Vector() [4/7]

template<class T >
template<class E >
gnsstk::Vector< T >::Vector ( const ConstVectorBase< T, E > &  r)
inline

Copy constructor from a ConstVectorBase type.

Definition at line 116 of file Vector.hpp.

◆ Vector() [5/7]

template<class T >
gnsstk::Vector< T >::Vector ( const Vector< T > &  r)
inline

Copy constructor.

Definition at line 131 of file Vector.hpp.

◆ Vector() [6/7]

template<class T >
gnsstk::Vector< T >::Vector ( const std::valarray< T > &  r)
inline

Valarray constructor

Definition at line 146 of file Vector.hpp.

◆ Vector() [7/7]

template<class T >
template<class E >
gnsstk::Vector< T >::Vector ( const ConstVectorBase< T, E > &  vec,
size_t  top,
size_t  num 
)
inline

subvector constructor

Definition at line 161 of file Vector.hpp.

◆ ~Vector()

template<class T >
gnsstk::Vector< T >::~Vector ( )
inline

Destructor.

Definition at line 187 of file Vector.hpp.

Member Function Documentation

◆ begin() [1/2]

template<class T >
iterator gnsstk::Vector< T >::begin ( )
inline

STL iterator begin.

Definition at line 193 of file Vector.hpp.

◆ begin() [2/2]

template<class T >
const_iterator gnsstk::Vector< T >::begin ( ) const
inline

STL const iterator begin.

Definition at line 195 of file Vector.hpp.

◆ empty()

template<class T >
bool gnsstk::Vector< T >::empty ( ) const
inline

STL empty.

Definition at line 205 of file Vector.hpp.

◆ end() [1/2]

template<class T >
iterator gnsstk::Vector< T >::end ( )
inline

STL iterator end.

Definition at line 197 of file Vector.hpp.

◆ end() [2/2]

template<class T >
const_iterator gnsstk::Vector< T >::end ( ) const
inline

STL const iterator end.

Definition at line 199 of file Vector.hpp.

◆ front() [1/2]

template<class T >
value_type gnsstk::Vector< T >::front ( )
inline

STL front.

Definition at line 201 of file Vector.hpp.

◆ front() [2/2]

template<class T >
const_reference gnsstk::Vector< T >::front ( ) const
inline

STL const front.

Definition at line 203 of file Vector.hpp.

◆ max_size()

template<class T >
size_t gnsstk::Vector< T >::max_size ( ) const
inline

STL max_size.

Definition at line 209 of file Vector.hpp.

◆ operator&&() [1/2]

template<class T >
Vector gnsstk::Vector< T >::operator&& ( const T &  b)
inline

Returns the concatenation of this Vector and a scalar of type T.

Definition at line 340 of file Vector.hpp.

◆ operator&&() [2/2]

template<class T >
Vector gnsstk::Vector< T >::operator&& ( const Vector< T > &  b)
inline

Returns the concatenation of this Vector and Vector b.

Definition at line 322 of file Vector.hpp.

◆ operator()() [1/2]

template<class T >
T& gnsstk::Vector< T >::operator() ( size_t  i)
inline

Non-const operator ()

Definition at line 218 of file Vector.hpp.

◆ operator()() [2/2]

template<class T >
T gnsstk::Vector< T >::operator() ( size_t  i) const
inline

Const operator ()

Definition at line 221 of file Vector.hpp.

◆ operator<<() [1/2]

template<class T >
Vector& gnsstk::Vector< T >::operator<< ( const T &  b)
inline

Returns the concatenation of this Vector and a scalar of type T.

Definition at line 316 of file Vector.hpp.

◆ operator<<() [2/2]

template<class T >
Vector& gnsstk::Vector< T >::operator<< ( const Vector< T > &  b)
inline

Definition at line 296 of file Vector.hpp.

◆ operator=() [1/6]

template<class T >
template<class E >
Vector& gnsstk::Vector< T >::operator= ( const ConstVectorBase< T, E > &  x)
inline

*this will be resized if it isn't as large as x.

Definition at line 234 of file Vector.hpp.

◆ operator=() [2/6]

template<class T >
Vector& gnsstk::Vector< T >::operator= ( const std::valarray< T > &  x)
inline

*this will be resized if it isn't as large as x.

Definition at line 238 of file Vector.hpp.

◆ operator=() [3/6]

template<class T >
Vector& gnsstk::Vector< T >::operator= ( const std::vector< T > &  x)
inline

*this will be cleared and resized as necessary

Definition at line 248 of file Vector.hpp.

◆ operator=() [4/6]

template<class T >
Vector& gnsstk::Vector< T >::operator= ( const T *  x)
inline

Only (*this).size() elements will be assigned.

Definition at line 244 of file Vector.hpp.

◆ operator=() [5/6]

template<class T >
Vector& gnsstk::Vector< T >::operator= ( const x)
inline

Only (*this).size() elements will be assigned.

Definition at line 241 of file Vector.hpp.

◆ operator=() [6/6]

template<class T >
Vector& gnsstk::Vector< T >::operator= ( const Vector< T > &  x)
inline

*this will be resized if it isn't as large as x.

Definition at line 229 of file Vector.hpp.

◆ operator[]() [1/3]

template<class T >
VectorSlice<T> gnsstk::Vector< T >::operator[] ( const std::slice &  sli)
inline

Like valarray, lets you do vec[slice] to get a VectorSlice.

Definition at line 225 of file Vector.hpp.

◆ operator[]() [2/3]

template<class T >
T& gnsstk::Vector< T >::operator[] ( size_t  i)
inline

Non-const operator [].

Definition at line 212 of file Vector.hpp.

◆ operator[]() [3/3]

template<class T >
T gnsstk::Vector< T >::operator[] ( size_t  i) const
inline

Const operator [].

Definition at line 215 of file Vector.hpp.

◆ rangeCheck()

template<class T >
bool gnsstk::Vector< T >::rangeCheck ( const size_t  index) const
inlineprivate

Definition at line 360 of file Vector.hpp.

◆ resize() [1/2]

template<class T >
Vector& gnsstk::Vector< T >::resize ( const size_t  index)
inline

Resizes the vector. if index > size, the vector will be erased and the contents destroyed.

Definition at line 262 of file Vector.hpp.

◆ resize() [2/2]

template<class T >
Vector& gnsstk::Vector< T >::resize ( const size_t  index,
const defaultValue 
)
inline

resize with new default value

Definition at line 279 of file Vector.hpp.

◆ size()

template<class T >
size_t gnsstk::Vector< T >::size ( ) const
inline

STL size.

Definition at line 207 of file Vector.hpp.

◆ toStdVector()

template<class T >
std::vector<T> gnsstk::Vector< T >::toStdVector ( )
inline

Definition at line 288 of file Vector.hpp.

Member Data Documentation

◆ const_iterator

template<class T >
const typedef T* gnsstk::Vector< T >::const_iterator

STL const iterator type.

Definition at line 79 of file Vector.hpp.

◆ const_reference

template<class T >
const typedef T& gnsstk::Vector< T >::const_reference

STL const reference type.

Definition at line 75 of file Vector.hpp.

◆ s

template<class T >
size_t gnsstk::Vector< T >::s
private

The size of the vector.

Definition at line 372 of file Vector.hpp.

◆ v

template<class T >
T* gnsstk::Vector< T >::v
private

The vector.

Definition at line 370 of file Vector.hpp.


The documentation for this class was generated from the following file:


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:46