libbmq  a5f8a06ba1d16cb5a65643e1fa7f1a1d6aadef40
bmqa_event.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_event.h -*-C++-*-
17 #ifndef INCLUDED_BMQA_EVENT
18 #define INCLUDED_BMQA_EVENT
19 
45 
46 // BMQ
47 
48 #include <bmqa_messageevent.h>
49 #include <bmqa_sessionevent.h>
50 
51 // BDE
52 #include <bsl_iosfwd.h>
53 #include <bsl_memory.h>
54 
55 namespace BloombergLP {
56 
57 // FORWARD DECLARATION
58 namespace bmqimp {
59 class Event;
60 }
61 
62 namespace bmqa {
63 
64 // ===========
65 // class Event
66 // ===========
67 
69 class Event {
70  private:
71  // DATA
72  bsl::shared_ptr<bmqimp::Event> d_impl_sp; // pimpl
73 
74  public:
75  // CREATORS
76 
78  Event();
79 
80  // ACCESSORS
81 
85 
89 
91  bool isSessionEvent() const;
92 
94  bool isMessageEvent() const;
95 
105  bsl::ostream&
106  print(bsl::ostream& stream, int level = 0, int spacesPerLevel = 4) const;
107 };
108 
109 // FREE OPERATORS
110 
113 bsl::ostream& operator<<(bsl::ostream& stream, const Event& rhs);
114 
115 } // close package namespace
116 
117 // ============================================================================
118 // INLINE DEFINITIONS
119 // ============================================================================
120 
121 // -----------
122 // class Event
123 // -----------
124 
125 inline bsl::ostream& bmqa::operator<<(bsl::ostream& stream,
126  const bmqa::Event& rhs)
127 {
128  return rhs.print(stream, 0, -1);
129 }
130 
131 } // close enterprise namespace
132 
133 #endif
Provide the application with data event notifications.
Provide value-semantic type for system event session notifications.
A variant type encompassing all types of events.
Definition: bmqa_event.h:69
bool isMessageEvent() const
Return true if the event is a message event.
bool isSessionEvent() const
Return true if the event is a session event.
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
SessionEvent sessionEvent() const
Event()
Default constructor.
MessageEvent messageEvent() const
Definition: bmqa_messageevent.h:64
An event related to the operation of a Session.
Definition: bmqa_sessionevent.h:75
bsl::ostream & operator<<(bsl::ostream &stream, const CloseQueueStatus &rhs)
Definition: bmqa_closequeuestatus.h:227
Definition: bmqa_abstractsession.h:42