MDF Lib 2.2
Interface against MDF 3/4 files
Loading...
Searching...
No Matches
ievent.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Ingemar Hedvall
3 * SPDX-License-Identifier: MIT
4 */
5
9#pragma once
10#include <mdf/iattachment.h>
11#include <mdf/iblock.h>
12
13#include <cstdint>
14#include <string>
15#include <vector>
16
17namespace mdf {
19enum class EventType : uint8_t {
20 RecordingPeriod = 0,
23 StartRecording = 3,
24 StopRecording = 4,
25 Trigger = 5,
26 Marker = 6
27};
28
30enum class SyncType : uint8_t {
31 SyncTime = 1,
32 SyncAngle = 2,
33 SyncDistance = 3,
34 SyncIndex = 4,
35};
36
38enum class RangeType : uint8_t {
39 RangePoint = 0,
40 RangeStart = 1,
41 RangeEnd = 2
42};
43
45enum class EventCause : uint8_t {
46 CauseOther = 0,
47 CauseError = 1,
48 CauseTool = 2,
49 CauseScript = 3,
50 CauseUser = 4,
51};
52
58class IEvent : public IBlock {
59 public:
60 virtual void Name(const std::string& name) = 0;
61 [[nodiscard]] virtual const std::string& Name() const = 0;
62
64 virtual void GroupName(const std::string& group_name) = 0;
66 [[nodiscard]] virtual const std::string& GroupName() const = 0;
67
68
69 virtual void Type(EventType event_type) = 0;
70 [[nodiscard]] virtual EventType Type() const = 0;
71 [[nodiscard]] std::string TypeToString() const;
72
73 virtual void Sync(SyncType sync_type) = 0;
74 [[nodiscard]] virtual SyncType Sync() const = 0;
75
76 virtual void Range(RangeType range_type) = 0;
77 [[nodiscard]] virtual RangeType Range() const = 0;
78 [[nodiscard]] std::string RangeToString() const;
79
80 virtual void Cause(EventCause cause) = 0;
81 [[nodiscard]] virtual EventCause Cause() const = 0;
82 [[nodiscard]] std::string CauseToString() const;
83
84 virtual void CreatorIndex(size_t index) = 0;
85 [[nodiscard]] virtual size_t CreatorIndex() const = 0;
86
87 virtual void SyncValue(int64_t value) = 0;
88 [[nodiscard]] virtual int64_t SyncValue() const = 0;
89
90 virtual void SyncFactor(double factor) = 0;
91 [[nodiscard]] virtual double SyncFactor() const = 0;
92 [[nodiscard]] std::string ValueToString() const;
93
95 virtual void ParentEvent(const IEvent* parent) = 0;
97 [[nodiscard]] virtual const IEvent* ParentEvent() const = 0;
98
100 virtual void RangeEvent(const IEvent* range_event) = 0;
102 [[nodiscard]] virtual const IEvent* RangeEvent() const = 0;
103
105 virtual void AddScope(const void* scope) = 0;
107 [[nodiscard]] virtual const std::vector<const void*>& Scopes() const = 0;
108
110 virtual void AddAttachment(const IAttachment* attachment) = 0;
112 [[nodiscard]] virtual const std::vector<const IAttachment*>& Attachments()
113 const = 0;
114
119 [[nodiscard]] virtual IMetaData* CreateMetaData() = 0;
120
125 [[nodiscard]] virtual const IMetaData* MetaData() const = 0;
126
127 void Description(const std::string& description);
128 [[nodiscard]] std::string Description() const;
129
130 void PreTrig(double pre_trig);
131
132 [[nodiscard]] double PreTrig() const;
133
134 void PostTrig(double post_trig);
135
136 [[nodiscard]] double PostTrig() const;
137};
138
139} // namespace mdf
Interface against an attached file.
Definition iattachment.h:21
Base class for all MDF blocks.
Definition iblock.h:19
Interface against an event block.
Definition ievent.h:58
virtual void AddScope(const void *scope)=0
Adds a scope reference.
virtual const std::vector< const void * > & Scopes() const =0
Returns referenced CN and CG blocks.
virtual size_t CreatorIndex() const =0
Creator index.
std::string Description() const
Returns description.
virtual void Range(RangeType range_type)=0
Sets type of range.
virtual void Cause(EventCause cause)=0
Sets the cause.
virtual const std::string & Name() const =0
Name.
virtual const IMetaData * MetaData() const =0
Returns an constant interface against a MD4 block.
void PostTrig(double post_trig)
Sets the post-trig value (s)
virtual double SyncFactor() const =0
Sync factor.
void Description(const std::string &description)
Sets description.
std::string RangeToString() const
Range to string.
virtual void AddAttachment(const IAttachment *attachment)=0
Adds an attachment reference.
virtual SyncType Sync() const =0
Type of sync.
virtual void ParentEvent(const IEvent *parent)=0
Sets the parent event.
virtual const std::string & GroupName() const =0
Returns the group name.
virtual EventCause Cause() const =0
Cause of event.
virtual RangeType Range() const =0
Type of range.
virtual IMetaData * CreateMetaData()=0
Returns an interface against an MD4 block.
double PreTrig() const
Returns the pre-trig value (s).
virtual void RangeEvent(const IEvent *range_event)=0
Sets the range.
std::string CauseToString() const
Cause to string.
virtual void GroupName(const std::string &group_name)=0
Sets the group name.
virtual const IEvent * RangeEvent() const =0
Returns the range.
virtual void Name(const std::string &name)=0
Sets the name.
virtual const IEvent * ParentEvent() const =0
Returns the parent event.
virtual void CreatorIndex(size_t index)=0
Sets the creator index.
std::string TypeToString() const
Typ as string.
virtual void SyncFactor(double factor)=0
Sets the factor.
void PreTrig(double pre_trig)
Sets the pre-trig time (s).
virtual void Sync(SyncType sync_type)=0
Sets type of sync.
double PostTrig() const
Returns the post-trig value (s).
virtual int64_t SyncValue() const =0
Sync value.
virtual void Type(EventType event_type)=0
Sets type of event.
std::string ValueToString() const
Sync value as string.
virtual void SyncValue(int64_t value)=0
Sets the sync value.
virtual EventType Type() const =0
Type of event.
virtual const std::vector< const IAttachment * > & Attachments() const =0
Returns a list of attachment references.
Interface against an meta data block (MD) in a MDF4 file.
Definition imetadata.h:27
Interface against an attached file.
All MDF blocks inherits from the IBlock class. The interface class is used internally in lists....
Main namespace for the MDF library.
Definition canmessage.h:17
RangeType
Type of range.
Definition ievent.h:38
@ RangeStart
First in a range.
@ RangePoint
Defines a point.
@ RangeEnd
Last in a range.
SyncType
Type of synchronization value (default time)
Definition ievent.h:30
@ SyncDistance
Sync value represent distance (m).
@ SyncAngle
Sync value represent angle (rad).
@ SyncIndex
Sync value represent sample index.
@ SyncTime
Sync value represent time (s).
EventCause
Type of cause.
Definition ievent.h:45
@ CauseUser
A user generated this event.
@ CauseOther
Unknown source.
@ CauseScript
A script generated this event.
@ CauseError
An error generated this event.
@ CauseTool
The tool generated this event.
EventType
Type of event.
Definition ievent.h:19
@ Marker
Another generic event (maybe range).
@ StopRecording
Stop recording event.
@ StartRecording
Start recording event.
@ RecordingPeriod
Specifies a recording period (range).
@ RecordingInterrupt
The recording was interrupted.
@ AcquisitionInterrupt
The data acquisition was interrupted.
@ Trigger
Generic event (no range).