65 virtual bool OnSample(uint64_t sample, uint64_t record_id,
66 const std::vector<uint8_t>& record);
84 std::function<bool(uint64_t sample, uint64_t record_id,
100 template <
typename V>
103 const std::vector<uint8_t>& record,
105 uint64_t array_index = 0)
const {
109 switch (channel.
Type()) {
154 template <
typename V>
157 const std::vector<uint8_t>& record,
159 uint64_t array_index = 0)
const {
162 if (conversion ==
nullptr) {
174 array_index) && conversion->Convert(v, value);
182 array_index) && conversion->Convert(v, value);
190 array_index) && conversion->Convert(v, value);
200 array_index) && conversion->Convert(v, value);
216 bool attached_ =
false;
Defines a MDF channel (CN) block.
Definition ichannel.h:126
virtual void Type(ChannelType type)=0
Sets the type of channel.
virtual IChannelConversion * ChannelConversion() const =0
Returns the conversion block, if any.
virtual void DataType(ChannelDataType type)=0
Sets the data type.
static bool GetVirtualSample(uint64_t sample, V &value)
Returns the value for a virtual sample.
Definition ichannel.h:480
void VlsdRecordId(uint64_t record_id) const
Sets the VLSD record id.
Definition ichannel.h:322
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
Interface to a data group (DG) block.
Definition idatagroup.h:42
Interface to a sample observer that handle incoming samples events.
Definition isampleobserver.h:23
const IDataGroup & data_group_
Reference to the data group (DG) block.
Definition isampleobserver.h:214
virtual ~ISampleObserver()
Destructor.
virtual void AttachObserver()
Attach the observer to an observer list (publisher).
bool GetChannelValue(const IChannel &channel, uint64_t sample, const std::vector< uint8_t > &record, V &value, uint64_t array_index=0) const
The function returns a channel value.
Definition isampleobserver.h:101
std::set< uint64_t > record_id_list_
List of subscribed channel groups.
Definition isampleobserver.h:213
virtual bool OnSample(uint64_t sample, uint64_t record_id, const std::vector< uint8_t > &record)
Observer function that receives the sample record and parse out a channel value.
std::function< bool(uint64_t sample, uint64_t record_id, const std::vector< uint8_t > &record)> DoOnSample
Function object that is called if assigned.
Definition isampleobserver.h:85
virtual void DetachObserver()
Detach the observer from an observer list.
ISampleObserver(const IDataGroup &data_group)
Sample observer constructor.
bool IsRecordIdNeeded(uint64_t record_id) const
Function that test if this observer needs to read a specific record.
Definition isampleobserver.h:75
bool GetEngValue(const IChannel &channel, uint64_t sample, const std::vector< uint8_t > &record, V &value, uint64_t array_index=0) const
Returns the scaled sample value for the channel with the record bytes as input. This function is main...
Definition isampleobserver.h:155
Defines an interface against a channel group (CG) block.
Interface to a data group (DG) block.
Main namespace for the MDF library.
Definition canmessage.h:17
@ VirtualMaster
Virtual master channel.
@ FixedLength
Fixed length data (default type)
@ MaxLength
Max length channel.
@ VirtualData
Virtual data channel.
@ VariableLength
Variable length data.
@ Sync
Synchronize channel.
@ StringUTF16Le
Text, UTF16 coded little endian.
@ StringUTF8
Text, UTF8 coded.
@ SignedIntegerBe
Signed integer, big endian.
@ UnsignedIntegerLe
Unsigned integer, little endian.
@ StringUTF16Be
Text, UTF16 coded big endian.
@ FloatLe
Float, little endian.
@ StringAscii
Text, ISO-8859-1 coded.
@ FloatBe
Float, big endian.
@ SignedIntegerLe
Signed integer, little endian.
@ UnsignedIntegerBe
Unsigned integer, big endian.