libbmq b6028b29b733bc7541593d2905a5f79a9f0192fc
Loading...
Searching...
No Matches
bmqa_queueid.h
Go to the documentation of this file.
1// Copyright 2014-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_queueid.h -*-C++-*-
17#ifndef INCLUDED_BMQA_QUEUEID
18#define INCLUDED_BMQA_QUEUEID
19
29
30// BMQ
31
32#include <bmqt_correlationid.h>
33#include <bmqt_queueoptions.h>
34#include <bmqt_uri.h>
35
36// BDE
37#include <bsl_iosfwd.h>
38#include <bsl_memory.h>
39#include <bsl_string.h>
40#include <bslma_allocator.h>
41#include <bslma_usesbslmaallocator.h>
42#include <bslmf_nestedtraitdeclaration.h>
43#include <bsls_types.h>
44
45namespace BloombergLP {
46
47// FORWARD DECLARATION
48namespace bmqimp {
49class Queue;
50}
51
52namespace bmqa {
53
54// =============
55// class QueueId
56// =============
57
59class QueueId {
60 // FRIENDS
61 friend bool operator==(const QueueId& lhs, const QueueId& rhs);
62 friend bool operator!=(const QueueId& lhs, const QueueId& rhs);
63 friend bool operator<(const QueueId& lhs, const QueueId& rhs);
64
65 private:
66 // DATA
67 bsl::shared_ptr<bmqimp::Queue> d_impl_sp; // pimpl
68
69 public:
70 // TRAITS
71 BSLMF_NESTED_TRAIT_DECLARATION(QueueId, bslma::UsesBslmaAllocator)
72
73 // CREATORS
74
75
78 explicit QueueId(bslma::Allocator* allocator = 0);
79
82 QueueId(const QueueId& other, bslma::Allocator* allocator = 0);
83
87 explicit QueueId(const bmqt::CorrelationId& correlationId,
88 bslma::Allocator* allocator = 0);
89
93 explicit QueueId(bsls::Types::Int64 numeric,
94 bslma::Allocator* allocator = 0);
95
99 explicit QueueId(void* pointer, bslma::Allocator* allocator = 0);
100
106 explicit QueueId(const bsl::shared_ptr<void>& sharedPtr,
107 bslma::Allocator* allocator = 0);
108
109 // MANIPULATORS
110
113 QueueId& operator=(const QueueId& rhs);
114
115 // ACCESSORS
116
119 const bmqt::CorrelationId& correlationId() const;
120
122 bsls::Types::Uint64 flags() const;
123
126 const bmqt::Uri& uri() const;
127
129 const bmqt::QueueOptions& options() const;
130
136 bool isValid(bsl::ostream* reason_p = 0) const;
137
147 bsl::ostream&
148 print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
149};
150
151// FREE OPERATORS
152
155bsl::ostream& operator<<(bsl::ostream& stream, const QueueId& rhs);
156
160bool operator==(const QueueId& lhs, const QueueId& rhs);
161
165bool operator!=(const QueueId& lhs, const QueueId& rhs);
166
169bool operator<(const QueueId& lhs, const QueueId& rhs);
170
171} // close package namespace
172
173// ============================================================================
174// INLINE DEFINITIONS
175// ============================================================================
176
177// -------------
178// class QueueId
179// -------------
180
181inline bsl::ostream& bmqa::operator<<(bsl::ostream& stream,
182 const bmqa::QueueId& rhs)
183{
184 return rhs.print(stream, 0, -1);
185}
186
187inline bool bmqa::operator==(const bmqa::QueueId& lhs,
188 const bmqa::QueueId& rhs)
189{
190 return rhs.d_impl_sp.get() == lhs.d_impl_sp.get();
191}
192
193inline bool bmqa::operator!=(const bmqa::QueueId& lhs,
194 const bmqa::QueueId& rhs)
195{
196 return rhs.d_impl_sp.get() != lhs.d_impl_sp.get();
197}
198
199inline bool bmqa::operator<(const bmqa::QueueId& lhs, const bmqa::QueueId& rhs)
200{
201 return rhs.d_impl_sp.get() < lhs.d_impl_sp.get();
202}
203
204} // close enterprise namespace
205
206#endif
Provide a value-semantic type usable as an efficient identifier.
Provide a value-semantic type for options related to a queue.
Provide value-semantic type and utilities for a BlazingMQ queue URI.
Value-semantic efficient identifier for a queue.
Definition bmqa_queueid.h:59
const bmqt::QueueOptions & options() const
Return the options used when opening this queue.
bsls::Types::Uint64 flags() const
Return the flags used when opening this queue.
const bmqt::CorrelationId & correlationId() const
bool isValid(bsl::ostream *reason_p=0) const
Return whether this QueueId is valid, i.e., is associated to an opened queue.
friend bool operator<(const QueueId &lhs, const QueueId &rhs)
friend bool operator==(const QueueId &lhs, const QueueId &rhs)
friend bool operator!=(const QueueId &lhs, const QueueId &rhs)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
const bmqt::Uri & uri() const
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
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
bool operator<(const QueueId &lhs, const QueueId &rhs)
Definition bmqa_queueid.h:199
Definition bmqa_abstractsession.h:42