ICAROUS
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Modules Pages
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
larcfm::GeneralStateReader Class Reference

#include <GeneralStateReader.h>

Inheritance diagram for larcfm::GeneralStateReader:
larcfm::ParameterProvider larcfm::ParameterReader larcfm::ErrorReporter

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< GeneralStategetGeneralStateList () const
 
bool isLatLon () const
 
std::string getFilename () const
 
ParameterData getParameters () const
 
ParameterDatagetParametersRef ()
 
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< GeneralStatestates
 
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 ()
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ GeneralStateReader()

larcfm::GeneralStateReader::GeneralStateReader ( )

A new, empty StateReader. After you have a StateReader object then use the open() method.

Member Function Documentation

◆ getGeneralState()

GeneralState larcfm::GeneralStateReader::getGeneralState ( int  ac) const

Returns the i-th aircraft state in the file. This will be a deep copy.

◆ getMessage()

std::string larcfm::GeneralStateReader::getMessage ( )
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.

Returns
error and warning messages. If there are no messages, an empty string is returned.

Implements larcfm::ErrorReporter.

◆ getMessageNoClear()

std::string larcfm::GeneralStateReader::getMessageNoClear ( ) const
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.)

Returns
error and warning messages. If there are no messages, an empty string is returned.

Implements larcfm::ErrorReporter.

◆ getParameters()

ParameterData larcfm::GeneralStateReader::getParameters ( ) const
inlinevirtual

◆ getParametersRef()

ParameterData & larcfm::GeneralStateReader::getParametersRef ( )
inlinevirtual

◆ hasError()

bool larcfm::GeneralStateReader::hasError ( ) const
inlinevirtual

Does this object have an error?

Returns
true if there is an error.

Implements larcfm::ErrorReporter.

◆ hasMessage()

bool larcfm::GeneralStateReader::hasMessage ( ) const
inlinevirtual

Does this object have an error or a warning?

Returns
true if there is an error or warning.

Implements larcfm::ErrorReporter.

◆ open() [1/2]

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.

◆ open() [2/2]

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.

◆ parseClockTime()

double larcfm::GeneralStateReader::parseClockTime ( const std::string &  s) const
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;

Parameters
sthe string to be parsed
Returns

◆ size()

int larcfm::GeneralStateReader::size ( ) const

Return the number of AircraftStates in the file

◆ updateParameterData()

void larcfm::GeneralStateReader::updateParameterData ( ParameterData p) const
inlinevirtual

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