Back to Serial Studio

MDF Lib: include/mdf/ichannel.h Source File

lib/mdflib/docs/manual/html/ichannel_8h_source.html

3.2.762.4 KB
Original Source

| MDF Lib 2.2

Interface against MDF 3/4 files |

Loading...

Searching...

No Matches

ichannel.h

Go to the documentation of this file.

1/*

2 * Copyright 2021 Ingemar Hedvall

3 * SPDX-License-Identifier: MIT

4 */

5

9#pragma once

10#include <cstring>

11#include <iomanip>

12#include <sstream>

13#include <string>

14#include <vector>

15

16#include "mdf/iblock.h"

17#include "mdf/ichannelconversion.h"

18#include "mdf/imetadata.h"

19#include "mdf/isourceinformation.h"

20#include "mdf/ichannelarray.h"

21#include "mdf/mdfhelper.h"

22#include "mdf/iattachment.h"

23

24namespace mdf {

25

51enum class ChannelType : uint8_t {

52FixedLength = 0,

53VariableLength = 1,

54Master = 2,

55VirtualMaster = 3,

56Sync = 4,

57MaxLength = 5,

58VirtualData = 6

59};

60

66enum class ChannelSyncType : uint8_t {

67None = 0,

68Time = 1,

69Angle = 2,

70Distance = 3,

71Index = 4

72};

73

82enum class ChannelDataType : uint8_t {

83UnsignedIntegerLe= 0,

84UnsignedIntegerBe = 1,

85SignedIntegerLe = 2,

86SignedIntegerBe = 3,

87FloatLe = 4,

88FloatBe = 5,

89StringAscii = 6,

90StringUTF8 = 7,

91StringUTF16Le = 8,

92StringUTF16Be = 9,

93ByteArray = 10,

94MimeSample = 11,

95MimeStream = 12,

96CanOpenDate = 13,

97CanOpenTime = 14,

98ComplexLe = 15,

99ComplexBe = 16

100};

101

105namespace CnFlag {

106constexpr uint32_t AllValuesInvalid = 0x0001;

107constexpr uint32_t InvalidValid = 0x0002;

108constexpr uint32_t PrecisionValid = 0x0004;

109constexpr uint32_t RangeValid = 0x0008;

110constexpr uint32_t LimitValid = 0x0010;

111constexpr uint32_t ExtendedLimitValid = 0x0020;

112constexpr uint32_t Discrete = 0x0040;

113constexpr uint32_t Calibration = 0x0080;

114constexpr uint32_t Calculated = 0x0100;

115constexpr uint32_t Virtual = 0x0200;

116constexpr uint32_t BusEvent = 0x0400;

117constexpr uint32_t StrictlyMonotonous = 0x0800;

118constexpr uint32_t DefaultX = 0x1000;

119constexpr uint32_t EventSignal = 0x2000;

120constexpr uint32_t VlsdDataStream = 0x4000;

121} // namespace CnFlag

122

126class IChannel : public IBlock {

127 public:

128

129virtual void Name(const std::string &name) = 0;

130 [[nodiscard]] virtual std::string Name() const = 0;

131

132virtual void DisplayName(const std::string &name) = 0;

133 [[nodiscard]] virtual std::string DisplayName() const = 0;

134

136virtual void Description(const std::string &description) = 0;

137

139 [[nodiscard]] virtual std::string Description() const = 0;

140

149virtual void Unit(const std::string &unit) = 0;

150

163 [[nodiscard]] virtual std::string Unit() const = 0;

164

166virtual void Flags(uint32_t flags);

167

169 [[nodiscard]] virtual uint32_t Flags() const;

170

171 [[nodiscard]] virtual bool IsUnitValid() const = 0;

172

173virtual void Type(ChannelType type) = 0;

174 [[nodiscard]] virtual ChannelType Type() const = 0;

175

176virtual void Sync(ChannelSyncType type);

177 [[nodiscard]] virtual ChannelSyncType Sync() const;

178

179virtual void DataType(ChannelDataType type) = 0;

180 [[nodiscard]] virtual ChannelDataType DataType() const = 0;

181

182virtual void DataBytes(uint64_t nof_bytes) = 0;

183 [[nodiscard]] virtual uint64_t DataBytes() const = 0;

184

186virtual void Decimals(uint8_t precision);

188 [[nodiscard]] virtual uint8_t Decimals() const = 0;

189

190

191

193 [[nodiscard]] virtual bool IsDecimalUsed() const = 0;

194

196virtual void Range(double min, double max);

197

199 [[nodiscard]] virtual std::optional<std::pair<double, double>> Range() const;

200

202virtual void Limit(double min, double max);

203

205 [[nodiscard]] virtual std::optional<std::pair<double, double>> Limit() const;

206

208virtual void ExtLimit(double min, double max);

209

211 [[nodiscard]] virtual std::optional<std::pair<double, double>> ExtLimit()

212const;

213

215virtual void SamplingRate(double sampling_rate) = 0;

216

218 [[nodiscard]] virtual double SamplingRate() const = 0;

219

221 [[nodiscard]] virtual ISourceInformation *SourceInformation() const;

222

224 [[nodiscard]] virtual ISourceInformation* CreateSourceInformation();

225

238 [[nodiscard]] virtual IChannelArray *ChannelArray() const;

239

247 [[nodiscard]] virtual IChannelArray* CreateChannelArray();

248

250 [[nodiscard]] virtual IChannelConversion *ChannelConversion() const = 0;

251

253 [[nodiscard]] virtual IChannelConversion *CreateChannelConversion() = 0;

254

261 [[nodiscard]] virtual IChannel *CreateChannelComposition() = 0;

262

270 [[nodiscard]] virtual IChannel *CreateChannelComposition(

271const std::string_view& name);

278 [[nodiscard]] virtual std::vector<IChannel*> ChannelCompositions() = 0;

279

281 [[nodiscard]] bool IsNumber() const {

282// Need to check the cc at well if it is a value to text conversion

283if (const auto *cc = ChannelConversion();

284 cc != nullptr && cc->Type() <= ConversionType::ValueRangeToValue) {

285return true;

286 }

287return DataType() <= ChannelDataType::FloatBe;

288 }

289

291 [[nodiscard]] virtual IMetaData* CreateMetaData();

292

294 [[nodiscard]] virtual IMetaData* MetaData() const;

295

309virtual void AddAttachmentReference(const IAttachment* attachment);

310

312virtual std::vector<const IAttachment*> AttachmentList() const;

313

322void VlsdRecordId(uint64_t record_id) const {

323 vlsd_record_id_ = record_id;

324 }

325

334 [[nodiscard]] uint64_t VlsdRecordId() const {

335return vlsd_record_id_;

336 }

337

349template <typename T>

350bool GetChannelValue(const std::vector<uint8_t> &record_buffer,

351 T &dest, uint64_t array_index = 0) const;

352

368template <typename T>

369void SetChannelValue(const T &value, bool valid = true,

370 uint64_t array_index = 0);

371

381template<typename T>

382void SetChannelValues(const std::vector<T>& values);

383

391bool GetUnsignedValue(const std::vector<uint8_t> &record_buffer,

392 uint64_t &dest, uint64_t array_index = 0) const;

399virtual bool GetTextValue(const std::vector<uint8_t> &record_buffer,

400 std::string &dest) const;

410void SetTimestamp(double timestamp, std::vector<uint8_t> &record_buffer) const;

411

420virtual void BitCount(uint32_t bits) = 0;

421

423 [[nodiscard]] virtual uint32_t BitCount() const = 0;

424

433virtual void BitOffset(uint16_t bits) = 0;

434

436 [[nodiscard]] virtual uint16_t BitOffset() const = 0;

437

446virtual void ByteOffset(uint32_t bytes) = 0;

447

449 [[nodiscard]] virtual uint32_t ByteOffset() const = 0;

450

459virtual const IChannelGroup* ChannelGroup() const = 0;

460

467 uint64_t RecordId() const;

468

479template <typename V>

480static bool GetVirtualSample(uint64_t sample, V& value) {

481// No need for array index here. Array is weird usage for virtual channels

482// as the channel value = sample.

483 value = static_cast<V>(sample);

484return true;

485 }

486

494template <typename V = std::string>

495static bool GetVirtualSample(uint64_t sample, std::string& value) {

496 value = std::to_string(sample);

497return true;

498 }

499

511void CalculateMasterTime(bool calculate_master) {

512 calculate_master_time_ = calculate_master;

513 }

514

519 [[nodiscard]] bool CalculateMasterTime() const {

520return calculate_master_time_;

521 }

522

529void ArraySize(uint64_t array_size) { channel_array_size_ = array_size;}

534 [[nodiscard]] uint64_t ArraySize() const {return channel_array_size_;}

535 protected:

536

537

539bool GetSignedValue(const std::vector<uint8_t> &record_buffer,

540 int64_t &dest,

541 uint64_t array_index) const;

543bool GetFloatValue(const std::vector<uint8_t> &record_buffer,

544double &dest,

545 uint64_t array_index) const;

546

548virtual bool GetByteArrayValue(const std::vector<uint8_t> &record_buffer,

549 std::vector<uint8_t> &dest) const;

550

552bool GetCanOpenDate(const std::vector<uint8_t> &record_buffer,

553 uint64_t &dest) const;

554

556bool GetCanOpenTime(const std::vector<uint8_t> &record_buffer,

557 uint64_t &dest) const;

558

560 [[nodiscard]] virtual std::vector<uint8_t> &SampleBuffer() const = 0;

561

563virtual void SetValid(bool valid, uint64_t array_index);

564

566virtual bool GetValid(const std::vector<uint8_t> &record_buffer,

567 uint64_t array_index) const;

568

570void SetUnsignedValueLe(uint64_t value, bool valid, uint64_t array_index);

572void SetUnsignedValueBe(uint64_t value, bool valid, uint64_t array_index);

574void SetSignedValueLe(int64_t value, bool valid, uint64_t array_index);

576void SetSignedValueBe(int64_t value, bool valid, uint64_t array_index);

578void SetFloatValueLe(double value, bool valid, uint64_t array_index);

580void SetFloatValueBe(double value, bool valid, uint64_t array_index);

582virtual void SetTextValue(const std::string &value, bool valid);

584virtual void SetByteArray(const std::vector<uint8_t> &value, bool valid);

585

586

587 private:

588

589mutable uint64_t vlsd_record_id_ = 0;

590bool calculate_master_time_ = true;

591 uint64_t channel_array_size_ = 1;

592};

593

594template <typename T>

595bool IChannel::GetChannelValue(const std::vector<uint8_t> &record_buffer,

596 T &dest, uint64_t array_index) const {

597bool valid = false;

598

599switch (DataType()) {

600case ChannelDataType::UnsignedIntegerLe:

601case ChannelDataType::UnsignedIntegerBe: {

602 uint64_t value = 0;

603 valid = GetUnsignedValue(record_buffer, value, array_index);

604 dest = static_cast<T>(value);

605break;

606 }

607

608case ChannelDataType::SignedIntegerLe:

609case ChannelDataType::SignedIntegerBe: {

610 int64_t value = 0;

611 valid = GetSignedValue(record_buffer, value, array_index);

612 dest = static_cast<T>(value);

613break;

614 }

615case ChannelDataType::FloatLe:

616case ChannelDataType::FloatBe: {

617double value = 0;

618 valid = GetFloatValue(record_buffer, value, array_index);

619 dest = static_cast<T>(value);

620break;

621 }

622

623case ChannelDataType::StringUTF16Le:

624case ChannelDataType::StringUTF16Be:

625case ChannelDataType::StringUTF8:

626case ChannelDataType::StringAscii: {

627 std::string text;

628 valid = GetTextValue(record_buffer, text);

629 std::istringstream data(text);

630 data >> dest;

631break;

632 }

633

634case ChannelDataType::MimeStream:

635case ChannelDataType::MimeSample:

636case ChannelDataType::ByteArray: {

637 std::vector<uint8_t> list;

638 valid = GetByteArrayValue(record_buffer, list);

639 dest = list.empty() ? T{} : list[0];

640break;

641 }

642

643case ChannelDataType::CanOpenDate: {

644 uint64_t ms_since_1970 = 0;

645 valid = GetCanOpenDate(record_buffer, ms_since_1970);

646 dest = static_cast<T>(ms_since_1970);

647break;

648 }

649

650case ChannelDataType::CanOpenTime: {

651 uint64_t ms_since_1970 = 0;

652 valid = GetCanOpenTime(record_buffer, ms_since_1970);

653 dest = static_cast<T>(ms_since_1970);

654break;

655 }

656default:

657break;

658 }

659if (valid) {

660 valid = GetValid(record_buffer, array_index);

661 }

662return valid;

663}

664

666template <>

667bool IChannel::GetChannelValue(const std::vector<uint8_t> &record_buffer,

668 std::vector<uint8_t> &dest, uint64_t array_index) const;

669

671template <>

672bool IChannel::GetChannelValue(const std::vector<uint8_t> &record_buffer,

673 std::string &dest, uint64_t array_index) const;

674

675template <typename T>

676void IChannel::SetChannelValue(const T &value, bool valid,

677 uint64_t array_index ) {

678switch (DataType()) {

679case ChannelDataType::UnsignedIntegerLe:

680SetUnsignedValueLe(static_cast<uint64_t>(value), valid, array_index);

681break;

682

683case ChannelDataType::UnsignedIntegerBe:

684SetUnsignedValueBe(static_cast<uint64_t>(value), valid, array_index);

685break;

686

687case ChannelDataType::SignedIntegerLe:

688SetSignedValueLe(static_cast<int64_t>(value), valid, array_index);

689break;

690

691case ChannelDataType::SignedIntegerBe:

692SetSignedValueBe(static_cast<int64_t>(value), valid, array_index);

693break;

694

695case ChannelDataType::FloatLe:

696SetFloatValueLe(static_cast<double>(value), valid, array_index);

697break;

698

699case ChannelDataType::FloatBe:

700SetFloatValueBe(static_cast<double>(value), valid, array_index);

701break;

702

703case ChannelDataType::StringUTF8:

704case ChannelDataType::StringAscii:

705case ChannelDataType::StringUTF16Be:

706case ChannelDataType::StringUTF16Le:

707SetTextValue(std::to_string(value), valid);

708break;

709

710case ChannelDataType::MimeStream:

711case ChannelDataType::MimeSample:

712case ChannelDataType::ByteArray:

713// SetByteArray(value, valid);

714break;

715

716case ChannelDataType::CanOpenDate:

717if (typeid(T) == typeid(uint64_t) && DataBytes() == 7) {

718const auto date_array =

719MdfHelper::NsToCanOpenDateArray(static_cast<uint64_t>(value));

720SetByteArray(date_array, valid);

721 } else {

722SetValid(false, array_index);

723 }

724break;

725

726case ChannelDataType::CanOpenTime:

727if (typeid(T) == typeid(uint64_t) && DataBytes() == 6) {

728const auto time_array =

729MdfHelper::NsToCanOpenTimeArray(static_cast<uint64_t>(value));

730SetByteArray(time_array, valid);

731 } else {

732SetValid(false, array_index);

733 }

734break;

735

736default:

737SetValid(false, array_index);

738break;

739 }

740};

741

743template <>

744void IChannel::SetChannelValue(const std::string &value, bool valid,

745 uint64_t array_index);

746

748template <>

749void IChannel::SetChannelValue(const std::vector<uint8_t> &values, bool valid,

750 uint64_t array_index);

751

752template <typename T>

753void IChannel::SetChannelValues(const std::vector<T>& values) {

754const auto* array = ChannelArray();

755const auto array_size = array != nullptr ?

756 array->NofArrayValues() : 1;

757 uint64_t index = 0;

758for (const T& value : values) {

759if (index < array_size) {

760SetChannelValue(value, true, index);

761 }

762 ++index;

763 }

764}

765

766} // namespace mdf

