MDF Lib 2.2
Interface against MDF 3/4 files
Loading...
Searching...
No Matches
ichannelgroup.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 <algorithm>
11#include <string>
12#include <vector>
13
14#include "ichannel.h"
15#include "samplerecord.h"
16
17#include "mdf/iblock.h"
18#include "mdf/imetadata.h"
19
20namespace mdf {
22namespace CgFlag {
38constexpr uint16_t VlsdChannel = 0x0001;
39
41constexpr uint16_t BusEvent = 0x0002;
42
44constexpr uint16_t PlainBusEvent = 0x0004;
45
47constexpr uint16_t RemoteMaster = 0x0008;
48
50constexpr uint16_t EventSignal = 0x00010;
51} // namespace CgFlag
52
54
66class IChannelGroup : public IBlock {
67 public:
68
69 virtual void RecordId(uint64_t record_id) = 0;
70 [[nodiscard]] virtual uint64_t RecordId() const = 0;
71
72 virtual void Name(const std::string& name) = 0;
73 [[nodiscard]] virtual std::string Name() const = 0;
74
75 virtual void Description(const std::string& description)
76 = 0;
77 [[nodiscard]] virtual std::string Description() const = 0;
78
79 [[nodiscard]] virtual uint64_t NofSamples() const
80 = 0;
81 virtual void NofSamples(uint64_t nof_samples) = 0;
82
83 [[nodiscard]] virtual uint16_t Flags() const;
84 virtual void Flags(uint16_t flags);
85
86 [[nodiscard]] virtual char16_t PathSeparator();
87 virtual void PathSeparator(char16_t path_separator);
88
90 [[nodiscard]] virtual std::vector<IChannel*> Channels() const = 0;
91
93 [[nodiscard]] virtual IChannel* CreateChannel() = 0;
94
96 [[nodiscard]] virtual IChannel* CreateChannel(const std::string_view& name);
97
104 [[nodiscard]] virtual IChannel* GetChannel(const std::string_view& name) const;
105
106
108 [[nodiscard]] virtual const IChannel* GetXChannel(
109 const IChannel& reference) const = 0;
110
113
114 [[nodiscard]] virtual ISourceInformation* SourceInformation()
115 const;
116
118 [[nodiscard]] SampleRecord GetSampleRecord() const;
119
121 void ResetSampleCounter() const { sample_ = 0;}
122
123 virtual void ClearData();
124 void IncrementSample() const;
125
126 [[nodiscard]] size_t Sample() const;
127
129 [[nodiscard]] virtual IMetaData* CreateMetaData();
130
132 [[nodiscard]] virtual IMetaData* MetaData() const;
133
135 [[nodiscard]] virtual const IDataGroup* DataGroup() const = 0;
136
137 protected:
138 mutable std::vector<uint8_t>
140 private:
141 mutable size_t sample_ = 0;
142};
143
144} // namespace mdf
Base class for all MDF blocks.
Definition iblock.h:19
Interface against a channel group (CG) block.
Definition ichannelgroup.h:66
virtual void PathSeparator(char16_t path_separator)
Path separator.
virtual std::string Description() const =0
Description.
virtual uint64_t NofSamples() const =0
Sets number of samples.
virtual char16_t PathSeparator()
Sets the path separator.
virtual std::vector< IChannel * > Channels() const =0
Returns a list of channels.
virtual IChannel * GetChannel(const std::string_view &name) const
Returns an existing channels part of name.
std::vector< uint8_t > sample_buffer_
Temporary record when saving samples.
Definition ichannelgroup.h:139
virtual void ClearData()
Resets all temporary stored samples.
virtual const IChannel * GetXChannel(const IChannel &reference) const =0
Returns an external reference channel.
void IncrementSample() const
Add a sample.
size_t Sample() const
Returns number of samples.
virtual uint64_t RecordId() const =0
Record identity.
SampleRecord GetSampleRecord() const
Support function that creates a sample record.
virtual void NofSamples(uint64_t nof_samples)=0
Number of samples.
virtual void Description(const std::string &description)=0
Sets a descriptive text.
virtual void RecordId(uint64_t record_id)=0
Sets the record identity.
virtual ISourceInformation * CreateSourceInformation()
Create a source information (SI) block.
virtual uint16_t Flags() const
Sets CgFlag.
virtual IChannel * CreateChannel(const std::string_view &name)
Creates a new channel or returns an existing channel.
virtual void Name(const std::string &name)=0
Sets the name.
virtual IChannel * CreateChannel()=0
Creates a new channel.
virtual void Flags(uint16_t flags)
Returns CgFlag.
virtual ISourceInformation * SourceInformation() const
Returns the source information (SI) block if it exist. *‍/.
virtual std::string Name() const =0
CG name.
virtual IMetaData * CreateMetaData()
Creates a meta-data (MD) block.
virtual IMetaData * MetaData() const
Returns the meta-data (MD) block if it exist.
void ResetSampleCounter() const
Resets the internal sample counter. Internal use only.
Definition ichannelgroup.h:121
virtual const IDataGroup * DataGroup() const =0
Returns a pointer to data group (DG) block.
Defines a MDF channel (CN) block.
Definition ichannel.h:126
Interface to a data group (DG) block.
Definition idatagroup.h:42
Interface against an meta data block (MD) in a MDF4 file.
Definition imetadata.h:27
Interface to a source information (SI) block.
Definition isourceinformation.h:51
All MDF blocks inherits from the IBlock class. The interface class is used internally in lists....
The define an interface against a channel block (CN).
constexpr uint16_t PlainBusEvent
Plain bus event flag.
Definition ichannelgroup.h:44
constexpr uint16_t BusEvent
Bus event flag.
Definition ichannelgroup.h:41
constexpr uint16_t EventSignal
Event signal group. The group store events not values.
Definition ichannelgroup.h:50
constexpr uint16_t VlsdChannel
Flag is used to indicate the this block is a variable length CG block.
Definition ichannelgroup.h:38
constexpr uint16_t RemoteMaster
Remote master flag.
Definition ichannelgroup.h:47
Main namespace for the MDF library.
Definition canmessage.h:17
Simple record buffer structure.
Definition samplerecord.h:20