libbmq 57a4779af25c7e9db2550c596f277dd91da7e3c2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bmqa_configurequeuestatus.h
Go to the documentation of this file.
1// Copyright 2019-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// bmqa_configurequeuestatus.h -*-C++-*-
17#ifndef INCLUDED_BMQA_CONFIGUREQUEUESTATUS
18#define INCLUDED_BMQA_CONFIGUREQUEUESTATUS
19
38
39// BMQ
40
41#include <bmqa_queueid.h>
42#include <bmqt_resultcode.h>
43
44// BDE
45#include <bsl_iostream.h>
46#include <bsl_string.h>
47#include <bslma_allocator.h>
48#include <bslma_default.h>
49#include <bslma_usesbslmaallocator.h>
50#include <bslmf_nestedtraitdeclaration.h>
51
52namespace BloombergLP {
53namespace bmqa {
54
55// ==========================
56// class ConfigureQueueStatus
57// ==========================
58
62 private:
63 // DATA
64
66 QueueId d_queueId;
67
70
72 bsl::string d_errorDescription;
73
74 public:
75 // TRAITS
76 BSLMF_NESTED_TRAIT_DECLARATION(ConfigureQueueStatus,
77 bslma::UsesBslmaAllocator)
78
79 // CREATORS
80
81
82 explicit ConfigureQueueStatus(bslma::Allocator* allocator = 0);
83
87 bslma::Allocator* allocator = 0);
88
94 const bsl::string& errorDescription,
95 bslma::Allocator* allocator = 0);
96
97 // MANIPULATORS
98
102
103 // ACCESSORS
104
106 operator bool() const;
107
109 const QueueId& queueId() const;
110
114
117 const bsl::string& errorDescription() const;
118
128 bsl::ostream&
129 print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
130};
131
132// FREE OPERATORS
133
137bool operator==(const ConfigureQueueStatus& lhs,
138 const ConfigureQueueStatus& rhs);
139
143bool operator!=(const ConfigureQueueStatus& lhs,
144 const ConfigureQueueStatus& rhs);
145
148bsl::ostream& operator<<(bsl::ostream& stream,
149 const ConfigureQueueStatus& rhs);
150
151// ============================================================================
152// INLINE DEFINITIONS
153// ============================================================================
154
155// --------------------------
156// class ConfigureQueueStatus
157// --------------------------
158
159// CREATORS
160inline ConfigureQueueStatus::ConfigureQueueStatus(bslma::Allocator* allocator)
161: d_queueId(allocator)
162, d_result(bmqt::ConfigureQueueResult::e_SUCCESS)
163, d_errorDescription(allocator)
164{
165 // NOTHING
166}
167
169 const ConfigureQueueStatus& other,
170 bslma::Allocator* allocator)
171: d_queueId(other.d_queueId, allocator)
172, d_result(other.d_result)
173, d_errorDescription(other.d_errorDescription)
174{
175 // NOTHING
176}
177
179 const QueueId& queueId,
181 const bsl::string& errorDescription,
182 bslma::Allocator* allocator)
183: d_queueId(queueId, allocator)
184, d_result(result)
185, d_errorDescription(errorDescription)
186{
187 // NOTHING
188}
189
190// MANIPULATORS
193{
194 d_queueId = other.queueId();
195 d_result = other.result();
196 d_errorDescription = other.errorDescription();
197 return *this;
198}
199
200// ACCESSORS
201inline ConfigureQueueStatus::operator bool() const
202{
203 return result() == bmqt::ConfigureQueueResult::e_SUCCESS;
204}
205
207{
208 return d_queueId;
209}
210
212{
213 return d_result;
214}
215
216inline const bsl::string& ConfigureQueueStatus::errorDescription() const
217{
218 return d_errorDescription;
219}
220
221} // close package namespace
222
223// FREE OPERATORS
224inline bsl::ostream& bmqa::operator<<(bsl::ostream& stream,
226{
227 return rhs.print(stream, 0, -1);
228}
229
232{
233 return lhs.queueId() == rhs.queueId() && lhs.result() == rhs.result() &&
234 lhs.errorDescription() == rhs.errorDescription();
235}
236
239{
240 return !(lhs == rhs);
241}
242
243} // close enterprise namespace
244
245#endif
Provide a value-semantic efficient identifier for a queue.
Provide enums for various publicly exposed result code.
Definition bmqa_configurequeuestatus.h:61
const bsl::string & errorDescription() const
Definition bmqa_configurequeuestatus.h:216
ConfigureQueueStatus(bslma::Allocator *allocator=0)
Default constructor, use the optionally specified allocator.
Definition bmqa_configurequeuestatus.h:160
ConfigureQueueStatus & operator=(const ConfigureQueueStatus &rhs)
Definition bmqa_configurequeuestatus.h:192
bmqt::ConfigureQueueResult::Enum result() const
Definition bmqa_configurequeuestatus.h:211
const QueueId & queueId() const
Return the queueId associated to this operation result, if any.
Definition bmqa_configurequeuestatus.h:206
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Value-semantic efficient identifier for a queue.
Definition bmqa_queueid.h:59
bool operator!=(const CloseQueueStatus &lhs, const CloseQueueStatus &rhs)
Definition bmqa_closequeuestatus.h:240
bool operator==(const CloseQueueStatus &lhs, const CloseQueueStatus &rhs)
Definition bmqa_closequeuestatus.h:233
bsl::ostream & operator<<(bsl::ostream &stream, const CloseQueueStatus &rhs)
Definition bmqa_closequeuestatus.h:227
Definition bmqa_abstractsession.h:42
Enum
Definition bmqt_resultcode.h:215
@ e_SUCCESS
Definition bmqt_resultcode.h:217