Public Member Functions | Public Attributes | Friends | List of all members
gnsstk::Namelist Class Reference

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 287 of file Namelist.hpp.

#include <Namelist.hpp>

Public Member Functions

void clear ()
 empty the list More...
 
bool contains (const std::string &name) const
 does the Namelist contain the input name? More...
 
std::string getName (const unsigned int in) const
 
int index (const std::string &name) const
 
 Namelist ()
 empty constructor More...
 
 Namelist (const Namelist &names)
 copy constructor More...
 
 Namelist (const std::vector< std::string > &names)
 
 Namelist (const unsigned int &n)
 constructor given dimension - creates default labels More...
 
Namelistoperator&= (const Namelist &N)
 replace this with (this& input) More...
 
LabeledMatrix operator() (Matrix< double > &m)
 
LabeledVector operator() (Vector< double > &v)
 
Namelistoperator+= (const Namelist &right)
 add entire Namelist to this using operator+=(string) More...
 
Namelistoperator+= (const std::string &name)
 
Namelistoperator-= (const std::string &name)
 
Namelistoperator= (const Namelist &right)
 operator= More...
 
Namelistoperator^= (const Namelist &N)
 replace this with (this ^ input) More...
 
Namelistoperator|= (const Namelist &N)
 replace this with (this | input) More...
 
void randomize (long seed=0)
 randomize the list More...
 
void resize (unsigned int n)
 resize the list by either truncation or adding default names. More...
 
bool setName (const unsigned int in, const std::string &name)
 
unsigned int size () const
 return the size of the list. More...
 
void sort ()
 reorder the list by sorting More...
 
void swap (const unsigned int &i, const unsigned int &j)
 
bool valid () const
 is the Namelist valid? checks for repeated names More...
 
 ~Namelist ()
 destructor More...
 

Public Attributes

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

Friends

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

Constructor & Destructor Documentation

◆ Namelist() [1/4]

gnsstk::Namelist::Namelist ( )
inline

empty constructor

Definition at line 295 of file Namelist.hpp.

◆ Namelist() [2/4]

gnsstk::Namelist::Namelist ( const unsigned int &  n)

constructor given dimension - creates default labels

Definition at line 67 of file Namelist.cpp.

◆ Namelist() [3/4]

gnsstk::Namelist::Namelist ( const std::vector< std::string > &  names)

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

Definition at line 88 of file Namelist.cpp.

◆ Namelist() [4/4]

gnsstk::Namelist::Namelist ( const Namelist names)
inline

copy constructor

Definition at line 305 of file Namelist.hpp.

◆ ~Namelist()

gnsstk::Namelist::~Namelist ( )
inline

destructor

Definition at line 308 of file Namelist.hpp.

Member Function Documentation

◆ clear()

void gnsstk::Namelist::clear ( )
inline

empty the list

Definition at line 354 of file Namelist.hpp.

◆ contains()

bool gnsstk::Namelist::contains ( const std::string &  name) const

does the Namelist contain the input name?

Definition at line 264 of file Namelist.cpp.

◆ getName()

std::string gnsstk::Namelist::getName ( const unsigned int  in) const

access to a specific name, given its index. returns 'out-of-range' if the index is out of range.

Definition at line 485 of file Namelist.cpp.

◆ index()

int gnsstk::Namelist::index ( const std::string &  name) const

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

Definition at line 530 of file Namelist.cpp.

◆ operator&=()

Namelist & gnsstk::Namelist::operator&= ( const Namelist N)

replace this with (this& input)

Definition at line 402 of file Namelist.cpp.

◆ operator()() [1/2]

LabeledMatrix gnsstk::Namelist::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 392 of file Namelist.hpp.

◆ operator()() [2/2]

LabeledVector gnsstk::Namelist::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 400 of file Namelist.hpp.

◆ operator+=() [1/2]

Namelist& gnsstk::Namelist::operator+= ( const Namelist right)
inline

add entire Namelist to this using operator+=(string)

