ADTF File Library
Loading...
Searching...
No Matches
adtf_file Namespace Reference

namespace for ADTF File library More...

Namespaces

namespace  adtf2
 namespace for support of ADTF 2 files
 
namespace  adtf3
 namespace for support of ADTF 3 files
 
namespace  exceptions
 namespace for exceptions
 

Classes

class  ADTF2StreamTypeSerializer
 ADTF2 stream type serializer interface class to write ADTF 2 stream types. More...
 
class  ADTFDatFileReader
 ADTF File Reader to deserialze and read the content of a ADTF DAT File. More...
 
class  ADTFDatFileReaderFactory
 Special Reader factory to make readers for "adtfdat" files. More...
 
class  ADTFDatFileWriter
 Default ADTF DAT File Writer to write an ADTF DAT File (IFHD file with ADTF type and sample content). More...
 
class  Configurable
 
class  DefaultSample
 Default Sample implementation. More...
 
class  DefaultStreamType
 Default stream type implementation. More...
 
class  ExplicitReader
 
class  Extension
 Extension class for file extension. These extension are i.e.: More...
 
class  FileItem
 class to create or read a file item. This file item is either a sample, streamtype or trigger. More...
 
class  InputStream
 interface class for input streams More...
 
struct  LogEntry
 Bundles all data associated with a single log event. More...
 
class  Logger
 Abstract sink for log messages produced by the adtf_file library. More...
 
class  Object
 base interface class for all available objects of the ADTF File Library that can be added to the objects singleton of the library ( getObjects ). More...
 
class  Objects
 container for objects. this object container can be retrieved as objects singleton of the library via getObjects More...
 
class  OutputStream
 Interface class for an output stream. More...
 
class  PluginInitializer
 Plugin initializer class to use within a ADTF File Library plugin. More...
 
class  PropertyBuilder
 The PropertyBuilder class is an easy way to define a property with additional meta information. Multiple properties can be easily linked to an entire configuration using the "+" operator. More...
 
class  PropertyStreamType
 The default interface class for stream types. More...
 
struct  PropertyValue
 PropertyValue variant class. More...
 
class  Reader
 
class  ReaderFactories
 
class  ReaderFactory
 Reader Factory interface to create a reader. More...
 
class  ReaderFactoryImplementation
 Default Reader factory implementation for readers using a standard default CTOR. More...
 
class  ReadRawSampleInfo
 interface class for reading sample information. More...
 
class  ReadSample
 Interface class for samples that are read from a Reader. More...
 
class  ReferencedFilesExtension
 Referenced File Extension Interpreter to hold a collection of file paths. This class is ables to read and write the collection of file paths as data content to a Reader extensions. More...
 
class  Sample
 Sample base class. More...
 
class  sample_deserializer_factory
 default implementation template for a SampleDeserializerFactory creating More...
 
class  sample_factory
 template class for a sample factory to create sample with implementation type SAMPLE_CLASS More...
 
class  sample_serializer_factory
 default implementation template for SampleSerializerFactory to create an instance of the serialzer type SERIALIZER More...
 
class  SampleCopy
 interface for copying the contents of one sample into another, probably sharing resources (such as the sample buffer) More...
 
class  SampleDeserializer
 Sample deserializer interface to deserialize a sample. More...
 
class  SampleDeserializerFactories
 container class for SampleDeserializerFactory More...
 
class  SampleDeserializerFactory
 SampleDeserializerFactory interface class. More...
 
class  SampleFactory
 Base class for a sample factory to create sample used by the Reader. More...
 
class  SampleSerializer
 Interface class for a sample serializer. Usually the implementaion has a serialization state depending on the last setStreamType call. More...
 
class  SampleSerializerFactories
 Container class for SampleSerializerFactory. More...
 
class  SampleSerializerFactory
 interface class for sample serializer More...
 
class  SeekableReader
 Interface for seekable Reader, where the file position can be adapted. More...
 
struct  SourceLocation
 Identifies the source code location where a log message was emitted. More...
 
class  StandardReader
 Standard Reader class to use the ADTFDatFileReader in default way. More...
 
class  StandardSampleDeserializers
 Default container with all SampleDeserializer factories provided by the ADTF File Library. More...
 
class  StandardSampleSerializers
 Default container with all SampleSerializer factories provided by the ADTF File Library. More...
 
class  StandardTypeDeserializers
 Default container with all StreamTypeDeserializer provided by the ADTF File Library. More...
 
class  Stream
 class to create and describe a stream within a adtf_file::Reader. Each stream has an identifier stream_id. This stream_id is used to mark a corresponding FileItem More...
 
