PLCnext API Documentation 26.6.0.38
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 // Flags start from bit 8 (only in SystemState).
67
71 FlagsMask = 0xFFFFFF00,
75 EventMask = ~FlagsMask,
79 SystemError = (1 << 8),
83 SystemTerminating = (1 << 9),
84};
85
87// global stream operators of enum SystemEvent for logging and parsing
88ARP_EXPORT std::ostream& operator<<(std::ostream& os, SystemEvent value);
89ARP_EXPORT std::istream& operator>>(std::istream& is, SystemEvent& value);
90
91constexpr SystemEvent operator&(SystemEvent lhs, SystemEvent rhs)
92{
93 using U = std::underlying_type<SystemEvent>::type;
94 return static_cast<SystemEvent>(static_cast<U>(lhs) & static_cast<U>(rhs));
95}
96
97constexpr SystemEvent operator|(SystemEvent lhs, SystemEvent rhs)
98{
99 using U = std::underlying_type<SystemEvent>::type;
100 return static_cast<SystemEvent>(static_cast<U>(lhs) | static_cast<U>(rhs));
101}
102
103constexpr SystemEvent& operator&=(SystemEvent& lhs, SystemEvent rhs)
104{
105 lhs = lhs & rhs;
106 return lhs;
107}
108
109constexpr SystemEvent& operator|=(SystemEvent& lhs, SystemEvent rhs)
110{
111 lhs = lhs | rhs;
112 return lhs;
113}
114
115constexpr SystemEvent operator~(SystemEvent arg)
116{
117 using U = std::underlying_type<SystemEvent>::type;
118 return static_cast<SystemEvent>(~static_cast<U>(arg));
119}
120
121}}}} // end of namespace Arp::Base::Acf::Commons
122
124// template specialization of SystemEvent formatter
125template<> struct fmt::formatter<Arp::Base::Acf::Commons::SystemEvent> : public fmt::ostream_formatter {};
126
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Root namespace for the PLCnext API