libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqa_sessionevent.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_sessionevent.h -*-C++-*-
17 #ifndef INCLUDED_BMQA_SESSIONEVENT
18 #define INCLUDED_BMQA_SESSIONEVENT
19 
50 
51 // BMQ
52 
53 #include <bmqa_queueid.h>
54 #include <bmqt_correlationid.h>
55 #include <bmqt_sessioneventtype.h>
56 
57 // BDE
58 #include <bsl_memory.h>
59 #include <bsl_string.h>
60 
61 namespace BloombergLP {
62 
63 // FORWARD DECLARATION
64 namespace bmqimp {
65 class Event;
66 }
67 
68 namespace bmqa {
69 
70 // ==================
71 // class SessionEvent
72 // ==================
73 
75 class SessionEvent {
76  private:
77  // FRIENDS
78  friend bool operator==(const SessionEvent& lhs, const SessionEvent& rhs);
79  friend bool operator!=(const SessionEvent& lhs, const SessionEvent& rhs);
80 
81  private:
82  // DATA
83  bsl::shared_ptr<bmqimp::Event> d_impl_sp; // pimpl
84 
85  public:
86  // CREATORS
87 
90 
93  SessionEvent(const SessionEvent& other);
94 
95  // MANIPULATORS
96 
100 
101  // ACCESSORS
102 
105 
108 
112  QueueId queueId() const;
113 
116  int statusCode() const;
117 
120  const bsl::string& errorDescription() const;
121 
131  bsl::ostream&
132  print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
133 };
134 
135 // FREE OPERATORS
136 
140 bool operator==(const SessionEvent& lhs, const SessionEvent& rhs);
141 
145 bool operator!=(const SessionEvent& lhs, const SessionEvent& rhs);
146 
149 bsl::ostream& operator<<(bsl::ostream& stream, const SessionEvent& rhs);
150 
151 } // close package namespace
152 
153 // ============================================================================
154 // INLINE DEFINITIONS
155 // ============================================================================
156 
157 // ------------------
158 // class SessionEvent
159 // ------------------
160 
161 inline bsl::ostream& bmqa::operator<<(bsl::ostream& stream,
162  const bmqa::SessionEvent& rhs)
163 {
164  return rhs.print(stream, 0, -1);
165 }
166 
167 } // close enterprise namespace
168 
169 #endif
Provide a value-semantic efficient identifier for a queue.
Provide a value-semantic type usable as an efficient identifier.
Provide an enumeration for the different types of session events.
Value-semantic efficient identifier for a queue.
Definition: bmqa_queueid.h:59
An event related to the operation of a Session.
Definition: bmqa_sessionevent.h:75
SessionEvent(const SessionEvent &other)
const bsl::string & errorDescription() const
const bmqt::CorrelationId & correlationId() const
Return the correlationId associated to this event, if any.
SessionEvent & operator=(const SessionEvent &rhs)
bmqt::SessionEventType::Enum type() const
Return the session event type.
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
friend bool operator!=(const SessionEvent &lhs, const SessionEvent &rhs)
friend bool operator==(const SessionEvent &lhs, const SessionEvent &rhs)
SessionEvent()
Default constructor.
Definition: bmqt_correlationid.h:193
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_sessioneventtype.h:116