Namelist Class Reference

#include <Namelist.hpp>

List of all members.


Detailed Description

class Namelist.

A Namelist is simply an ordered set of unique strings ('names' or 'labels') of any length. Namelists are used to label or identify elements of Vectors or Matrix rows and columns. Namelist is particularly useful in class SRI, which includes a Matrix and Vector that hold state and covariance information in an estimation problem; SRI include a Namelist which associates readable labels with the elements of the state and covariance.

Definition at line 122 of file Namelist.hpp.

Public Member Functions

 Namelist (void)
 empty constructor
 Namelist (const unsigned int &)
 constructor given dimension - creates default labels
 Namelist (const std::vector< std::string > &)
 explicit constructor - only a unique subset of the input will be included.
 Namelist (const Namelist &names)
 copy constructor
 ~Namelist (void)
 destructor
Namelistoperator= (const Namelist &right)
 operator=
Namelistoperator+= (const std::string &)
 add a single name to the Namelist; do nothing if the name is not unique.
Namelistoperator-= (const std::string &)
 remove a name from the Namelist; does nothing if the name is not found.
void swap (const unsigned int &, const unsigned int &)
 swap two elements, as given by their indexes; no effect if either index is out of range.
void sort (void)
 reorder the list by sorting
void resize (unsigned int)
 resize the list by either truncation or adding default names.
void randomize (long seed=0)
 randomize the list
void clear (void)
 empty the list
bool valid (void) const
 is the Namelist valid? checks for repeated names (? not possible to create an invalid Namelist?)
bool contains (const std::string &) const
 does the Namelist contain the input name?
Namelistoperator &= (const Namelist &)
 replace this with (this & input)
Namelistoperator|= (const Namelist &)
 replace this with (this | input)
Namelistoperator^= (const Namelist &)
 replace this with (this ^ input)
LabelledMatrix operator() (Matrix< double > &m)
 bind a Namelist to a Matrix<double> before sending it to an output stream, to get a 'labelled display' of the matrix.
LabelledVector operator() (Vector< double > &v)
 bind a Namelist to a Vector<double> before sending it to an output stream, to get a 'labelled display' of the vector.
unsigned int size (void) const
 return the size of the list.
std::string getName (const unsigned int) const
 access to a specific name, given its index.
bool setName (const unsigned int, const std::string &)
 assign a specific name, given its index; no effect if the name is not unique; return true if successful.
int index (const std::string &) const
 return the index of the name in the list that matches the input, -1 if not found.

Public Attributes

std::vector< std::string > labels
 vector of names (strings)

Friends

class SRI
std::ostream & operator<< (std::ostream &, const LabelledMatrix &)
std::ostream & operator<< (std::ostream &, const LabelledVector &)
bool operator== (const Namelist &, const Namelist &)
 are two Namelists identical, ignoring permutations?
bool operator!= (const Namelist &, const Namelist &)
 are two Namelists different, ignoring permutations?
bool identical (const Namelist &, const Namelist &)
 are two Namelists exactly identical, even considering permutations?
Namelist operator & (const Namelist &, const Namelist &)
 construct the subset Namelist which is common to the two inputs (AND)
Namelist operator| (const Namelist &, const Namelist &)
 merge two Namelists, i.e. construct a non-redundant combination (OR)
Namelist operator^ (const Namelist &, const Namelist &)
 construct the subset Namelist which is NOT common to two others (XOR)
std::ostream & operator<< (std::ostream &s, const Namelist &)
 output operator


Constructor & Destructor Documentation

Namelist void   )  [inline]
 

empty constructor

Definition at line 128 of file Namelist.hpp.

Namelist const unsigned int &   ) 
 

constructor given dimension - creates default labels

Definition at line 67 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Namelist const std::vector< std::string > &   ) 
 

explicit constructor - only a unique subset of the input will be included.

Definition at line 83 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Namelist const Namelist names  )  [inline]
 

copy constructor

Definition at line 134 of file Namelist.hpp.

References Namelist::labels.

~Namelist void   )  [inline]
 

destructor

Definition at line 136 of file Namelist.hpp.

References Namelist::clear().


Member Function Documentation

void clear void   )  [inline]
 

empty the list

Definition at line 156 of file Namelist.hpp.

Referenced by Namelist::~Namelist().

bool contains const std::string &   )  const
 

does the Namelist contain the input name?

Definition at line 191 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Referenced by Namelist::operator &=(), Namelist::operator+=(), Namelist::operator^=(), Namelist::operator|=(), Namelist::resize(), and Namelist::setName().

string getName const unsigned  int  )  const
 

access to a specific name, given its index.

returns 'out-of-range' if the index is out of range.

Definition at line 327 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Referenced by SRI::getName(), and gpstk::operator<<().

int index const std::string &   )  const
 

return the index of the name in the list that matches the input, -1 if not found.

Definition at line 352 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Referenced by SRI::index(), and SRI::operator+=().

Namelist & operator &= const Namelist  ) 
 

replace this with (this & input)

Definition at line 275 of file Namelist.cpp.

References Namelist::contains(), GPSTK_RETHROW, and Namelist::labels.

