libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqt_hosthealthstate.h
Go to the documentation of this file.
1 // Copyright 2021-2023 Bloomberg Finance L.P.
2 // SPDX-License-Identifier: Apache-2.0
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 // bmqt_hosthealthstate.h -*-C++-*-
17 #ifndef INCLUDED_BMQT_HOSTHEALTHSTATE
18 #define INCLUDED_BMQT_HOSTHEALTHSTATE
19 
30 
31 // BMQ
32 
33 // BDE
34 #include <bsl_iosfwd.h>
35 #include <bsl_string.h>
36 
37 namespace BloombergLP {
38 namespace bmqt {
39 
40 // ======================
41 // struct HostHealthState
42 // ======================
43 
46  // TYPES
47  enum Enum { e_UNKNOWN = 0, e_HEALTHY = 1, e_UNHEALTHY = 2 };
48 
49  // CLASS METHODS
50 
63  static bsl::ostream& print(bsl::ostream& stream,
65  int level = 0,
66  int spacesPerLevel = 4);
67 
76  static const char* toAscii(HostHealthState::Enum value);
77 
82  static bool fromAscii(HostHealthState::Enum* out,
83  const bslstl::StringRef& str);
84 };
85 
86 // FREE OPERATORS
87 
90 bsl::ostream& operator<<(bsl::ostream& stream, HostHealthState::Enum value);
91 
92 } // close package namespace
93 
94 // ============================================================================
95 // INLINE DEFINITIONS
96 // ============================================================================
97 
98 // ----------------------
99 // struct HostHealthState
100 // ----------------------
101 
102 // FREE OPERATORS
103 inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,
105 {
106  return HostHealthState::print(stream, value, 0, -1);
107 }
108 
109 } // close enterprise namespace
110 
111 #endif
bsl::ostream & operator<<(bsl::ostream &stream, CompressionAlgorithmType::Enum value)
Definition: bmqt_compressionalgorithmtype.h:141
Definition: bmqa_abstractsession.h:42
Enumeration for host health states.
Definition: bmqt_hosthealthstate.h:45
Enum
Definition: bmqt_hosthealthstate.h:47
@ e_HEALTHY
Definition: bmqt_hosthealthstate.h:47
@ e_UNKNOWN
Definition: bmqt_hosthealthstate.h:47
@ e_UNHEALTHY
Definition: bmqt_hosthealthstate.h:47
static bsl::ostream & print(bsl::ostream &stream, HostHealthState::Enum value, int level=0, int spacesPerLevel=4)
static const char * toAscii(HostHealthState::Enum value)
static bool fromAscii(HostHealthState::Enum *out, const bslstl::StringRef &str)