TLELib  0.1.0
tlelib Namespace Reference

Main namespace of TLELib. All objects and functions of this library are located in the 'tlelib' namespace. More...

Classes

class  tle_too_short_string
 The exception object, generated when the string is too short and the substring or a symbol cannot be taken from it at the given position. More...
class  tle_invalid_format
 The exception object, generated when the string cannot be converted into the specified type. More...
class  tle_checksum_error
 The exception object, generated when the checksum of the string is invalid. More...
class  tle_node
 Main object of TLELib library. It represents the data, specified in the one measurement in TLE file. More...

Functions

std::string int2string (const int val, const std::size_t fieldLength=0, const bool leftAlign=true)
 Convert a variable of 'int' type into variable of 'std::string' type.
std::string double2string (const double val, const std::size_t fieldLength, const std::size_t precission=6, const bool scientific=false, const bool decimalPointAssumed=false, const bool leftAlign=true)
 Convert a variable of 'double' type into variable of 'std::string' type.
std::string string2string (const std::string &str, const std::size_t fieldLength, const bool leftAlign=true, const bool allowCutOff=true)
 Correct the length of a string: add the spece symbols or cut it off if it's necessary.
std::string date2string (const double date, const std::size_t fieldLength, const bool leftAlign=true)
 Convert a date, defined by the double value, into variable of 'std::string' type.
int string2int (const std::string &str)
 Convert a string into integer variable.
double string2double (const std::string &str)
 Convert a string into 'double' variable.
std::string trim (const std::string &str)
 Remove the spaces from the start and end of the given string.
char parseChar (const std::string *line, const std::size_t index)
 Take a symbol at the given position from the given string.
std::string parseString (const std::string *line, const std::size_t start, const std::size_t length)
 Take a substring of the specified length at the given position from the given string.
int parseInt (const std::string *line, const std::size_t start, const std::size_t length)
 Take a substring from the given string and convert it by the string2int() function.
double parseDouble (const std::string *line, const std::size_t start, const std::size_t length, const bool decimalPointAssumed=false)
 Take a substring from the given string and convert it by the string2double() function.
double string2date (const std::string &str)
 Convert a string into date: number of seconds (including fractional part) since Jan 1, UNIX_FIRST_YEAR.
int checksum (const std::string &str)
 Calculate the checksum for the given string, using the Modulo 10 algorithm.

Detailed Description

Main namespace of TLELib. All objects and functions of this library are located in the 'tlelib' namespace.


Function Documentation

int tlelib::checksum ( const std::string &  str)

Calculate the checksum for the given string, using the Modulo 10 algorithm.

Parameters:
str- the string, for which the checksum should be calculated
Returns:
Return the checksum of 'int' type.

Definition at line 313 of file tlefunc.cpp.

Referenced by tlelib::tle_node::check_line(), tlelib::tle_node::second_string(), and tlelib::tle_node::third_string().

std::string tlelib::date2string ( const double  date,
const std::size_t  fieldLength,
const bool  leftAlign = true 
)

Convert a date, defined by the double value, into variable of 'std::string' type.

Parameters:
date- the number of seconds since Jan 1, UNIX_FIRST_YEAR
fieldLength- length of the result string
leftAlign- aligment of the value in the string: true - at left side, false - at right side.
Returns:
An object of std::string type.

Definition at line 131 of file tlefunc.cpp.

References double2string(), and UNIX_FIRST_YEAR.

Referenced by tlelib::tle_node::second_string().

std::string tlelib::double2string ( const double  val,
const std::size_t  fieldLength,
const std::size_t  precission = 6,
const bool  scientific = false,
const bool  decimalPointAssumed = false,
const bool  leftAlign = true 
)

Convert a variable of 'double' type into variable of 'std::string' type.

Parameters:
val- a value of 'double' type
fieldLength- length of the result string
precission- the number of digits after decimal point
scientific- specifies, if the value should be presented in the scientific format. Note: in this format the 'e' symbol is not printed (i.e. 1-5 instead of 1e-5)
decimalPointAssumed- specifies whether it is necessary to output the value without decimal point. For example: 0157 instead of 0.0157 or 145-6 instead of 1.45-5.
leftAlign- aligment of the value in the string: true - at left side, false - at right side.
Returns:
An object of std::string type.

Definition at line 50 of file tlefunc.cpp.

References int2string(), string2double(), string2int(), string2string(), and trim().

Referenced by date2string(), tlelib::tle_node::second_string(), and tlelib::tle_node::third_string().

std::string tlelib::int2string ( const int  val,
const std::size_t  fieldLength = 0,
const bool  leftAlign = true 
)

Convert a variable of 'int' type into variable of 'std::string' type.