LabelledVector operator() Vector< double > &  v  )  [inline]
 

bind a Namelist to a Vector<double> before sending it to an output stream, to get a 'labelled display' of the vector.

Definition at line 190 of file Namelist.hpp.

LabelledMatrix operator() Matrix< double > &  m  )  [inline]
 

bind a Namelist to a Matrix<double> before sending it to an output stream, to get a 'labelled display' of the matrix.

Definition at line 185 of file Namelist.hpp.

Namelist & operator+= const std::string &   ) 
 

add a single name to the Namelist; do nothing if the name is not unique.

Definition at line 98 of file Namelist.cpp.

References Namelist::contains(), GPSTK_RETHROW, and Namelist::labels.

Namelist & operator-= const std::string &   ) 
 

remove a name from the Namelist; does nothing if the name is not found.

Definition at line 109 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Namelist& operator= const Namelist right  )  [inline]
 

operator=

Definition at line 139 of file Namelist.hpp.

References Namelist::labels.

Namelist & operator^= const Namelist  ) 
 

replace this with (this ^ input)

Definition at line 302 of file Namelist.cpp.

References Namelist::contains(), GPSTK_RETHROW, Namelist::labels, and Namelist::size().

Namelist & operator|= const Namelist  ) 
 

replace this with (this | input)

Definition at line 289 of file Namelist.cpp.

References Namelist::contains(), GPSTK_RETHROW, Namelist::labels, and Namelist::size().

void randomize long  seed = 0  ) 
 

randomize the list

Definition at line 169 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

void resize unsigned  int  ) 
 

resize the list by either truncation or adding default names.

Definition at line 146 of file Namelist.cpp.

References Namelist::contains(), GPSTK_RETHROW, and Namelist::labels.

bool setName const unsigned  int,
const std::string & 
 

assign a specific name, given its index; no effect if the name is not unique; return true if successful.

Definition at line 339 of file Namelist.cpp.

References Namelist::contains(), GPSTK_RETHROW, and Namelist::labels.

Referenced by SRI::setName().

unsigned int size void   )  const [inline]
 

return the size of the list.

Definition at line 196 of file Namelist.hpp.

Referenced by gpstk::identical(), SRI::operator+=(), gpstk::operator<<(), gpstk::operator==(), Namelist::operator^=(), and Namelist::operator|=().

void sort void   ) 
 

reorder the list by sorting

Definition at line 136 of file Namelist.cpp.

References GPSTK_RETHROW, Namelist::labels, and gpstk::sort().

void swap const unsigned int &  ,
const unsigned int & 
 

swap two elements, as given by their indexes; no effect if either index is out of range.

Definition at line 123 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.

Referenced by SRI::split().

bool valid void   )  const
 

is the Namelist valid? checks for repeated names (? not possible to create an invalid Namelist?)

Definition at line 179 of file Namelist.cpp.

References GPSTK_RETHROW, and Namelist::labels.


Friends And Related Function Documentation

bool identical const Namelist N1,
const Namelist N2
[friend]
 

are two Namelists exactly identical, even considering permutations?

Definition at line 228 of file Namelist.cpp.

Namelist operator & const Namelist N1,
const Namelist N2
[friend]
 

construct the subset Namelist which is common to the two inputs (AND)

Definition at line 242 of file Namelist.cpp.

bool operator!= const Namelist N1,
const Namelist N2
[friend]
 

are two Namelists different, ignoring permutations?

Definition at line 219 of file Namelist.cpp.

std::ostream& operator<< std::ostream &  s,
const Namelist
[friend]
 

output operator

std::ostream& operator<< std::ostream &  ,
const LabelledVector
[friend]
 

std::ostream& operator<< std::ostream &  ,
const LabelledMatrix
[friend]
 

bool operator== const Namelist N1,
const Namelist N2
[friend]
 

are two Namelists identical, ignoring permutations?

Definition at line 202 of file Namelist.cpp.

Namelist operator^ const Namelist N1,
const Namelist N2
[friend]
 

construct the subset Namelist which is NOT common to two others (XOR)

Definition at line 264 of file Namelist.cpp.

Namelist operator| const Namelist N1,
const Namelist N2
[friend]
 

merge two Namelists, i.e. construct a non-redundant combination (OR)

Definition at line 253 of file Namelist.cpp.

friend class SRI [friend]
 

Definition at line 123 of file Namelist.hpp.


Member Data Documentation

std::vector<std::string> labels
 

vector of names (strings)

Definition at line 221 of file Namelist.hpp.

Referenced by Namelist::contains(), Namelist::getName(), gpstk::identical(), Namelist::index(), Namelist::Namelist(), Namelist::operator &=(), SRI::operator+=(), Namelist::operator+=(), Namelist::operator-=(), gpstk::operator<<(), Namelist::operator=(), gpstk::operator==(), Namelist::operator^=(), Namelist::operator|=(), Namelist::randomize(), Namelist::resize(), Namelist::setName(), Namelist::sort(), SRI::split(), Namelist::swap(), and Namelist::valid().


The documentation for this class was generated from the following files:
Generated on Wed Feb 8 03:31:27 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1