Definition at line 322 of file Namelist.hpp.

◆ operator+=() [2/2]

Namelist & gnsstk::Namelist::operator+= ( const std::string &  name)

add a single name to the Namelist

Exceptions
ifthe name is not unique

Definition at line 114 of file Namelist.cpp.

◆ operator-=()

Namelist & gnsstk::Namelist::operator-= ( const std::string &  name)

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

Definition at line 132 of file Namelist.cpp.

◆ operator=()

Namelist& gnsstk::Namelist::operator= ( const Namelist right)
inline

operator=

Definition at line 311 of file Namelist.hpp.

◆ operator^=()

Namelist & gnsstk::Namelist::operator^= ( const Namelist N)

replace this with (this ^ input)

Definition at line 447 of file Namelist.cpp.

◆ operator|=()

Namelist & gnsstk::Namelist::operator|= ( const Namelist N)

replace this with (this | input)

Definition at line 425 of file Namelist.cpp.

◆ randomize()

void gnsstk::Namelist::randomize ( long  seed = 0)

randomize the list

Definition at line 220 of file Namelist.cpp.

◆ resize()

void gnsstk::Namelist::resize ( unsigned int  n)

resize the list by either truncation or adding default names.

Definition at line 187 of file Namelist.cpp.

◆ setName()

bool gnsstk::Namelist::setName ( const unsigned int  in,
const std::string &  name 
)

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

Definition at line 504 of file Namelist.cpp.

◆ size()

unsigned int gnsstk::Namelist::size ( ) const
inline

return the size of the list.

Definition at line 408 of file Namelist.hpp.

◆ sort()

void gnsstk::Namelist::sort ( )

reorder the list by sorting

Definition at line 173 of file Namelist.cpp.

◆ swap()

void gnsstk::Namelist::swap ( const unsigned int &  i,
const unsigned int &  j 
)

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

Definition at line 150 of file Namelist.cpp.

◆ valid()

bool gnsstk::Namelist::valid ( ) const

is the Namelist valid? checks for repeated names

Definition at line 247 of file Namelist.cpp.

Friends And Related Function Documentation

◆ identical

bool identical ( const Namelist N1,
const Namelist N2 
)
friend

are two Namelists exactly identical, even considering permutations?

Definition at line 331 of file Namelist.cpp.

◆ operator!=

bool operator!= ( const Namelist N1,
const Namelist N2 
)
friend

are two Namelists different, ignoring permutations?

Definition at line 318 of file Namelist.cpp.

◆ operator&

Namelist operator& ( const Namelist N1,
const Namelist N2 
)
friend

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

Definition at line 357 of file Namelist.cpp.

◆ operator<< [1/3]

std::ostream& operator<< ( std::ostream &  os,
const LabeledMatrix N 
)
friend

output ostream operator for LabeledMatrix

Definition at line 637 of file Namelist.cpp.

◆ operator<< [2/3]

std::ostream& operator<< ( std::ostream &  os,
const LabeledVector N 
)
friend

output ostream operator for LabeledVector

◆ operator<< [3/3]

std::ostream& operator<< ( std::ostream &  os,
const Namelist N 
)
friend

output ostream operator

◆ operator==

bool operator== ( const Namelist N1,
const Namelist N2 
)
friend

are two Namelists identical, ignoring permutations?

Definition at line 282 of file Namelist.cpp.

◆ operator^

Namelist operator^ ( const Namelist N1,
const Namelist N2 
)
friend

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

Definition at line 387 of file Namelist.cpp.

◆ operator|

Namelist operator| ( const Namelist N1,
const Namelist N2 
)
friend

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

Definition at line 372 of file Namelist.cpp.

◆ SRI

friend class SRI
friend

Definition at line 289 of file Namelist.hpp.

Member Data Documentation

◆ labels

std::vector<std::string> gnsstk::Namelist::labels

vector of names (strings)

Definition at line 437 of file Namelist.hpp.


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


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