class  stream_type_factory
 template class for a streamtype factory to create streamtypes with implementation type STREAM_TYPE_CLASS More...
 
class  StreamItem
 base class for either a sample, streamtype or trigger. Following stream items are possible: More...
 
class  StreamType
 Stream Type base class. More...
 
class  StreamTypeDeserializer
 StreamType deserializer interface to deserialize a stream type. More...
 
class  StreamTypeDeserializers
 container class for StreamTypeDeserializers More...
 
class  StreamTypeFactory
 Base class for a streamtype factory to create streamtypes used by the Reader. More...
 
class  StreamTypeSerializer
 interface class for stream type serializers. More...
 
class  StreamTypeSerializers
 Container class for StreamTypeSerializer. More...
 
class  Trigger
 Trigger base class. More...
 
class  WriteRawSampleInfo
 interface class for writing sample information. More...
 
class  WriteSample
 Interface class for samples that are written. More...
 

Typedefs

using Configuration = std::unordered_map<std::string, PropertyValue>
 Configuration class as set of key - property value pairs This configuration is used to adjust the readers and processors behaviour.
 

Enumerations

enum class  LogLevel : uint8_t {
  None = 0 , Error = 10 , Warning = 20 , Info = 30 ,
  Detail = 35 , Dump = 40 , Debug = Dump , All = 0xFF
}
 Severity levels for log messages, ordered from least to most verbose. More...
 
enum class  DataType {
  uint8 , int8 , uint16 , int16 ,
  uint32 , int32 , uint64 , int64 ,
  float32 , float64
}
 data type id for the adtf_file::ReadSample::addInfo call.
 
enum  SampleInfoKeys : uint32_t { sai_device_original_time = 1851393682 , sai_counter = 1660111993 }
 predefefined keys for the adtf_file::ReadSample::addInfo call.
 

Functions

std::string getShortDescription (const std::string &description)
 helper fuction to retrieve short description out of description
 
std::string getLongDescription (const std::string &description)
 helper fuction to retrieve long description out of description
 
bool operator== (const PropertyValue &left, const PropertyValue &right)
 compare operator for PropertyValue
 
Configuration operator+ (const Configuration &config_left, const Configuration &config_right)
 Add operator for configurations.
 
template<typename T>
getPropertyValue (const Configuration &configuration, const std::string &property_name)
 
template<typename T>
getPropertyValue (const Configuration &configuration, const std::string &property_name, const T &default_value)
 
Configuration getSubConfiguration (const Configuration &configuration, const std::string &property_name, bool top_level_reserved_properties=false)
 Get a sub-tree of a configuration property.
 
template<typename T>
void setPropertyValue (Configuration &configuration, const std::string &property_name, const T &property_value)
 
void setFilePluginVersion (Configuration &configuration, const std::string &version)
 
void setFilePluginDescription (Configuration &configuration, const std::string &description)
 
void setPropertyDescription (Configuration &configuration, const std::string &property_name, const std::string &description)
 
void setPropertyDisplayName (Configuration &configuration, const std::string &property_name, const std::string &display_name)
 
template<typename T>
void setPropertyValueRange (Configuration &configuration, const std::string &property_name, const T &min, const T &max)
 
template<typename T>
void setPropertyValueList (Configuration &configuration, const std::string &property_name, const std::vector< std::pair< T, std::string > > &value_list, bool restrict_to_values=true)
 
LoggergetLogger () noexcept
 Returns the active logger used by the library.
 
LoggergetDefaultLogger () noexcept
 Returns the built-in default logger.
 
bool getTerminalColorSupport (FILE *output) noexcept
 Queries whether the current terminal supports ANSI color sequences.
 
std::string defaultLogFormat (std::chrono::system_clock::time_point timestamp, LogLevel log_level, std::string_view message, SourceLocation location, bool bWithColor) noexcept
 Formats a log event into a human-readable string.
 
ObjectsgetObjects ()
 Get the objects singleton of the library.
 
template<typename FACTORIES, typename FACTORY_TYPE>
FACTORIES getFactories ()
 Get the Factories from the objects singleton of the library.
 
void loadPlugin (const std::string &file_name)
 Loads a ADTF File Library plugin.
 
Stream findStream (const Reader &reader, const std::string &stream_name)
 
std::chrono::nanoseconds getFirstTimeOfStreams (const std::vector< Stream > &streams)
 Get the First Time Of the given Streams.
 
std::chrono::nanoseconds getLastTimeOfStreams (const std::vector< Stream > &streams)
 Get the Last Time Of the given Streams.
 
