PdCom  5.0
Process data communication client
Loading...
Searching...
No Matches
MessageManagerBase.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vim:tw=78
3 *
4 * Copyright (C) 2022 Richard Hacker (lerichi at gmx dot net),
5 * Bjarne von Horn (vh at igh dot de).
6 *
7 * This file is part of the PdCom library.
8 *
9 * The PdCom library is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * The PdCom library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>.
21 *
22 *****************************************************************************/
23
26#ifndef PDCOM5_MESSAGEMANAGERBASE_H
27#define PDCOM5_MESSAGEMANAGERBASE_H
28
29#include "pdcom5_export.h"
30
31#include <chrono>
32#include <cstdint>
33#include <memory>
34#include <string>
35#include <vector>
36
37namespace PdCom {
38namespace impl {
39class Process;
40}
41
42enum class LogLevel : int {
43 Reset = -1,
44 Emergency = 0,
45 Alert = 1,
46 Critical = 2,
47 Error = 3,
48 Warn = 4,
49 Info = 6,
50 Debug = 7,
51 Trace = 8,
52};
53
55struct Message
56{
57 uint32_t seqNo;
60 std::string path;
61 std::chrono::nanoseconds time;
62 std::string text;
63 int index;
65};
66
67class PDCOM5_PUBLIC MessageManagerBase
68{
69 public:
72 MessageManagerBase(MessageManagerBase const &) = delete;
73 MessageManagerBase &operator=(MessageManagerBase &&) noexcept;
74 MessageManagerBase &operator=(MessageManagerBase const &) = delete;
75
76 protected:
86 void getMessage(uint32_t seqNo) const;
87
94 void activeMessages() const;
95
96 virtual ~MessageManagerBase();
97
98 private:
99 friend impl::Process;
100 std::weak_ptr<impl::Process> process_;
101
111 virtual void processMessage(Message message);
112
119 virtual void getMessageReply(Message message);
120
130 virtual void activeMessagesReply(std::vector<Message> messageList);
131};
132} // namespace PdCom
133
134
135#endif // PDCOM5_MESSAGEMANAGERBASE_H
Definition: MessageManagerBase.h:68
void activeMessages() const
Request a list of all active messages.
void getMessage(uint32_t seqNo) const
Request specific message from history.
library version string as "major.minor.patch"
Definition: ClientStatistics.h:31
LogLevel
Definition: MessageManagerBase.h:42
@ Critical
Critical log level.
@ Info
Info log level.
@ Reset
Message is reset.
@ Warn
Warn log level.
@ Error
Error log level.
@ Emergency
Emergency log level.
@ Debug
Debug log level.
@ Alert
Alert log level.
@ Trace
Trace log level.
Message structure.
Definition: MessageManagerBase.h:56
uint32_t seqNo
sequence number.
Definition: MessageManagerBase.h:57
std::string text
Text of message.
Definition: MessageManagerBase.h:62
LogLevel level
severity
Definition: MessageManagerBase.h:59
std::chrono::nanoseconds time
event time in nanoseconds since epoch
Definition: MessageManagerBase.h:61
int index
-1 for scalar; index in case of a vector
Definition: MessageManagerBase.h:63
std::string path
event's path
Definition: MessageManagerBase.h:60