mdf::IAttachment

Interface against an attached file.

Definition iattachment.h:21

mdf::IBlock

Base class for all MDF blocks.

Definition iblock.h:19

mdf::IChannelArray

Defines an interface against an array (CA) block.

Definition ichannelarray.h:74

mdf::IChannelConversion

Defines a channel conversion (CC) block.

Definition ichannelconversion.h:142

mdf::IChannelConversion::Type

virtual void Type(ConversionType type)=0

Sets the conversion type.

mdf::IChannelGroup

Interface against a channel group (CG) block.

Definition ichannelgroup.h:66

mdf::IChannel

Defines a MDF channel (CN) block.

Definition ichannel.h:126

mdf::IChannel::Range

virtual void Range(double min, double max)

Sets the ranges.

mdf::IChannel::Limit

virtual std::optional< std::pair< double, double > > Limit() const

Returns the limits.

mdf::IChannel::SetChannelValue

void SetChannelValue(const T &value, bool valid=true, uint64_t array_index=0)

Sets a channel value.

Definition ichannel.h:676

mdf::IChannel::ChannelGroup

virtual const IChannelGroup * ChannelGroup() const =0

Support function that returns its channel group.

mdf::IChannel::ChannelArray

virtual IChannelArray * ChannelArray() const

Returns the channel array object if any exist in this channel.

