PLCnext API Documentation 25.0.2.69
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,
53 // Flags start from bit 8 (only in SystemState).
54
58 FlagsMask = 0xFFFFFF00,
62 EventMask = ~FlagsMask,
66 SystemError = (1 << 8)
67};
68
70// global stream operators of enum SystemEvent for logging and parsing
71ARP_EXPORT std::ostream& operator<<(std::ostream& os, SystemEvent value);
72ARP_EXPORT std::istream& operator>>(std::istream& is, SystemEvent& value);
73
74constexpr SystemEvent operator&(SystemEvent lhs, SystemEvent rhs)
75{
76 using U = std::underlying_type<SystemEvent>::type;
77 return static_cast<SystemEvent>(static_cast<U>(lhs) & static_cast<U>(rhs));
78}
79
80constexpr SystemEvent operator|(SystemEvent lhs, SystemEvent rhs)
81{
82 using U = std::underlying_type<SystemEvent>::type;
83 return static_cast<SystemEvent>(static_cast<U>(lhs) | static_cast<U>(rhs));
84}
85
86constexpr SystemEvent& operator&=(SystemEvent& lhs, SystemEvent rhs)
87{
88 lhs = lhs & rhs;
89 return lhs;
90}
91
92constexpr SystemEvent& operator|=(SystemEvent& lhs, SystemEvent rhs)
93{
94 lhs = lhs | rhs;
95 return lhs;
96}
97
98constexpr SystemEvent operator~(SystemEvent arg)
99{
100 using U = std::underlying_type<SystemEvent>::type;
101 return static_cast<SystemEvent>(~static_cast<U>(arg));
102}
103
104}}}} // end of namespace Arp::Base::Acf::Commons
105
107// template specialization of SystemEvent formatter
108template<> struct fmt::formatter<Arp::Base::Acf::Commons::SystemEvent> : public fmt::ostream_formatter {};
109
std::uint32_t uint32
The Arp unsigned integer type of 4 byte size.
Definition: PrimitiveTypes.hpp:33
Root namespace for the PLCnext API