SDK Base Utils

HeaderHelper

template<typename EventType>
void Metavision::write_DAT_header(std::ostream &os, const DATHeaderMap &header_map = DATHeaderMap())

Writes the DAT header of a file.

Template Parameters
  • EventType: The type of events stored in the DAT file

Parameters
  • os: The stream used to store the DAT data

  • header_map: An optional map of data to be stored in the header

template<typename EventType>
std::string Metavision::get_DAT_header_as_string(const DATHeaderMap &header_map = DATHeaderMap())

Convenience function to get the DAT header as string.

Return

The string representing the DAT header

Template Parameters
  • EventType: The type of events stored in the DAT file

Parameters
  • header_map: Additional information to be stored in the header

using Metavision::DATHeaderMap = std::map<std::string, std::string>
DATHeaderMap Metavision::make_DAT_header_map_with_geometry(int width, int height)

Convenience function to create a DAT header map to be added in the header using the camera geometry.

Return

The DAT header map

Parameters
  • width: Width of the camera sensor

  • height: Height of the camera sensor

using Metavision::HeaderHelper::HeaderType = std::map<std::string, std::string>
HeaderType Metavision::HeaderHelper::parse_header(std::ifstream &file_, bool &header_present)

Parses the header to build the map with the file info.

Return

Map containing the file info (version, date, height etc.)

Parameters
  • file_: file to read from. Note that after the call to the function, the pointer file_ will point to the first line after the header

  • header_present: Boolean which will be set to true if a header was found in the file

std::string Metavision::HeaderHelper::get_header_as_string(const HeaderType &header)

Converts a header type into string format.

Return

A formatted writable string containing these information

Parameters
  • header: Header containing the file info (version, date, height etc.)

std::string Metavision::HeaderHelper::get_key_value_from_header(const HeaderType &header, const std::string &key)

Gets key value from header type.

Return

String containing the value of the requested key

Parameters
  • header: Header containing the file info (version, date, height etc.)

  • key: Information requested

std::string Metavision::HeaderHelper::get_date_as_string()

Returns the current date in the standard header format.

Various

typedef long long Metavision::timestamp

Type to represent time in microseconds.