mdf::IChannel::ArraySize

void ArraySize(uint64_t array_size)

Sets the array size for the channel.

Definition ichannel.h:529

mdf::IChannel::Description

virtual std::string Description() const =0

Returns the description.

mdf::IChannel::SamplingRate

virtual double SamplingRate() const =0

Returns the sample rate (s). This is a MDF 3 feature.

mdf::IChannel::CalculateMasterTime

void CalculateMasterTime(bool calculate_master)

Defines if the master channel time should be calculated or not.

Definition ichannel.h:511

mdf::IChannel::SetByteArray

virtual void SetByteArray(const std::vector< uint8_t > &value, bool valid)

Support function that sets array values.

mdf::IChannel::SourceInformation

virtual ISourceInformation * SourceInformation() const

Returns the source information, if any.

mdf::IChannel::RecordId

uint64_t RecordId() const

Returns th channel group (CG) record ID.

mdf::IChannel::CreateSourceInformation

virtual ISourceInformation * CreateSourceInformation()

Creates a source information block.

mdf::IChannel::IsDecimalUsed

virtual bool IsDecimalUsed() const =0

Returns true if decimals is used

mdf::IChannel::AttachmentList

virtual std::vector< const IAttachment * > AttachmentList() const

Returns a list of attachment pointers.