ReaderFactories getReaderFactories ()
 Get the Reader Factories from the Objects instance.
 
uint32_t createSampleInfoHashKey (const std::string &name)
 Create a Sample Info Hash Key.
 
uint32_t createAdtf2SampleInfoHashKey (uint32_t info_index)
 Create a Adtf2 Sample Info Hash Key.
 
void copy_sample (adtf_file::Sample &destination, const std::shared_ptr< const Sample > &source)
 
void add_standard_objects ()
 Adds all default implementation objects provided by the ADTF File Library.
 
std::string fractional_value_to_string (const int64_t fractional_value, std::optional< size_t > fixed_precision={})
 Converts the decimal part of a floating point number given as an integer value into a string.
 
std::chrono::nanoseconds parseTimestamp (const std::string &strTimestamp)
 General parser for timestamps in several formats (ISO-8601, number+unit).
 
std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > parseIsoTimestamp (const std::string &strTimestamp)
 Convert ISO 8601 string to timestamp in nanoseconds of system_clock ( high performance clock ). e.g. 2024-09-26T23:59:59Z e.g. 2024-09-26T23:59:59.123456789Z.
 
std::string createIsoTimestampString (const std::chrono::nanoseconds &nanos, std::optional< size_t > fixed_precision={}, bool local_time=false)
 Format ISO 8601 string from a 'std.chrono.nanoseconds' param.
 
std::string createDurationString (std::chrono::nanoseconds const ns, std::optional< size_t > fixed_precision={})
 Create string in seconds (and fractions) and without unit postfix.
 

Detailed Description

namespace for ADTF File library

The ADTF File package with 'adtf_file::ADTFDatFileWriter' and 'adtf_file::ADTFDatFileReader'. Depending on the ADTF File version you may create and read indexed files with samples.

Enumeration Type Documentation

◆ LogLevel

enum class adtf_file::LogLevel : uint8_t
strong

Severity levels for log messages, ordered from least to most verbose.

Enumerator
None 

Logging disabled; no messages are emitted.

Error 

Unrecoverable errors that require immediate attention.

Warning 

Potentially harmful situations that do not abort processing.

Info 

General informational messages about normal operation.

Detail 

More detailed operational messages for diagnostics.

Dump 

Verbose data dumps for deep troubleshooting.

Debug 

Alias for Dump.

All 

Enable all log levels.

Function Documentation

◆ copy_sample()

void adtf_file::copy_sample ( adtf_file::Sample & destination,
const std::shared_ptr< const Sample > & source )

Copies all information from one sample to another

Parameters
destinationThe sample that all data should be copied to.
sourceThe sample that all data should be copied from.

◆ createAdtf2SampleInfoHashKey()

uint32_t adtf_file::createAdtf2SampleInfoHashKey ( uint32_t info_index)

Create a Adtf2 Sample Info Hash Key.

Parameters
info_indexthe info index
Returns
uint32_t the hash

◆ createDurationString()

std::string adtf_file::createDurationString ( std::chrono::nanoseconds const ns,
std::optional< size_t > fixed_precision = {} )

Create string in seconds (and fractions) and without unit postfix.

Parameters
[in]nsDuration in nanoseconds
[in]fixed_precisionIf set, this number of decimal places is returned. If not set, only the significant digits are returned (trailing zeros are truncated, maximum 9 digits).
Returns
Duration string in seconds. e.g. 4.3234567

◆ createIsoTimestampString()

std::string adtf_file::createIsoTimestampString ( const std::chrono::nanoseconds & nanos,
std::optional< size_t > fixed_precision = {},
bool local_time = false )

Format ISO 8601 string from a 'std.chrono.nanoseconds' param.

Parameters
[in]nanosNanoSeconds
[in]fixed_precisionIf set, this number of decimal places is returned.
[in]local_timeIf set, generate a timestamp representing local time instead of GMT. If not set, only the significant digits are returned (trailing zeros are truncated, maximum 9 digits).
Returns
Returns ISO 8601 timestamp string. e.g. 2024-09-26T23:59:59.123456789Z

◆ createSampleInfoHashKey()

uint32_t adtf_file::createSampleInfoHashKey ( const std::string & name)

Create a Sample Info Hash Key.

Parameters
namethe name for the key
Returns
uint32_t the hash

◆ defaultLogFormat()

std::string adtf_file::defaultLogFormat ( std::chrono::system_clock::time_point timestamp,
LogLevel log_level,
std::string_view message,
SourceLocation location,
bool bWithColor )
noexcept

