MDF Lib 2.2
Interface against MDF 3/4 files
|
Main namespace for the MDF library. More...
Namespaces | |
namespace | CaFlag |
Channel array (CA) block flags. | |
namespace | CcFlag |
Channel conversion flags. | |
namespace | CgFlag |
Channel group flags. | |
namespace | CnFlag |
Channel flags. See also IChannel::Flags(). | |
namespace | SiFlag |
Source information flags. | |
Classes | |
class | CanMessage |
Helper class when logging CAN and CAN FD messages. More... | |
struct | CaTripleReference |
Structure that defines the channel array (CA) blocks references. More... | |
struct | ElementLink |
Support structure that holds a DG/CG/CN relation. More... | |
class | ETag |
Helper class for meta data items in an MDF file. More... | |
class | IAttachment |
Interface against an attached file. More... | |
class | IBlock |
Base class for all MDF blocks. More... | |
class | IChannel |
Defines a MDF channel (CN) block. More... | |
class | IChannelArray |
Defines an interface against an array (CA) block. More... | |
class | IChannelConversion |
Defines a channel conversion (CC) block. More... | |
class | IChannelGroup |
Interface against a channel group (CG) block. More... | |
class | IChannelHierarchy |
Channel hierarchy (CH) block. More... | |
class | IChannelObserver |
The channel observer object shall hold all samples for a channel. More... | |
class | IDataGroup |
Interface to a data group (DG) block. More... | |
class | IEvent |
Interface against an event block. More... | |
class | IFileHistory |
Interface class against an MDF FH block. More... | |
class | IHeader |
Interface class against an MDF HD block. More... | |
class | IMdfTimestamp |
Interface for MDF timestamp handling. More... | |
class | IMetaData |
Interface against an meta data block (MD) in a MDF4 file. More... | |
class | ISampleObserver |
Interface to a sample observer that handle incoming samples events. More... | |
class | ISampleReduction |
Defines an interface to a sample reduction (SR) block. More... | |
class | ISourceInformation |
Interface to a source information (SI) block. More... | |
class | ITimestamp |
Interface for timestamp handling in MDF files. More... | |
class | LocalTimestamp |
Class representing a local timestamp, with timezone and DST offset. More... | |
class | MdfFactory |
MDF factory class. More... | |
class | MdfFile |
Implements an user interface against a MDF file. More... | |
class | MdfHelper |
Support class for the MDF library. More... | |
class | MdfLogStream |
MDF log stream interface. More... | |
class | MdfReader |
Reader interface to an MDF file. More... | |
class | MdfWriter |
Interface against an MDF writer object. More... | |
struct | SampleRecord |
Simple record buffer structure. More... | |
struct | SrValue |
Template class that is used to handle reduction sample. More... | |
struct | TextConversion |
MDF 3 text conversion structure. Not used in MDF 4. Key to text conversion. More... | |
struct | TextRangeConversion |
MDF 3 range conversion structure. Not used in MDF 4. Key min/max to text conversion. More... | |
class | TimezoneTimestamp |
Class representing a timestamp with timezone information. More... | |
class | UtcTimestamp |
Class representing a UTC timestamp. More... | |
Typedefs | |
using | MdfLogFunction2 |
MDF logging function definition. | |
using | AttachmentList = std::vector<const IAttachment*> |
List of pointers to attachments. | |
using | DataGroupList = std::vector<IDataGroup*> |
List of pointers to measurements (DG block). | |
using | MdfLogFunction1 |
MDF log function definition. | |
using | ChannelObserverPtr = std::unique_ptr<IChannelObserver> |
Smart pointer to an observer. | |
using | ChannelObserverList = std::vector<ChannelObserverPtr> |
List of observer. | |
using | ByteArray = std::vector<uint8_t> |
Defines a dynamic byte array. | |
Enumerations | |
enum class | CanErrorType : uint8_t { UNKNOWN_ERROR = 0 , BIT_ERROR = 1 , FORM_ERROR = 2 , BIT_STUFFING_ERROR = 3 , CRC_ERROR = 4 , ACK_ERROR = 5 } |
Enumerate yhat defines type of CAN bus error. More... | |
enum class | MessageType : int { CAN_DataFrame , CAN_RemoteFrame , CAN_ErrorFrame , CAN_OverloadFrame } |
Enumerate that defines type of CAN messages. More... | |
enum class | ETagDataType : uint8_t { StringType = 0 , DecimalType = 1 , IntegerType = 2 , FloatType = 3 , BooleanType = 4 , DateType = 5 , TimeType = 6 , DateTimeType = 7 } |
The e-tag may optional have a data type below. The value in the XML file is of course string but the data type may be used for interpretation of the value. Note that unit property can also be added. More... | |
enum class | ChannelType : uint8_t { FixedLength = 0 , VariableLength = 1 , Master = 2 , VirtualMaster = 3 , Sync = 4 , MaxLength = 5 , VirtualData = 6 } |
Channel functional type. More... | |
enum class | ChannelSyncType : uint8_t { None = 0 , Time = 1 , Angle = 2 , Distance = 3 , Index = 4 } |
Synchronization type. More... | |
enum class | ChannelDataType : uint8_t { UnsignedIntegerLe = 0 , UnsignedIntegerBe = 1 , SignedIntegerLe = 2 , SignedIntegerBe = 3 , FloatLe = 4 , FloatBe = 5 , StringAscii = 6 , StringUTF8 = 7 , StringUTF16Le = 8 , StringUTF16Be = 9 , ByteArray = 10 , MimeSample = 11 , MimeStream = 12 , CanOpenDate = 13 , CanOpenTime = 14 , ComplexLe = 15 , ComplexBe = 16 } |
Channel data type. More... | |
enum class | ArrayType : uint8_t { Array = 0 , ScalingAxis = 1 , LookUp = 2 , IntervalAxis = 3 , ClassificationResult = 4 } |
Type of array. More... | |
enum class | ArrayStorage : uint8_t { CnTemplate = 0 , CgTemplate = 1 , DgTemplate = 2 } |
Type of storage. More... | |
enum class | ConversionType : uint8_t { NoConversion = 0 , Linear = 1 , Rational = 2 , Algebraic = 3 , ValueToValueInterpolation = 4 , ValueToValue = 5 , ValueRangeToValue = 6 , ValueToText = 7 , ValueRangeToText = 8 , TextToValue = 9 , TextToTranslation = 10 , BitfieldToText = 11 , Polynomial = 30 , Exponential = 31 , Logarithmic = 32 , DateConversion = 33 , TimeConversion = 34 } |
Type of conversion formula. More... | |
enum class | ChType : uint8_t { Group = 0 , Function = 1 , Structure = 2 , MapList = 3 , InputVariable = 4 , OutputVariable = 5 , LocalVariable = 6 , CalibrationDefinition = 7 , CalibrationObject = 8 } |
Block type. More... | |
enum class | EventType : uint8_t { RecordingPeriod = 0 , RecordingInterrupt = 1 , AcquisitionInterrupt = 2 , StartRecording = 3 , StopRecording = 4 , Trigger = 5 , Marker = 6 } |
Type of event. More... | |
enum class | SyncType : uint8_t { SyncTime = 1 , SyncAngle = 2 , SyncDistance = 3 , SyncIndex = 4 } |
Type of synchronization value (default time) More... | |
enum class | RangeType : uint8_t { RangePoint = 0 , RangeStart = 1 , RangeEnd = 2 } |
Type of range. More... | |
enum class | EventCause : uint8_t { CauseOther = 0 , CauseError = 1 , CauseTool = 2 , CauseScript = 3 , CauseUser = 4 } |
Type of cause. More... | |
enum class | SrSyncType : uint8_t { Undefined = 0 , Time = 1 , Angle = 2 , Distance = 3 , Index = 4 } |
Type of master for a sample reduction (SR) block. | |
enum class | SourceType : uint8_t { Other = 0 , Ecu = 1 , Bus = 2 , IoDevice = 3 , Tool = 4 , User = 5 } |
Type of source information. More... | |
enum class | BusType : uint8_t { None = 0 , Other = 1 , Can = 2 , Lin = 3 , Most = 4 , FlexRay = 5 , Kline = 6 , Ethernet = 7 , Usb = 8 } |
Type of bus. More... | |
enum class | MdfWriterType : int { Mdf3Basic = 0 , Mdf4Basic = 1 , MdfBusLogger = 2 , MdfConverter = 3 } |
MDF writer types. More... | |
enum class | MdfFileType : int { Mdf3FileType = 0 , Mdf4FileType = 1 } |
MDF file type. More... | |
enum class | MdfLogSeverity : uint8_t { kTrace = 0 , kDebug , kInfo , kNotice , kWarning , kError , kCritical , kAlert , kEmergency } |
Defines the log severity level. More... | |
enum class | MdfBusType : int { CAN , LIN , FlexRay , MOST , Ethernet , UNKNOWN } |
Enumerate that defines type of bus. Only relevant for bus logging. More... | |
enum class | MdfStorageType : int { FixedLengthStorage , VlsdStorage , MlsdStorage } |
Enumerate that defines how the raw data is stored. By default the fixed length record is stored. Only used when doing bus logging. More... | |
Functions | |
std::string | CreateMd5FileString (const std::string &file) |
Generates an MD5 file checksum (32 character) string. | |
bool | CreateMd5FileChecksum (const std::string &file, std::vector< uint8_t > &md5) |
Create a file hash byte array according to MD5. | |
bool | IsMdfFile (const std::string &filename) |
Returns true if the file is an MDF file. | |
ChannelObserverPtr | CreateChannelObserver (const IDataGroup &data_group, const IChannelGroup &group, const IChannel &channel) |
Creates and attaches a channel sample observer. | |
ChannelObserverPtr | CreateChannelObserver (const IDataGroup &dg_group, const std::string &channel_name) |
void | CreateChannelObserverForChannelGroup (const IDataGroup &data_group, const IChannelGroup &group, ChannelObserverList &dest) |
Creates a channel observer. | |
void | CreateChannelObserverForDataGroup (const IDataGroup &data_group, ChannelObserverList &dest_list) |
Creates channel observers for all channels within a data group. | |
bool | Deflate (std::FILE *in, std::FILE *out) |
Compress file to file. | |
bool | Deflate (const ByteArray &buf_in, ByteArray &buf_out) |
Compress array to array. | |
bool | Deflate (const std::string &filename, ByteArray &buf_out) |
Compress array to array. | |
bool | Inflate (std::FILE *in, std::FILE *out) |
Decompress file to file. | |
bool | Inflate (std::FILE *in, std::FILE *out, uint64_t nof_bytes) |
Decompress part of file to file. | |
bool | Inflate (const ByteArray &in, ByteArray &out) |
Decompress array to array. | |
bool | Inflate (const ByteArray &in, std::FILE *out) |
Decompress array to file. | |
void | Transpose (ByteArray &data, size_t record_size) |
Transpose of an array. | |
void | InvTranspose (ByteArray &data, size_t record_size) |
Invert transpose of an array. | |
Main namespace for all MDF library classes and functions.
using mdf::MdfLogFunction1 |
using mdf::MdfLogFunction2 |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
Defines the channel data type. Avoid defining value sizes that doesn't align to a byte size.
The Le and Be extension is related to byte order. Little endian (Intel byte order) while big endian (Motorola byte order).
|
strong |
|
strong |
Most channels are marked as 'FixedLength' which means that its size in a record is fixed. This works well with most data types but byte arrays and strings may change its size. Instead are these data types marked as 'Variable Length'. Avoid writing variable length data as it may allocate a lot of memory as it flush at the end of the measurement.
One channel in channel group (IChannelGroup), should be marked as a master channel. This channel is typical relative sample time with seconds as unit. The master channel is typical used on the X-axis when plotting data.
The 'VirtualMaster' channel can be used if the sample number is linear related to the sample time. The channel conversion (CC) block should define the sample number to time conversion.
The 'Sync' channel is used to synchronize an attachment block (file).
The 'MaxLength' type is typical used when storing CAN byte array where another channel stores actual bytes stored in a sample. For CAN the size in the max record size is 8 bytes.
The 'VirtualData' is similar to the 'VirtualMaster' channel but related to data. Good luck to find a use of this type.
|
strong |
|
strong |
The type together with the Parameter() function defines the conversion between channel and engineering value.
|
strong |
Use ISO UTC date and time formats or avoid these data types if possible as they just causing problem at presentation.
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
The fixed length storage is using one SD-block per byte array. The SD block is temporary stored in primary memory instead of store it on disc. This storage type is not recommended for bus logging.
The variable length storage uses an extra CG-record for byte array data. The storage type is used for bus logging where payload data is more than 8 byte.
The maximum length storage shall be used when payload data is 8 bytes or less. It is typically used when logging CAN messages which have 0-8 data payload.
Enumerator | |
---|---|
FixedLengthStorage | The default is to use fixed length records. |
VlsdStorage | Using variable length storage. |
MlsdStorage | Using maximum length storage. |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
nodiscard |
Function that creates a channel observer by searching the channel name. In case that the channel exist in many channel groups, it selects the group with the largest number of samples.
dg_group | The data group with the channel. |
channel_name | The channel name |
void mdf::CreateChannelObserverForDataGroup | ( | const IDataGroup & | data_group, |
ChannelObserverList & | dest_list ) |
This function generates channel observers for all channels within the a data group. This function may a little but dangerous as it may allocate a lot of primary memory. An hint is to check how many bytes there are in the DG/DT blocks. If there is more than 1GByte, maybe you should do some partial read instead.
Note that channel groups without samples or data, are skipped.
data_group | Reference to the data group. |
dest_list | The subscriber list which is appended with channel observers. |
bool mdf::CreateMd5FileChecksum | ( | const std::string & | file, |
std::vector< uint8_t > & | md5 ) |
Generates a file hash MD5 checksum. The output is a byte array.
[in] | file | Full path to the file name. |
[out] | md5 | Returns a byte array. The vector size is set by the function. |
std::string mdf::CreateMd5FileString | ( | const std::string & | file | ) |
Creates an MD5 file checksum. The output is a hexadecimal string.
[in] | file | Full path to the file name. |
Compress a byte array directly to another array.
The input buffer data is compressed and sent to the output array. The output array needs be sized to a size so the compressed data fits. Normally it should be preset to the same size as the input. The output array is resized to the new compressed size.
The compress method is deflate according to ZLIB.
buf_in | Input byte array with data. |
buf_out | Output array. |
bool mdf::Deflate | ( | const std::string & | filename, |
ByteArray & | buf_out ) |
Compress a file directly to an array.
The file data is compressed and sent to an output array. Unlike the other Deflate() functions, the output buffer doesn't need to be sized before calling this function. The compress method is deflate according to ZLIB.
filename | Full name of the file to compress. |
buf_out | Output byte array. The function resize the buffer |
bool mdf::Deflate | ( | std::FILE * | in, |
std::FILE * | out ) |
Compress a file directly to another file. This is an efficient way of compressing a file. The compress method is deflate according to ZLIB.
in | Pointer to the input file stream. |
out | Pointer to the output file stream. |