mdf::IChannel::GetTextValue

virtual bool GetTextValue(const std::vector< uint8_t > &record_buffer, std::string &dest) const

Internally used function mainly for fetching VLSD text values.

mdf::IChannel::SetUnsignedValueLe

void SetUnsignedValueLe(uint64_t value, bool valid, uint64_t array_index)

Support function that sets unsigned little endian values.

mdf::IChannel::SetTimestamp

void SetTimestamp(double timestamp, std::vector< uint8_t > &record_buffer) const

The function change the supplied records time channel value.

mdf::IChannel::VlsdRecordId

uint64_t VlsdRecordId() const

Returns the VLSD record id.

Definition ichannel.h:334

mdf::IChannel::Unit

virtual void Unit(const std::string &unit)=0

Sets unit string or or the MIME text string.

mdf::IChannel::GetUnsignedValue

bool GetUnsignedValue(const std::vector< uint8_t > &record_buffer, uint64_t &dest, uint64_t array_index=0) const

Internally used function mainly for fetching VLSD index values.

mdf::IChannel::ByteOffset

virtual uint32_t ByteOffset() const =0

Returns the byte offset to data in the record.

mdf::IChannel::GetVirtualSample

static bool GetVirtualSample(uint64_t sample, std::string &value)

Specialization that returns virtual sample values.