Formats a log event into a human-readable string.

Produces a single line suitable for printing to a terminal or log file. Used internally by the default logger.

Parameters
timestampWall-clock time of the event.
log_levelSeverity of the message.
messageHuman-readable description of the event.
locationSource code location that produced the message.
bWithColorIf true, ANSI color escape codes are embedded in the output.
Returns
Formatted log line.

◆ findStream()

Stream adtf_file::findStream ( const Reader & reader,
const std::string & stream_name )

Method to find a stream of a reader.

Parameters
[in]readerThe reader.
[in]stream_nameThe name of the stream to look for.
Returns
The stream information.

◆ fractional_value_to_string()

std::string adtf_file::fractional_value_to_string ( const int64_t fractional_value,
std::optional< size_t > fixed_precision = {} )

Converts the decimal part of a floating point number given as an integer value into a string.

Parameters
fractional_valuedecimal part.
fixed_precisionIf set, this number of decimal places is returned. If not set, only the significant digits are returned (trailing zeros are truncated, maximum 9 digits).
Returns
Decimal separator ('.') followed by the decimal places as a string.

◆ getDefaultLogger()

Logger & adtf_file::getDefaultLogger ( )
noexcept

Returns the built-in default logger.

The default logger writes formatted messages to stdout using defaultLogFormat(). It is always available regardless of whether a custom logger has been injected.

Returns
Reference to the default Logger instance.

◆ getFactories()

template<typename FACTORIES, typename FACTORY_TYPE>
FACTORIES adtf_file::getFactories ( )

Get the Factories from the objects singleton of the library.

Template Parameters
FACTORIESthe factories container type to add the found factories to
FACTORY_TYPEthe factory type to search for
Returns
the factories container with found factories of type FACTORY_TYPE

◆ getFirstTimeOfStreams()

std::chrono::nanoseconds adtf_file::getFirstTimeOfStreams ( const std::vector< Stream > & streams)

Get the First Time Of the given Streams.

Parameters
streamsThe streams vector
Returns
std::chrono::nanoseconds

◆ getLastTimeOfStreams()

std::chrono::nanoseconds adtf_file::getLastTimeOfStreams ( const std::vector< Stream > & streams)

Get the Last Time Of the given Streams.

Parameters
streamsThe streams vector
Returns
std::chrono::nanoseconds

◆ getLogger()

Logger & adtf_file::getLogger ( )
noexcept

Returns the active logger used by the library.

By default this returns the same instance as getDefaultLogger(). Plugins may redirect it to a host-provided logger via adtfFileSetLogger().

Returns
Reference to the currently active Logger.

◆ getLongDescription()

std::string adtf_file::getLongDescription ( const std::string & description)
inline

helper fuction to retrieve long description out of description

Parameters
descriptionthe decription to retrieve from
Returns
std::string

◆ getObjects()

Objects & adtf_file::getObjects ( )

Get the objects singleton of the library.

Returns
the objects singleton of the library
Remarks
This objects singleton of the library is only needed if ADTF File Library plugin mechanism is used. The singleton must be instanciated by the application only once before loading any plugin!
See also
loadPlugin

◆ getPropertyValue() [1/2]

template<typename T>
T adtf_file::getPropertyValue ( const Configuration & configuration,
const std::string & property_name )

Access property values and convert them to a specific type of T.

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
Template Parameters
Tthe type to convert to.
Returns
The property value.
Exceptions
std::runtime_errorif property_name does not exists or conversion is not possible

◆ getPropertyValue() [2/2]

template<typename T>
T adtf_file::getPropertyValue ( const Configuration & configuration,
const std::string & property_name,
const T & default_value )

Access property values and convert it to a specific type of T. If property_name is not found the default_value is returned

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
[in]default_valuethe default value if property not set.
Template Parameters
Tthe type to convert to.
Returns
The property value.
Exceptions
std::runtime_errorif conversion is not possible

◆ getReaderFactories()

ReaderFactories adtf_file::getReaderFactories ( )

Get the Reader Factories from the Objects instance.

Returns
ReaderFactories

◆ getShortDescription()

std::string adtf_file::getShortDescription ( const std::string & description)
inline

helper fuction to retrieve short description out of description

Parameters
descriptionthe decription to retrieve from
Returns
std::string

◆ getSubConfiguration()

Configuration adtf_file::getSubConfiguration ( const Configuration & configuration,
const std::string & property_name,
bool top_level_reserved_properties = false )
inline

Get a sub-tree of a configuration property.

