PdCom  5.3
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
25
26#ifndef PDCOM5_MESSAGEMANAGERBASE_H
27#define PDCOM5_MESSAGEMANAGERBASE_H
28
29#include <chrono>
30#include <cstdint>
31#include <memory>
32#include <pdcom5_export.h>
33#include <string>
34#include <vector>
35
36namespace PdCom {
37namespace impl {
38class Process;
39}
40
41enum class LogLevel : int {
42 Reset = -1,
44 Alert = 1,
46 Error = 3,
47 Warn = 4,
48 Info = 6,
49 Debug = 7,
50 Trace = 8,
51};
52
54struct Message
55{
56 uint32_t seqNo;
59 std::string path;
60 std::chrono::nanoseconds time;
61 std::string text;
62 int index;
64};
65
66class PDCOM5_PUBLIC MessageManagerBase
67{
68 public:
69 MessageManagerBase();
70 MessageManagerBase(MessageManagerBase &&) noexcept;
71 MessageManagerBase(MessageManagerBase const &) = delete;
72 MessageManagerBase &operator=(MessageManagerBase &&) noexcept;
73 MessageManagerBase &operator=(MessageManagerBase const &) = delete;
74
75 protected:
85 void getMessage(uint32_t seqNo) const;
86
93 void activeMessages() const;
94
95 virtual ~MessageManagerBase();
96
97 private:
98 friend impl::Process;
99 std::weak_ptr<impl::Process> process_;
100
110 virtual void processMessage(Message message);
111
118 virtual void getMessageReply(Message message);
119
129 virtual void activeMessagesReply(std::vector<Message> messageList);
130};
131} // namespace PdCom
132
133
134#endif // PDCOM5_MESSAGEMANAGERBASE_H
LogLevel
Definition MessageManagerBase.h:41
@ Critical
Critical log level.
Definition MessageManagerBase.h:45
@ Info
Info log level.
Definition MessageManagerBase.h:48
@ Reset
Message is reset.
Definition MessageManagerBase.h:42
@ Warn
Warn log level.
Definition MessageManagerBase.h:47
@ Error
Error log level.
Definition MessageManagerBase.h:46
@ Emergency
Emergency log level.
Definition MessageManagerBase.h:43
@ Debug
Debug log level.
Definition MessageManagerBase.h:49
@ Alert
Alert log level.
Definition MessageManagerBase.h:44
@ Trace
Trace log level.
Definition MessageManagerBase.h:50
void activeMessages() const
Request a list of all active messages.
void getMessage(uint32_t seqNo) const
Request specific message from history.
Message structure.
Definition MessageManagerBase.h:55
uint32_t seqNo
sequence number.
Definition MessageManagerBase.h:56
std::string text
Text of message.
Definition MessageManagerBase.h:61
LogLevel level
severity
Definition MessageManagerBase.h:58
std::chrono::nanoseconds time
event time in nanoseconds since epoch
Definition MessageManagerBase.h:60
int index
-1 for scalar; index in case of a vector
Definition MessageManagerBase.h:62
std::string path
event's path
Definition MessageManagerBase.h:59