Parameters:
val- an integer value
fieldLength- length of the result string
leftAlign- aligment of the value in the string: true - at left side, false - at right side.
Returns:
An object of std::string type.

Definition at line 39 of file tlefunc.cpp.

References string2string(), and trim().

Referenced by double2string(), tlelib::tle_node::second_string(), and tlelib::tle_node::third_string().

char tlelib::parseChar ( const std::string *  line,
const std::size_t  index 
)

Take a symbol at the given position from the given string.

Parameters:
line- the given string
index- index of symbol
Returns:
A 'char' value.

Definition at line 197 of file tlefunc.cpp.

Referenced by tlelib::tle_node::classification(), and tlelib::tle_node::ephemeris_type().

double tlelib::parseDouble ( const std::string *  line,
const std::size_t  start,
const std::size_t  length,
const bool  decimalPointAssumed = false 
)

Take a substring from the given string and convert it by the string2double() function.

Parameters:
line- the given string
start- index of position, where the substring is started
length- length of the substring
decimalPointAssumed- specifies, if the value in the string is presented as a fractional part of the number.
Returns:
A value of 'double' type.

Definition at line 248 of file tlefunc.cpp.

References string2double(), and trim().

Referenced by tlelib::tle_node::BSTAR(), tlelib::tle_node::d2n(), tlelib::tle_node::dn(), tlelib::tle_node::e(), tlelib::tle_node::i(), tlelib::tle_node::M(), tlelib::tle_node::n(), tlelib::tle_node::Omega(), and tlelib::tle_node::omega().

int tlelib::parseInt ( const std::string *  line,
const std::size_t  start,
const std::size_t  length 
)

Take a substring from the given string and convert it by the string2int() function.

Parameters:
line- the given string
start- index of position, where the substring is started
length- length of the substring
Returns:
A value of 'int' type.

Definition at line 226 of file tlefunc.cpp.

References string2int(), and trim().

Referenced by tlelib::tle_node::element_number(), and tlelib::tle_node::revolution_number().

std::string tlelib::parseString ( const std::string *  line,
const std::size_t  start,
const std::size_t  length 
)

Take a substring of the specified length at the given position from the given string.

Parameters:
line- the given string
start- index of position, where the substring is started
length- length of the substring
Returns:
A value of 'std::string' type.

Definition at line 211 of file tlefunc.cpp.

Referenced by tlelib::tle_node::designator(), tlelib::tle_node::precise_epoch(), tlelib::tle_node::sat_name(), and tlelib::tle_node::sat_number().

double tlelib::string2date ( const std::string &  str)

Convert a string into date: number of seconds (including fractional part) since Jan 1, UNIX_FIRST_YEAR.

Parameters:
str- a string for convertion
Returns:
A variable of 'double' type.

Definition at line 285 of file tlefunc.cpp.

References string2double(), string2int(), trim(), and UNIX_FIRST_YEAR.

Referenced by tlelib::tle_node::precise_epoch().

double tlelib::string2double ( const std::string &  str)

Convert a string into 'double' variable.

Parameters:
str- a string for convertion
Returns:
A variable of 'double' type.

Definition at line 164 of file tlefunc.cpp.

References trim().

Referenced by double2string(), parseDouble(), and string2date().

int tlelib::string2int ( const std::string &  str)

Convert a string into integer variable.

Parameters:
str- a string for convertion
Returns:
A variable of 'int' type.

Definition at line 152 of file tlefunc.cpp.

References trim().

Referenced by double2string(), parseInt(), and string2date().

std::string tlelib::string2string ( const std::string &  str,
const std::size_t  fieldLength,
const bool  leftAlign = true,
const bool  allowCutOff = true 
)

Correct the length of a string: add the spece symbols or cut it off if it's necessary.

Parameters:
str- an value of std::string type
fieldLength- length of the result string
leftAlign- aligment of the value in the string: true - at left side, false - at right side.
allowCutOff- defines, if it is possible to cut the string off if its actual length exceeds the fieldLength.
Returns:
An object of std::string type.

Definition at line 109 of file tlefunc.cpp.

Referenced by double2string(), int2string(), tlelib::tle_node::second_string(), and tlelib::tle_node::third_string().

std::string tlelib::trim ( const std::string &  str)

Remove the spaces from the start and end of the given string.

Parameters:
str- the given string
Returns:
The string without space symbols at the start and end.

Definition at line 188 of file tlefunc.cpp.

Referenced by tlelib::tle_node::designator(), double2string(), int2string(), parseDouble(), parseInt(), tlelib::tle_node::sat_name(), tlelib::tle_node::sat_number(), string2date(), string2double(), and string2int().

 All Classes Namespaces Files Functions Variables Defines