TrajectoryWriter module

Module contents

class TrajectoryWriter

Write trajectories of any type as delimited text.

This class writes subclasses of tracktable::Trajectory (including the domain classes) to a stream as delimited text. It will write one trajectory per line. The resulting file will contain enough header information to reconstruct the trajectory exactly as long as the user asks for the correct class.

Public Functions

TrajectoryWriter()
TrajectoryWriter(std::ostream &_output)
TrajectoryWriter(TrajectoryWriter const &other)
virtual ~TrajectoryWriter()
TrajectoryWriter &operator=(TrajectoryWriter const &other)
bool operator==(TrajectoryWriter const &other) const
bool operator!=(TrajectoryWriter const &other) const
void set_output(std::ostream &out)
std::ostream &output() const
void set_field_delimiter(string_type const &delim)
string_type field_delimiter() const
void set_record_delimiter(string_type const &delim)
string_type record_delimiter() const
void set_quote_character(string_type const &quote)
string_type quote_character() const
void set_timestamp_format(string_type const &format)
string_type timestamp_format() const
void set_null_value(string_type const &new_null_value)

Set the string representation for nulls.

Property values that were never set are considered to hold a null value. This method lets you set how nulls will be written to disk. The default value is the empty string “”.

Parameters
  • [in] new_null_value: Desired string representation of nulls

string_type null_value() const
template<typename trajectory_type>
void write(trajectory_type const &trajectory)

Write a single trajectory.

template<typename source_iter_type>
void write(source_iter_type traj_begin, source_iter_type traj_end)

Write many trajectories.

void set_coordinate_precision(std::size_t num_digits)

Set the decimal precision for writing coordinates.

Internally, Tracktable stores coordinates as double-precision floating numbers. It is highly unlikely that trajectory data needs absolutely all of that precision. Since it takes up lots of space when we write data to disk, it is useful to be able to ask for reduced (or increased) precision.

Parameters
  • [in] num_digits: Number of digits of precision

std::size_t coordinate_precision() const

Private Types

typedef std::vector<tracktable::settings::string_type> string_vector_type

Private Functions

template<typename trajectory_type, typename out_iter_type>
void write_trajectory_header(trajectory_type const &trajectory, out_iter_type output_iter)
void set_default_configuration()

Private Members

std::size_t CoordinatePrecision
string_type FieldDelimiter
std::ostream *OutputStream
string_type QuoteCharacter
string_type RecordDelimiter
string_type TimestampFormat
PointWriter TrajectoryPointWriter
io::detail::TrajectoryHeader _TrajectoryHeader