Definition ichannel.h:495

mdf::IChannel::Type

virtual void Type(ChannelType type)=0

Sets the type of channel.

mdf::IChannel::SamplingRate

virtual void SamplingRate(double sampling_rate)=0

Sets the sample rate (s). This is a MDF 3 feature.

mdf::IChannel::Sync

virtual void Sync(ChannelSyncType type)

Sets the type of sync.

mdf::IChannel::BitCount

virtual uint32_t BitCount() const =0

Returns the data size in number of bits.

mdf::IChannel::DataBytes

virtual uint64_t DataBytes() const =0

Data size (bytes);.

mdf::IChannel::Type

virtual ChannelType Type() const =0

Type of channel.

mdf::IChannel::ByteOffset

virtual void ByteOffset(uint32_t bytes)=0

Sets the byte offset in record to to data.

mdf::IChannel::Flags

virtual void Flags(uint32_t flags)

Sets channel flags. Flags are defined in the CnFlag namespace

mdf::IChannel::CreateChannelConversion

virtual IChannelConversion * CreateChannelConversion()=0

Creates a conversion block.

mdf::IChannel::MetaData

virtual IMetaData * MetaData() const

Returns the meta-data (MD) block if it exist.

mdf::IChannel::SampleBuffer

virtual std::vector< uint8_t > & SampleBuffer() const =0

Support function that gets the channel group sample buffer.

mdf::IChannel::Name

virtual std::string Name() const =0