Parameters
[in]configurationThe source configuration.
[in]property_nameThe name of the property of which the sub-properties should be returned.
[in]top_level_reserved_propertiesWhether or not to include reserved direct sub-properties of 'property_name'.
Returns
Configuration The sub-configuration

◆ getTerminalColorSupport()

bool adtf_file::getTerminalColorSupport ( FILE * output)
noexcept

Queries whether the current terminal supports ANSI color sequences.

Parameters
outputThe output to check for color support
Returns
true if color output is supported, false otherwise.

◆ loadPlugin()

void adtf_file::loadPlugin ( const std::string & file_name)

Loads a ADTF File Library plugin.

Parameters
file_nameThe path to the shared object providing a ADTF File Library plugin interface.
Remarks
the plugin will retrieve the objects singleton of the calling application by getObjects and will register its objects to it! Make sure the objects singleton is initialized only once before calling loadPlugin !

◆ operator+()

Configuration adtf_file::operator+ ( const Configuration & config_left,
const Configuration & config_right )
inline

Add operator for configurations.

Parameters
config_leftthe left configuration
config_rightthe right configuration to add
Returns
Configuration
Remarks
if right configuration contains a value with the same key as left it will take the right one into concern

◆ operator==()

bool adtf_file::operator== ( const PropertyValue & left,
const PropertyValue & right )
inline

compare operator for PropertyValue

Parameters
leftthe left value
rightthe right value
Returns
true is equal in type and value
false is not equal in type or value

◆ parseIsoTimestamp()

std::chrono::time_point< std::chrono::system_clock, std::chrono::nanoseconds > adtf_file::parseIsoTimestamp ( const std::string & strTimestamp)

Convert ISO 8601 string to timestamp in nanoseconds of system_clock ( high performance clock ). e.g. 2024-09-26T23:59:59Z e.g. 2024-09-26T23:59:59.123456789Z.

Parameters
[in]strTimestampA string possibly containing an ISO 8601 timestamp.
Returns
Returns valid time-point of system-clock in nanoseconds or throws exception.

Timestamps are absolute and cannot be negative. Timestamps are either in GMT/UTC-0 (with Z postfix) or localtime. No other timezones are supported.

◆ parseTimestamp()

std::chrono::nanoseconds adtf_file::parseTimestamp ( const std::string & strTimestamp)

General parser for timestamps in several formats (ISO-8601, number+unit).

Parameters
[in]strTimestampA string possibly containing a timestamp.
Returns
Returns valid duration in nanoseconds or throws exception.

◆ setFilePluginDescription()

void adtf_file::setFilePluginDescription ( Configuration & configuration,
const std::string & description )
inline

Set description to adtffileplugin

Parameters
[in]configurationThe configuration.
[in]descriptionThe description for the adtffileplugin.

◆ setFilePluginVersion()

void adtf_file::setFilePluginVersion ( Configuration & configuration,
const std::string & version )
inline

Set version to adtffileplugin

Parameters
[in]configurationThe configuration.
[in]versionThe version for the adtffileplugin.

◆ setPropertyDescription()

void adtf_file::setPropertyDescription ( Configuration & configuration,
const std::string & property_name,
const std::string & description )
inline

Set description to property

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
[in]descriptionThe description for the property.

◆ setPropertyDisplayName()

void adtf_file::setPropertyDisplayName ( Configuration & configuration,
const std::string & property_name,
const std::string & display_name )
inline

Set alternate display name to property

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
[in]display_nameThe alternate display name for the property.

◆ setPropertyValue()

template<typename T>
void adtf_file::setPropertyValue ( Configuration & configuration,
const std::string & property_name,
const T & property_value )

Inserts or assigns the given property_value

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
[in]property_valueThe value to set.
Template Parameters
TThe type of the property_value. See PropertyValue CTORs

◆ setPropertyValueList()

template<typename T>
void adtf_file::setPropertyValueList ( Configuration & configuration,
const std::string & property_name,
const std::vector< std::pair< T, std::string > > & value_list,
bool restrict_to_values = true )

Allow and set value list to property

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
[in]value_listThe value list.
[in]restrict_to_valuesRestrict if list is extendable.
Template Parameters
Tthe type to convert to.

◆ setPropertyValueRange()

template<typename T>
void adtf_file::setPropertyValueRange ( Configuration & configuration,
const std::string & property_name,
const T & min,
const T & max )

Define a value range for a property

Parameters
[in]configurationThe configuration.
[in]property_nameThe name of the property.
[in]minThe lower limit.
[in]maxThe upper limit.
Template Parameters
Tthe type to convert to.