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

#include <GeneralStateWriter.h>

Inheritance diagram for larcfm::GeneralStateWriter:
larcfm::ErrorReporter

Public Member Functions

 GeneralStateWriter ()
 
void open (const std::string &filename)
 
void open (std::ostream *writer)
 
void close ()
 
bool isTrkGsVs () const
 
void setTrkGsVs (bool trkgsvs)
 
int getPrecision () const
 
void setPrecision (int precision)
 
bool isOutputTime () const
 
void setOutputTime (bool display_time)
 
bool isOutputUnits () const
 
void setOutputUnits (bool display_units)
 
void setColumnDelimiterTab ()
 
void setColumnDelimiterComma ()
 
void setColumnDelimiterSpace ()
 
void addComment (const std::string &comment)
 
void setParameters (const ParameterData &pr)
 
void writeState (const std::string &name, double time, const Position &p, const Velocity &v, const std::string &label)
 
void writeState (const GeneralState &gs, const std::string &label)
 
void writeState (const std::string &name, double time, const Position &p, const Velocity &v)
 
void writeState (const std::string &name, double time, const Position &p, const std::string &label)
 
void writeState (const std::string &name, double time, const Position &p)
 
void writeState (const std::string &name, double time, std::pair< Position, Velocity > pv, const std::string &label)
 
void writeState (const std::string &name, const Position &p, const Velocity &v, const std::string &label)
 
void writeState (const std::string &name, const Position &p, const Velocity &v)
 
void writeState (const std::string &name, const Position &p, const std::string &label)
 
void writeState (const std::string &name, const NavPoint &np)
 
void writeState (const std::string &name, double time, const SimpleMovingPoly &smp, const std::string &label, bool containment)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const std::vector< Velocity > &vlist, const std::string &label, bool containment)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const Velocity &v, const std::string &label, bool containment)
 
void writeState (const std::string &name, double time, const SimpleMovingPoly &smp, bool containment)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const std::vector< Velocity > &vlist, bool containment)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const Velocity &v, bool containment)
 
void writeState (const std::string &name, const SimpleMovingPoly &smp, bool containment)
 
void writeState (const std::string &name, const SimplePoly &p, const std::vector< Velocity > &vlist, bool containment)
 
void writeState (const std::string &name, const SimplePoly &p, const Velocity &v, bool containment)
 
void writeState (const std::string &name, const SimpleMovingPoly &smp, const std::string &label, bool containment)
 
void writeState (const std::string &name, const SimplePoly &p, const std::vector< Velocity > &vlist, const std::string &label, bool containment)
 
void writeState (const std::string &name, const SimplePoly &p, const Velocity &v, const std::string &label, bool containment)
 
void writeState (const GeneralState &gs)
 
void writeState (const std::string &name, double time, const SimpleMovingPoly &smp, const std::string &label)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const std::vector< Velocity > &vlist, const std::string &label)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const Velocity &v, const std::string &label)
 
void writeState (const std::string &name, double time, const SimpleMovingPoly &smp)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const std::vector< Velocity > &vlist)
 
void writeState (const std::string &name, double time, const SimplePoly &p, const Velocity &v)
 
void writeState (const std::string &name, const SimpleMovingPoly &smp)
 
void writeState (const std::string &name, const SimplePoly &p, const std::vector< Velocity > &vlist)
 
void writeState (const std::string &name, const SimplePoly &p, const Velocity &v)
 
void writeState (const std::string &name, const SimpleMovingPoly &smp, const std::string &label)
 
void writeState (const std::string &name, const SimplePoly &p, const std::vector< Velocity > &vlist, const std::string &label)
 
void writeState (const std::string &name, const SimplePoly &p, const Velocity &v, const std::string &label)
 
int size () const
 
int lines () const
 
bool isLatLon () const
 
std::string toString () const
 
bool hasError () const
 
bool hasMessage () const
 
std::string getMessage ()
 
std::string getMessageNoClear () const
 

Private Attributes

ErrorLog error
 
SeparatedOutput output
 
bool velocity
 
bool latlon
 
bool trkgsvs
 
bool display_time
 
bool first_line
 
bool display_units
 
bool polygons
 
int precision
 
int lines_i
 
int num
 
std::string fname
 
std::ostream * fw
 

Static Private Attributes

static const double default_time = 0.0
 

Additional Inherited Members

Detailed Description

This object writes a set of aircraft states, possibly over time, (and parameters) from a file The Aircraft states are stored in an ArrayList<AircraftState>.

State files consist of comma or space-separated values, with one point per line. Required columns include aircraft name, 3 position columns (either x[nmi]/y[nmi]/z[ft] or latitude[deg]/longitude[deg]/altitude[ft]) and 3 velocity columns (either vx[knot]/vy[knot]/vz[fpm] or track[deg]/gs[knot]/vs[fpm]).

An optional column is time [s]. If it is included, a "history" will be build if an aircraft has more than one entry. If it is not included, only the last entry for an aircraft will be stored.

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).

If points are consecutive 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.

Any empty line or any line starting with a hash sign (#) is ignored.

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.

If the optional parameter "filetype" is specified, its value must be "state" or "history" (no quotes) for this reader to accept the file without error.

Constructor & Destructor Documentation

◆ GeneralStateWriter()

larcfm::GeneralStateWriter::GeneralStateWriter ( )

Member Function Documentation

◆ addComment()

void larcfm::GeneralStateWriter::addComment ( const std::string &  comment)

Adds a comment line to the file.

◆ getMessage()

std::string larcfm::GeneralStateWriter::getMessage ( )
virtual

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::GeneralStateWriter::getMessageNoClear ( ) const
virtual

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.

◆ hasError()

bool larcfm::GeneralStateWriter::hasError ( ) const
virtual

Does this object have an error?

Returns
true if there is an error.

Implements larcfm::ErrorReporter.

◆ hasMessage()

bool larcfm::GeneralStateWriter::hasMessage ( ) const
virtual

Does this object have an error or a warning?

Returns
true if there is an error or warning.

Implements larcfm::ErrorReporter.

◆ isOutputTime()

bool larcfm::GeneralStateWriter::isOutputTime ( ) const

Will the time be added to the file

◆ isOutputUnits()

bool larcfm::GeneralStateWriter::isOutputUnits ( ) const

Will the units be displayed?

◆ lines()

int larcfm::GeneralStateWriter::lines ( ) const

Return number of lines added

◆ open()

void larcfm::GeneralStateWriter::open ( const std::string &  filename)

A new GeneralStateWriter based on the given file.

◆ setColumnDelimiterComma()

void larcfm::GeneralStateWriter::setColumnDelimiterComma ( )

Sets the column delimiter to a comma. This method can only be used before the first "writeState" method.

◆ setColumnDelimiterSpace()

void larcfm::GeneralStateWriter::setColumnDelimiterSpace ( )

Sets the column delimiter to a space. This method can only be used before the first "writeState" method.

◆ setColumnDelimiterTab()

void larcfm::GeneralStateWriter::setColumnDelimiterTab ( )

Sets the column delimiter to a tab. This method can only be used before the first "writeState" method.

◆ setOutputTime()

void larcfm::GeneralStateWriter::setOutputTime ( bool  display_time)

Should the time be added to the file

◆ setOutputUnits()

void larcfm::GeneralStateWriter::setOutputUnits ( bool  displayunits)

Should the units be displayed?

◆ setParameters()

void larcfm::GeneralStateWriter::setParameters ( const ParameterData pr)

Set parameters. Use all the parameters in the reader.

◆ size()

int larcfm::GeneralStateWriter::size ( ) const

Return the number of states added to the file


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