Returns channel name.

mdf::IChannel::CreateMetaData

virtual IMetaData * CreateMetaData()

Creates a metadata (MD) block.

mdf::IChannel::ChannelCompositions

virtual std::vector< IChannel * > ChannelCompositions()=0

Creates a composition channel.

mdf::IChannel::GetCanOpenDate

bool GetCanOpenDate(const std::vector< uint8_t > &record_buffer, uint64_t &dest) const

Support function that get CANOpen date values from a record.

mdf::IChannel::SetFloatValueBe

void SetFloatValueBe(double value, bool valid, uint64_t array_index)

Support function that sets float big endian values.

mdf::IChannel::SetSignedValueBe

void SetSignedValueBe(int64_t value, bool valid, uint64_t array_index)

Support function that sets signed big endian values.

mdf::IChannel::DataBytes

virtual void DataBytes(uint64_t nof_bytes)=0

Sets the data size (bytes)

mdf::IChannel::SetTextValue

virtual void SetTextValue(const std::string &value, bool valid)

Support function that sets text values.

mdf::IChannel::CreateChannelComposition

virtual IChannel * CreateChannelComposition(const std::string_view &name)

Creates a composition channel with a specific name or returns an existing channel.

mdf::IChannel::Range

virtual std::optional< std::pair< double, double > > Range() const

Returns the ranges.

mdf::IChannel::CreateChannelArray

virtual IChannelArray * CreateChannelArray()

Create or returns an existing channel array (CA) block.

mdf::IChannel::Description

virtual void Description(const std::string &description)=0

Sets the description.

mdf::IChannel::Decimals

virtual uint8_t Decimals() const =0

Number of decimals (floating points)

mdf::IChannel::BitCount

virtual void BitCount(uint32_t bits)=0

Sets the size of data in bits.

mdf::IChannel::DataType

virtual ChannelDataType DataType() const =0

Data type.

mdf::IChannel::SetValid

virtual void SetValid(bool valid, uint64_t array_index)

Support function that sets the valid flag.

mdf::IChannel::SetFloatValueLe

void SetFloatValueLe(double value, bool valid, uint64_t array_index)

Support function that sets float little endian values.

mdf::IChannel::SetUnsignedValueBe

void SetUnsignedValueBe(uint64_t value, bool valid, uint64_t array_index)

Support function that sets unsigned big endian values.

mdf::IChannel::GetFloatValue

bool GetFloatValue(const std::vector< uint8_t > &record_buffer, double &dest, uint64_t array_index) const

Support function that get float values from a record.

mdf::IChannel::GetCanOpenTime

bool GetCanOpenTime(const std::vector< uint8_t > &record_buffer, uint64_t &dest) const

Support function that get CANOpen time values from a record.

mdf::IChannel::GetSignedValue

bool GetSignedValue(const std::vector< uint8_t > &record_buffer, int64_t &dest, uint64_t array_index) const

Support function that get signed integer from a record.

mdf::IChannel::BitOffset

virtual void BitOffset(uint16_t bits)=0

Sets the offset to data in bits.

mdf::IChannel::DisplayName

virtual std::string DisplayName() const =0

Display name.

mdf::IChannel::IsNumber

bool IsNumber() const

Returns true if the channel is a number.

Definition ichannel.h:281

mdf::IChannel::BitOffset

virtual uint16_t BitOffset() const =0

Returns offset to data (0..7).

mdf::IChannel::GetValid

virtual bool GetValid(const std::vector< uint8_t > &record_buffer, uint64_t array_index) const

Support function that return true if the valid bit is set.

mdf::IChannel::AddAttachmentReference

virtual void AddAttachmentReference(const IAttachment *attachment)

Adds an attachment reference to the channel.

mdf::IChannel::Limit

virtual void Limit(double min, double max)

Sets the limits.

mdf::IChannel::Unit

virtual std::string Unit() const =0

Returns the unit string or the MIME content type string.

mdf::IChannel::ArraySize

uint64_t ArraySize() const

Returns 1 if no array and > 1 if it is an array.

Definition ichannel.h:534

mdf::IChannel::IsUnitValid

virtual bool IsUnitValid() const =0

True if unit exists.

mdf::IChannel::GetByteArrayValue

virtual bool GetByteArrayValue(const std::vector< uint8_t > &record_buffer, std::vector< uint8_t > &dest) const

