MDF Lib 2.2
Interface against MDF 3/4 files
Loading...
Searching...
No Matches
ifilehistory.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 Ingemar Hedvall
3 * SPDX-License-Identifier: MIT
4 */
5
10#pragma once
11#include <cstdint>
12#include <string>
13
14#include "imdftimestamp.h"
15#include "itimestamp.h"
16#include "mdf/iblock.h"
17#include "mdf/imetadata.h"
18
19namespace mdf {
20
28class IFileHistory : public IBlock {
29 public:
36 virtual void Time(uint64_t ns_since_1970) = 0;
37
45 virtual void Time(ITimestamp& timestamp) = 0;
46
52 [[nodiscard]] virtual uint64_t Time() const = 0;
53
61 [[nodiscard]] virtual const mdf::IMdfTimestamp* StartTimestamp() const = 0;
62
67 [[nodiscard]] virtual IMetaData* CreateMetaData() = 0;
68
73 [[nodiscard]] virtual const IMetaData* MetaData() const = 0;
74
81 void Description(const std::string& description) {
82 auto* md4 = CreateMetaData();
83 if (md4 != nullptr) {
84 md4->StringProperty("TX", description);
85 }
86 }
87
93 [[nodiscard]] std::string Description() const {
94 const auto* md4 = MetaData();
95 return md4 != nullptr ? md4->StringProperty("TX") : std::string();
96 }
97
103 void ToolName(const std::string& tool_name) {
104 auto* md4 = CreateMetaData();
105 if (md4 != nullptr) {
106 md4->StringProperty("tool_id", tool_name);
107 }
108 }
109
114 [[nodiscard]] std::string ToolName() const {
115 const auto* md4 = MetaData();
116 return md4 != nullptr ? md4->StringProperty("tool_id") : std::string();
117 }
118
124 void ToolVendor(const std::string& tool_vendor) {
125 auto* md4 = CreateMetaData();
126 if (md4 != nullptr) {
127 md4->StringProperty("tool_vendor", tool_vendor);
128 }
129 }
130
135 [[nodiscard]] std::string ToolVendor() const {
136 const auto* md4 = MetaData();
137 return md4 != nullptr ? md4->StringProperty("tool_vendor") : std::string();
138 }
139
145 void ToolVersion(const std::string& tool_version) {
146 auto* md4 = CreateMetaData();
147 if (md4 != nullptr) {
148 md4->StringProperty("tool_version", tool_version);
149 }
150 }
151
156 [[nodiscard]] std::string ToolVersion() const {
157 const auto* md4 = MetaData();
158 return md4 != nullptr ? md4->StringProperty("tool_version") : std::string();
159 }
160
166 void UserName(const std::string& user) {
167 auto* md4 = CreateMetaData();
168 if (md4 != nullptr) {
169 md4->StringProperty("user_name", user);
170 }
171 }
172
177 [[nodiscard]] std::string UserName() const {
178 const auto* md4 = MetaData();
179 return md4 != nullptr ? md4->StringProperty("user_name") : std::string();
180 }
181};
182
183} // namespace mdf
Base class for all MDF blocks.
Definition iblock.h:19
Interface class against an MDF FH block.
Definition ifilehistory.h:28
virtual const mdf::IMdfTimestamp * StartTimestamp() const =0
Returns the start timestamp of the measurement.
void Description(const std::string &description)
Sets the description for the history block.
Definition ifilehistory.h:81
void ToolVendor(const std::string &tool_vendor)
Sets the tool vendor.
Definition ifilehistory.h:124
void ToolVersion(const std::string &tool_version)
Sets the tool version.
Definition ifilehistory.h:145
std::string ToolVendor() const
Returns the tool vendor.
Definition ifilehistory.h:135
virtual uint64_t Time() const =0
Returns the time for the history block.
void UserName(const std::string &user)
Sets the user name.
Definition ifilehistory.h:166
void ToolName(const std::string &tool_name)
Sets the tool name.
Definition ifilehistory.h:103
std::string ToolName() const
Returns the tool name.
Definition ifilehistory.h:114
std::string UserName() const
Returns the user name.
Definition ifilehistory.h:177
virtual void Time(ITimestamp &timestamp)=0
Sets the time using an ITimestamp object.
std::string ToolVersion() const
Returns the tool version.
Definition ifilehistory.h:156
virtual const IMetaData * MetaData() const =0
Returns an constant interface against a MD4 block.
virtual void Time(uint64_t ns_since_1970)=0
Sets the time when the history block was created.
std::string Description() const
Returns the description.
Definition ifilehistory.h:93
virtual IMetaData * CreateMetaData()=0
Returns an interface against a MD4 block.
Interface for MDF timestamp handling.
Definition imdftimestamp.h:22
Interface against an meta data block (MD) in a MDF4 file.
Definition imetadata.h:27
Interface for timestamp handling in MDF files.
Definition itimestamp.h:17
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