logger
Namespaces | Classes | Enumerations | Functions | Variables
Logging Namespace Reference

Namespaces

 details
 

Classes

struct  BlockHeader
 
class  Logfile
 
struct  Prologue
 
struct  SampleHeader
 
class  StreamLogger
 

Enumerations

enum  BlockType { UnknownBlockType = 0, StreamBlockType = 1, DataBlockType = 2, ControlBlockType = 3 }
 
enum  StreamType { UnknownStreamType = 0, DataStreamType = 1, ControlStreamType = 2 }
 
enum  CommandType { SetTimeBase = 0, SetTimeOffset = 1 }
 

Functions

void writePrologue (std::ostream &stream)
 
template<class T >
Logfileoperator<< (Logfile &output, const T &value)
 
template<>
Logfileoperator<< (Logfile &output, const uint8_t &value)
 
template<>
Logfileoperator<< (Logfile &output, const uint16_t &value)
 
template<>
Logfileoperator<< (Logfile &output, const uint32_t &value)
 
template<>
Logfileoperator<< (Logfile &output, const std::string &value)
 
template<>
Logfileoperator<< (Logfile &output, const base::Time &time)
 
template<>
Logfileoperator<< (Logfile &output, const BlockHeader &header)
 
template<>
Logfileoperator<< (Logfile &output, const SampleHeader &header)
 
template<>
Logfileoperator<< (Logfile &output, const BlockType &type)
 
template<>
Logfileoperator<< (Logfile &output, const StreamType &type)
 
template<>
Logfileoperator<< (Logfile &output, const CommandType &type)
 

Variables

const char FORMAT_MAGIC [] = "POCOSIM"
 

Detailed Description

Log files are made of blocks. Each block begins with a common block header. Block are organized in streams, which all begin with a data stream declaration. Data blocks begin with a data stream declaration block, which includes the stream name, the stream type name and (optionally) a type registry which defines the type, in Typelib XML format. If no registry is available, the type registry is of zero size.

All pocosim-defined values are saved in little endian. Only the data payload in data blocks is saved in native endian. The log reader, pocosim-log, is able to swap endianness if needed.

Prologue (12 bytes)
OffsetSizeField
+07POCOSIM (see Logging::FORMAT_MAGIC)
+74Format version (currently 2, see Logging::FORMAT_VERSION)
+111Endianness (1 = big, 0 = little)
Block Header (8 bytes)
OffsetSizeField
+01block type (Logging::BlockType)
+11padding
+22stream index
+44data size
Control Stream Declaration Block
OffsetSizeField
+0 1Logging::ControlStreamType
Data Stream Declaration Block
OffsetSizeField
+0 1Logging::DataStreamType
+1 4stream name size
+3 istream name
4stream type name size
stream type name
4type registry size
type registry
Sample Block (25 bytes)
OffsetSizeField
+4 4real time (sec)
+8 4real time (usec)
+204logical time (sec)
+244logical time (usec)
+324data size
+361compression flag
+37data_sizedata

Enumeration Type Documentation

Enumerator
UnknownBlockType 
StreamBlockType 
DataBlockType 

stream declaration block

ControlBlockType 

a data block in an already declared stream

Enumerator
SetTimeBase 
SetTimeOffset 
Enumerator
UnknownStreamType 
DataStreamType 
ControlStreamType 

Function Documentation

template<class T >
Logfile& Logging::operator<< ( Logfile output,
const T &  value 
)
template<>
Logfile& Logging::operator<< ( Logfile output,
const uint8_t &  value 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const uint16_t &  value 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const uint32_t &  value 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const std::string &  value 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const base::Time &  time 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const BlockHeader header 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const SampleHeader header 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const BlockType type 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const StreamType type 
)
inline
template<>
Logfile& Logging::operator<< ( Logfile output,
const CommandType type 
)
inline
void Logging::writePrologue ( std::ostream &  stream)

Writes the file prologue

Variable Documentation

const char Logging::FORMAT_MAGIC = "POCOSIM"