Support function that get array values from a record.

mdf::IChannel::SetSignedValueLe

void SetSignedValueLe(int64_t value, bool valid, uint64_t array_index)

Support function that sets signed little endian values.

mdf::IChannel::ChannelConversion

virtual IChannelConversion * ChannelConversion() const =0

Returns the conversion block, if any.

mdf::IChannel::DataType

virtual void DataType(ChannelDataType type)=0

Sets the data type.

mdf::IChannel::Name

virtual void Name(const std::string &name)=0

Sets channel name.

mdf::IChannel::CreateChannelComposition

virtual IChannel * CreateChannelComposition()=0

Creates a composition channel.

mdf::IChannel::SetChannelValues

void SetChannelValues(const std::vector< T > &values)

Sets channel array values.

Definition ichannel.h:753

mdf::IChannel::GetVirtualSample

static bool GetVirtualSample(uint64_t sample, V &value)

Returns the value for a virtual sample.

Definition ichannel.h:480

mdf::IChannel::Decimals

virtual void Decimals(uint8_t precision)

Sets number of decimals (floating points only)

mdf::IChannel::Sync

virtual ChannelSyncType Sync() const

Type of sync.

mdf::IChannel::VlsdRecordId

void VlsdRecordId(uint64_t record_id) const

Sets the VLSD record id.

Definition ichannel.h:322

mdf::IChannel::DisplayName

virtual void DisplayName(const std::string &name)=0

Sets display name.

mdf::IChannel::GetChannelValue

bool GetChannelValue(const std::vector< uint8_t > &record_buffer, T &dest, uint64_t array_index=0) const

Parse out the channel value from a data record.

Definition ichannel.h:595

mdf::IChannel::ExtLimit

virtual std::optional< std::pair< double, double > > ExtLimit() const

Returns the extended limits.

mdf::IChannel::ExtLimit

virtual void ExtLimit(double min, double max)

Sets the extended limits.

mdf::IChannel::CalculateMasterTime

bool CalculateMasterTime() const

Defines if the master channel time is calculated or user defined.

Definition ichannel.h:519

mdf::IChannel::Flags

virtual uint32_t Flags() const

Channel flags are defined in the CnFlag namespace

mdf::IMetaData

Interface against an meta data block (MD) in a MDF4 file.

Definition imetadata.h:27

mdf::ISourceInformation

Interface to a source information (SI) block.

Definition isourceinformation.h:51

mdf::MdfHelper::NsToCanOpenTimeArray

static std::vector< uint8_t > NsToCanOpenTimeArray(uint64_t ns_since_1970)

Converts from nanoseconds to CANopen 6 byte Time array.

mdf::MdfHelper::NsToCanOpenDateArray

static std::vector< uint8_t > NsToCanOpenDateArray(uint64_t ns_since_1970)

Converts from nanoseconds to CANopen 7 byte Date array.

iattachment.h

Interface against an attached file.

iblock.h

All MDF blocks inherits from the IBlock class. The interface class is used internally in lists....

ichannelarray.h

Defines a channel array (CA) block.

ichannelconversion.h

Defines a channel conversion (CC) block.

imetadata.h

isourceinformation.h

Interface against a source information (SI) block.

mdfhelper.h

Support class for the MDF library.

mdf::CnFlag::LimitValid

constexpr uint32_t LimitValid

Limit is used.

Definition ichannel.h:110

mdf::CnFlag::Discrete

constexpr uint32_t Discrete

Discrete channel.

Definition ichannel.h:112

mdf::CnFlag::BusEvent

constexpr uint32_t BusEvent

Bus event channel.

Definition ichannel.h:116

mdf::CnFlag::PrecisionValid

constexpr uint32_t PrecisionValid

Precision is used.

Definition ichannel.h:108

mdf::CnFlag::Calibration

constexpr uint32_t Calibration

Calibrated channel.

Definition ichannel.h:113

mdf::CnFlag::StrictlyMonotonous

constexpr uint32_t StrictlyMonotonous

Strict monotonously.

Definition ichannel.h:117

mdf::CnFlag::Virtual

constexpr uint32_t Virtual

Virtual channel.

Definition ichannel.h:115

mdf::CnFlag::Calculated

constexpr uint32_t Calculated

Calculated channel.

Definition ichannel.h:114

