ICAROUS
|
#include <GeneralStateReader.h>
Public Member Functions | |
GeneralStateReader () | |
void | open (const std::string &filename) |
void | open (std::istream *ins) |
int | size () const |
int | numAircraft () const |
int | numPolygons () const |
GeneralState | getGeneralState (int ac) const |
std::vector< GeneralState > | getGeneralStateList () const |
bool | isLatLon () const |
std::string | getFilename () const |
ParameterData | getParameters () const |
ParameterData & | getParametersRef () |
void | updateParameterData (ParameterData &p) const |
bool | hasError () const |
bool | hasMessage () const |
std::string | getMessage () |
std::string | getMessageNoClear () const |
std::string | toString () const |
Protected Types | |
enum | { NAME , LAT_SX , LON_SY , ALT_SZ , TRK_VX , GS_VY , VS_VZ , TM_CLK , SZ2 } |
enum | { POLY , UNKNOWN , STATE } |
Protected Member Functions | |
int | altHeadings (const std::string &s1, const std::string &s2, const std::string &s3, const std::string &s4) const |
int | altHeadings (const std::string &s1, const std::string &s2, const std::string &s3) const |
int | altHeadings (const std::string &s1, const std::string &s2) const |
double | parseClockTime (const std::string &s) const |
int | getIndex (const std::string &name) const |
int | altHeadings5 (const std::string &s1, const std::string &s2, const std::string &s3, const std::string &s4, const std::string &s5) const |
Protected Attributes | |
ErrorLog | error |
SeparatedInput | input |
std::vector< GeneralState > | states |
bool | hasRead |
bool | latlon |
bool | trkgsvs |
bool | clock |
int | head [head_length] |
std::string | fname |
Static Protected Attributes | |
static const int | head_length = SZ2 + 1 |
Private Member Functions | |
void | close () |
void | loadfile () |
This reads in and stores a set of aircraft and polygon states, possibly over time, (and parameters) from a file The aircraft states are stored in an ArrayList<GeneralState>. A state file consists of comma or space-separated values, with one position and velocity per line. Required columns include aircraft name, 3 position columns (either x[NM]/y[NM]/z[ft] or latitude[deg]/longitude[deg]/altitude[ft]) and 3 velocity columns (either vx[kn]/vy[kn]/vz[fpm] or track[deg]/gs[kn]/vs[fpm]). All empty lines or comment lines (starting with a hash sign (#)) are ignored. Polygon information is one vertex per line, with an additional "top" column to denote the polygon's upper altitude.
While this reader allows for a time column, only the last entry for an aircraft or polygon will be stored. The GeneralSequenceReader is needed to allow for multiple state-time data points. If consecutive position and velocity lines are for the same aircraft, subsequent name fields may be replaced with a double quotation mark ("). The aircraft name is case sensitive, so US54A != Us54a != us54a.
It is necessary to include a header line that defines the column ordering. The column definitions are not case sensitive. There is also an optional header line, immediately following the column definition, that defines the unit type for each column (the defaults are listed above).
Files may also include parameter definitions prior to other data. Parameter definitions are of the form <key> = <value>, one per line, where <key> is a case-insensitive alphanumeric word and <value> is either a numeral or string. The <value> may include a unit, such as "dist = 50 [m]". Note that parameters require a space on either side of the equals sign. Note that it is possible to also update the stored parameter values (or store additional ones) through API calls. Parameters can be interpreted as double values, strings, or Boolean values, and the user is required to know which parameter is interpreted as which type. However, something reasonable will come out, for instance a double value read as a string will come out as the string representation of the value.
larcfm::GeneralStateReader::GeneralStateReader | ( | ) |
A new, empty StateReader. After you have a StateReader object then use the open() method.
GeneralState larcfm::GeneralStateReader::getGeneralState | ( | int | ac | ) | const |
Returns the i-th aircraft state in the file. This will be a deep copy.
|
inlinevirtual |
Return a string representation of any errors or warnings. Calling this method will clear any messages and reset both the error and warning status to none.
Implements larcfm::ErrorReporter.
|
inlinevirtual |
Return a string representation of any errors or warnings. Calling this method will not clear the error or warning status (i.e., hasError() will return the same value before and after this call.)
Implements larcfm::ErrorReporter.
|
inlinevirtual |
Implements larcfm::ParameterProvider.
|
inlinevirtual |
Implements larcfm::ParameterReader.
|
inlinevirtual |
|
inlinevirtual |
Does this object have an error or a warning?
Implements larcfm::ErrorReporter.
void larcfm::GeneralStateReader::open | ( | const std::string & | filename | ) |
Read a new file into an existing StateReader. Parameters are preserved if they are not specified in the file.
void larcfm::GeneralStateReader::open | ( | std::istream * | in | ) |
Read a new file into an existing StateReader. Parameters are preserved if they are not specified in the file.
|
protected |
Return the string as a single value in seconds. If the column is labeled "clock," then it is expected in a "HH:MM:SS" format. If the column is labeled "time" then just read it as a value. If the string cannot be parsed, return 0.0;
s | the string to be parsed |
int larcfm::GeneralStateReader::size | ( | ) | const |
Return the number of AircraftStates in the file
|
inlinevirtual |
Implements larcfm::ParameterProvider.