logger
Public Member Functions | List of all members
Logging::StreamLogger Class Reference

#include <Logfile.hpp>

Public Member Functions

 StreamLogger (std::string const &name, std::string const &type_name, std::string const &cxx_type_name, std::vector< logger::StreamMetadata > const &metadata, Logfile &file)
 
 StreamLogger (std::string const &name, std::string const &type_name, std::string const &cxx_type_name, Typelib::Registry const &type_def, std::vector< logger::StreamMetadata > const &metadata, Logfile &file)
 
void registerStream ()
 
void setSampling (base::Time const &period)
 
bool writeSampleHeader (const base::Time &timestamp, size_t size)
 
std::ostream & getStream ()
 

Detailed Description

The objects of this class can be used to easily log samples for a given stream.

Constructor & Destructor Documentation

◆ StreamLogger() [1/2]

Logging::StreamLogger::StreamLogger ( std::string const &  name,
std::string const &  type_name,
std::string const &  cxx_type_name,
std::vector< logger::StreamMetadata > const &  metadata,
Logfile file 
)

Create a new logger, with no type definition

This logger will define a new named stream in stream, but without saving the type definition as the other constructor would.

  • name the stream name
  • type_name the stream type name
  • stream the stream object

◆ StreamLogger() [2/2]

Logging::StreamLogger::StreamLogger ( std::string const &  name,
std::string const &  type_name,
std::string const &  cxx_type_name,
Typelib::Registry const &  type_def,
std::vector< logger::StreamMetadata > const &  metadata,
Logfile file 
)

Create a new logger, with type definition

This logger will define a new named stream in stream, in which a type definition string is saved, allowing to re-read the log file without having to care about the type definition and (possible) type changes.

  • name the stream name
  • type_name the stream type name
  • registry the Typelib registry which defines the associated type name
  • stream the stream object

Member Function Documentation

◆ getStream()

std::ostream & Logging::StreamLogger::getStream ( )

◆ registerStream()

void Logging::StreamLogger::registerStream ( )

Registers the sample stream in the output file

◆ setSampling()

void Logging::StreamLogger::setSampling ( base::Time const &  period)

Sets the sampling period. It is used in update() to filter out samples that are too near from each other

◆ writeSampleHeader()

bool Logging::StreamLogger::writeSampleHeader ( const base::Time &  timestamp,
size_t  size 
)

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