mdf::CnFlag::DefaultX

constexpr uint32_t DefaultX

Default x-axis channel.

Definition ichannel.h:118

mdf::CnFlag::VlsdDataStream

constexpr uint32_t VlsdDataStream

VLSD data stream channel.

Definition ichannel.h:120

mdf::CnFlag::ExtendedLimitValid

constexpr uint32_t ExtendedLimitValid

Extended limit is used.

Definition ichannel.h:111

mdf::CnFlag::RangeValid

constexpr uint32_t RangeValid

Range is used.

Definition ichannel.h:109

mdf::CnFlag::AllValuesInvalid

constexpr uint32_t AllValuesInvalid

All values are invalid.

Definition ichannel.h:106

mdf::CnFlag::InvalidValid

constexpr uint32_t InvalidValid

Invalid bit is used.

Definition ichannel.h:107

mdf::CnFlag::EventSignal

constexpr uint32_t EventSignal

Event signal.

Definition ichannel.h:119

mdf

Main namespace for the MDF library.

Definition canmessage.h:17

mdf::ByteArray

std::vector< uint8_t > ByteArray

Defines a dynamic byte array.

Definition zlibutil.h:17

mdf::ChannelSyncType

ChannelSyncType

Synchronization type.

Definition ichannel.h:66

mdf::ChannelSyncType::Distance

@ Distance

Distance type.

mdf::ChannelSyncType::Angle

@ Angle

Angle type.

mdf::ChannelSyncType::None

@ None

No synchronization (default value)

mdf::ChannelSyncType::Index

@ Index

Sample number.

mdf::ChannelSyncType::Time

@ Time

Time type.

mdf::ConversionType::ValueRangeToValue

@ ValueRangeToValue

Value range to value conversion without interpolation. Defined by a list of Key min/max value triplet...

mdf::ChannelType

ChannelType

Channel functional type.

Definition ichannel.h:51

mdf::ChannelType::VirtualMaster

@ VirtualMaster

Virtual master channel.

mdf::ChannelType::FixedLength

@ FixedLength

Fixed length data (default type)

mdf::ChannelType::MaxLength

@ MaxLength

Max length channel.

mdf::ChannelType::VirtualData

@ VirtualData

Virtual data channel.

mdf::ChannelType::VariableLength

@ VariableLength

Variable length data.

mdf::ChannelType::Sync

@ Sync

Synchronize channel.

mdf::ChannelType::Master

@ Master

Master channel.

mdf::ChannelDataType

ChannelDataType

Channel data type.

Definition ichannel.h:82

mdf::ChannelDataType::StringUTF16Le

@ StringUTF16Le

Text, UTF16 coded little endian.

mdf::ChannelDataType::StringUTF8

@ StringUTF8

Text, UTF8 coded.

mdf::ChannelDataType::ByteArray

@ ByteArray

Byte array.

mdf::ChannelDataType::CanOpenDate

@ CanOpenDate

7-byte CANOpen date.

mdf::ChannelDataType::SignedIntegerBe

@ SignedIntegerBe

Signed integer, big endian.

mdf::ChannelDataType::UnsignedIntegerLe

@ UnsignedIntegerLe

Unsigned integer, little endian.

mdf::ChannelDataType::ComplexBe

@ ComplexBe

Complex value, big endian.

mdf::ChannelDataType::StringUTF16Be

@ StringUTF16Be

Text, UTF16 coded big endian.

mdf::ChannelDataType::FloatLe

@ FloatLe

Float, little endian.

mdf::ChannelDataType::MimeSample

@ MimeSample

MIME sample byte array.

mdf::ChannelDataType::StringAscii

@ StringAscii

Text, ISO-8859-1 coded.

mdf::ChannelDataType::FloatBe

@ FloatBe

Float, big endian.

mdf::ChannelDataType::SignedIntegerLe

@ SignedIntegerLe

Signed integer, little endian.

mdf::ChannelDataType::ComplexLe

@ ComplexLe

Complex value, little endian.

mdf::ChannelDataType::CanOpenTime

@ CanOpenTime

6-byte CANOpen time.

mdf::ChannelDataType::UnsignedIntegerBe

@ UnsignedIntegerBe

Unsigned integer, big endian.

mdf::ChannelDataType::MimeStream

@ MimeStream

MIME stream byte array.


Generated by 1.12.0