VieSched++
VieVS VLBI Scheduling Software
VieVS::util Namespace Reference

Functions

unsigned long getNumberOfStations (const boost::property_tree::ptree &xml)
 get number of stations from xml file More...
 
std::vector< std::string > getStationNames (const boost::property_tree::ptree &xml)
 get station names from xml file More...
 
std::string ra2dms (double angle)
 convert right ascension to string More...
 
std::string ra2dms_astFormat (double angle)
 convert right ascension to string More...
 
std::string dc2hms (double angle)
 convert declination to string More...
 
std::string dc2hms_astFormat (double angle)
 convert declination to string More...
 
double freqency2wavelenth (double frequency)
 transforms frequency to wavelength More...
 
double wavelength2frequency (double wavelength)
 transforms wavelength to frequency More...
 
double wrap2twoPi (double angle)
 wrap angle to interval [0, 2*pi) More...
 
double wrap2pi (double angle)
 wrap angle to interval [-pi, pi) More...
 
int duration (const boost::posix_time::ptime &start, const boost::posix_time::ptime &end)
 calculate duration between two time points More...
 
std::string version ()
 software version number More...
 
template<typename T >
absDiff (const T &a, const T &b)
 absolute difference between two points More...
 
template<typename T >
std::vector< int > sortIndexes (const std::vector< T > &v)
 indices of sorted vector elements More...
 
template<typename K , typename V >
bool valueExists (std::map< K, V > mapOfElemen, V value)
 checks if a value already exists in a map More...
 
void outputObjectList (const std::string &title, const std::vector< std::string > &names, std::ofstream &of, unsigned long indents=4)
 outputs list of objects More...
 
std::string weekDay2string (int weekday)
 convert weekday integer to string More...
 
std::string month2string (int month)
 convert month integer to string More...
 
template<typename A , typename B >
std::pair< B, A > flip_pair (const std::pair< A, B > &p)
 flip pair More...
 
template<typename A , typename B >
std::map< B, A > flip_map (const std::map< A, B > &src)
 flip map More...
 
char numberOfScans2char (long n)
 converts number of scans (within 900 sec) to character for output tables More...
 
std::string numberOfScans2char_header ()
 translation table for number of scans (within 900 sec) to character for output tables More...
 
void simplify_inline (std::string &str)
 simplifies the string inline More...
 
std::string simplify (const std::string &str)
 generates simplified version of string More...
 
std::string milliseconds2string (long long int usec, bool forceSeconds=false)
 converts microseconds to string More...
 
std::string version2prefix (int version)
 version number to prefix More...
 

Function Documentation

template<typename T >
T VieVS::util::absDiff ( const T &  a,
const T &  b 
)

absolute difference between two points

Author
Matthias Schartner

prevents underflow errors for unsigned types

Template Parameters
Ttemplate type
Parameters
afirst value
bsecond value
Returns
absolute difference

Here is the caller graph for this function:

string VieVS::util::dc2hms ( double  angle)

convert declination to string

Author
Matthias Schartner

example output: +00° 00' 00.00"

Parameters
angledeclination angle in radians
Returns
output string

Here is the caller graph for this function:

string VieVS::util::dc2hms_astFormat ( double  angle)

convert declination to string

Author
Matthias Schartner

example output: +00° 00' 00.00"

Parameters
angledeclination angle in radians
Returns
output string

Here is the caller graph for this function:

int VieVS::util::duration ( const boost::posix_time::ptime &  start,
const boost::posix_time::ptime &  end 
)

calculate duration between two time points

Author
Matthias Schartner
Parameters
startstart time point
endend time point
Returns
duration between time points in seconds

Here is the caller graph for this function:

template<typename A , typename B >
std::map<B, A> VieVS::util::flip_map ( const std::map< A, B > &  src)

flip map

Author
Matthias Schartner
Parameters
srcmap to flip
Returns
flipped map

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename A , typename B >
std::pair<B, A> VieVS::util::flip_pair ( const std::pair< A, B > &  p)

flip pair

Author
Matthias Schartner
Parameters
ppair to flip
Returns
flipped pair
double VieVS::util::freqency2wavelenth ( double  frequency)

transforms frequency to wavelength

Author
Matthias Schartner

assuming speed of light wave velocity

Parameters
frequencyfrequency in Hz
Returns
wavelength in m

Here is the caller graph for this function:

unsigned long VieVS::util::getNumberOfStations ( const boost::property_tree::ptree &  xml)

get number of stations from xml file

Author
Matthias Schartner
Parameters
xmlproperty tree
Returns
number of stations

Here is the caller graph for this function:

std::vector< std::string > VieVS::util::getStationNames ( const boost::property_tree::ptree &  xml)

get station names from xml file

Author
Matthias Schartner
Parameters
xmlproperty tree
Returns
vector of station names

Here is the caller graph for this function:

std::string VieVS::util::milliseconds2string ( long long int  usec,
bool  forceSeconds = false 
)

converts microseconds to string

Author
Matthias Schartner
Parameters
usecmicroseconds
forceSecondsset format to seconds only
Returns
return duration

Here is the caller graph for this function:

std::string VieVS::util::month2string ( int  month)

convert month integer to string

Author
Matthias Schartner

1 = JAN 2 = FEB...

Parameters
monthmonth in integer format
Returns
month in string format

Here is the caller graph for this function:

char VieVS::util::numberOfScans2char ( long  n)

converts number of scans (within 900 sec) to character for output tables

Author
Matthias Schartner
Parameters
nnumber of scans (within 900 sec)
Returns
output character

Here is the caller graph for this function:

std::string VieVS::util::numberOfScans2char_header ( )

translation table for number of scans (within 900 sec) to character for output tables

Author
Matthias Schartner
Returns
translation table

Here is the call graph for this function:

Here is the caller graph for this function:

void VieVS::util::outputObjectList ( const std::string &  title,
const std::vector< std::string > &  names,
std::ofstream &  of,
unsigned long  indents = 4 
)

outputs list of objects

Author
Matthias Schartner
Parameters
titleoutput title
namesobject names
ofoutstream object
indentsnumber of indents

Here is the caller graph for this function:

string VieVS::util::ra2dms ( double  angle)

convert right ascension to string

Author
Matthias Schartner

example output: 00h 00m 00.00s

Parameters
angleright ascension angle in radians
Returns
output string

Here is the caller graph for this function:

std::string VieVS::util::ra2dms_astFormat ( double  angle)

convert right ascension to string

Author
Matthias Schartner

example output: 00:00:00.000

Parameters
angleright ascension angle in radians
Returns
output string

Here is the caller graph for this function:

std::string VieVS::util::simplify ( const std::string &  str)

generates simplified version of string

Author
Matthias Schartner

simplify meaning that multiple whitespaces are converted to only one whitespace

Parameters
strstring that should be processed

Here is the caller graph for this function:

void VieVS::util::simplify_inline ( std::string &  str)

simplifies the string inline

Author
Matthias Schartner

simplify meaning that multiple whitespaces are converted to only one whitespace

Parameters
strstring that should be processed

Here is the caller graph for this function:

template<typename T >
std::vector<int> VieVS::util::sortIndexes ( const std::vector< T > &  v)

indices of sorted vector elements

Author
Matthias Schartner

Example: input {2.1, 1.3, 0.3, 5.3} would return {2, 1, 0, 3}

Template Parameters
Tvector type
Parameters
vvector
Returns
indices of sorted vector elements

Here is the caller graph for this function:

template<typename K , typename V >
bool VieVS::util::valueExists ( std::map< K, V >  mapOfElemen,
value 
)

checks if a value already exists in a map

Author
Matthias Schartner
Template Parameters
Kkey type
Vvalue type
Parameters
mapOfElemencurrent map
valuetarget value
Returns
true if target value exists, otherwise false

Here is the call graph for this function:

Here is the caller graph for this function:

string VieVS::util::version ( )

software version number

Author
Matthias Schartner
Returns
software version number

Here is the caller graph for this function:

std::string VieVS::util::version2prefix ( int  version)

version number to prefix

Author
Matthias Schartner
Parameters
versionversion number
Returns
file prefix

Here is the caller graph for this function:

double VieVS::util::wavelength2frequency ( double  wavelength)

transforms wavelength to frequency

Author
Matthias Schartner

assuming speed of light wave velocity

Parameters
wavelengthwavelength in m
Returns
frequency in Hz

Here is the caller graph for this function:

std::string VieVS::util::weekDay2string ( int  weekday)

convert weekday integer to string

Author
Matthias Schartner

0 = SUN 1 = MON 2 = TUE...

Parameters
weekdayweekday in integer format
Returns
weekday in string format

Here is the caller graph for this function:

double VieVS::util::wrap2pi ( double  angle)

wrap angle to interval [-pi, pi)

Author
Matthias Schartner
Parameters
angleinput angle in radians
Returns
output angle

Here is the caller graph for this function:

double VieVS::util::wrap2twoPi ( double  angle)

wrap angle to interval [0, 2*pi)

Author
Matthias Schartner
Parameters
angleinput angle in radians
Returns
output angle

Here is the caller graph for this function: