libbmq ecc88f70b521c69eeac96cc22d896b0acda2f8bd
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
133 bool isValid() const;
134
144 bsl::ostream&
145 print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
146};
147
148// FREE OPERATORS
149
152bsl::ostream& operator<<(bsl::ostream& stream, const QueueId& rhs);
153
157bool operator==(const QueueId& lhs, const QueueId& rhs);
158
162bool operator!=(const QueueId& lhs, const QueueId& rhs);
163
166bool operator<(const QueueId& lhs, const QueueId& rhs);
167
168} // close package namespace
169
170// ============================================================================
171// INLINE DEFINITIONS
172// ============================================================================
173
174// -------------
175// class QueueId
176// -------------
177
178inline bsl::ostream& bmqa::operator<<(bsl::ostream& stream,
179 const bmqa::QueueId& rhs)
180{
181 return rhs.print(stream, 0, -1);
182}
183
184inline bool bmqa::operator==(const bmqa::QueueId& lhs,
185 const bmqa::QueueId& rhs)
186{
187 return rhs.d_impl_sp.get() == lhs.d_impl_sp.get();
188}
189
190inline bool bmqa::operator!=(const bmqa::QueueId& lhs,
191 const bmqa::QueueId& rhs)
192{
193 return rhs.d_impl_sp.get() != lhs.d_impl_sp.get();
194}
195
196inline bool bmqa::operator<(const bmqa::QueueId& lhs, const bmqa::QueueId& rhs)
197{
198 return rhs.d_impl_sp.get() < lhs.d_impl_sp.get();
199}
200
201} // close enterprise namespace
202
203#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
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:196
Definition bmqa_abstractsession.h:42