PLCnext API Documentation 26.0.1.58
SystemEvent.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/Enum.hxx"
9
10namespace Arp { namespace Base { namespace Acf { namespace Commons
11{
15enum class SystemEvent : uint32
16{
20 None = 0,
24 Linked = 10,
28 Initialized = 20,
32 Loaded = 30,
36 Started = 40,
40 Stopping = 50,
44 Resetting = 60,
48 Disposing = 70,
52 Unlinking = 80,
60 PoweringDown = 90,
64 PoweredDown = 100,
65
66
67 // Flags start from bit 8 (only in SystemState).
68
72 FlagsMask = 0xFFFFFF00,
76 EventMask = ~FlagsMask,
80 SystemError = (1 << 8)
81};
82
84// global stream operators of enum SystemEvent for logging and parsing
85ARP_EXPORT std::ostream& operator<<(std::ostream& os, SystemEvent value);
86ARP_EXPORT std::istream& operator>>(std::istream& is, SystemEvent& value);
87
88constexpr SystemEvent operator&(SystemEvent lhs, SystemEvent rhs)
89{
90 using U = std::underlying_type<SystemEvent>::type;
91 return static_cast<SystemEvent>(static_cast<U>(lhs) & static_cast<U>(rhs));
92}
93
94constexpr SystemEvent operator|(SystemEvent lhs, SystemEvent rhs)
95{
96 using U = std::underlying_type<SystemEvent>::type;
97 return static_cast<SystemEvent>(static_cast<U>(lhs) | static_cast<U>(rhs));
98}
99
100constexpr SystemEvent& operator&=(SystemEvent& lhs, SystemEvent rhs)
101{
102 lhs = lhs & rhs;
103 return lhs;
104}
105
106constexpr SystemEvent& operator|=(SystemEvent& lhs, SystemEvent rhs)
107{
108 lhs = lhs | rhs;
109 return lhs;
110}
111
112constexpr SystemEvent operator~(SystemEvent arg)
113{
114 using U = std::underlying_type<SystemEvent>::type;
115 return static_cast<SystemEvent>(~static_cast<U>(arg));
116}
117
118}}}} // end of namespace Arp::Base::Acf::Commons
119
121// template specialization of SystemEvent formatter
122template<> struct fmt::formatter<Arp::Base::Acf::Commons::SystemEvent> : public fmt::ostream_formatter {};
123
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Root namespace for the PLCnext API