/usr/include/mama/MamaQueue.h is in libmama-dev 2.2.2.1-11ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | /* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef MAMA_QUEUE_CPP_H__
#define MAMA_QUEUE_CPP_H__
#include <mama/mamacpp.h>
#include <mama/queue.h>
namespace Wombat
{
class MamaQueueEnqueueCallback;
class MamaQueueMonitorCallback;
class MamaQueueEventCallback;
/**
* Queue allows applications to dispatch events in order with
* multiple threads using a single MamaDispatcher for each queue.
*
*/
class MAMACPPExpDLL MamaQueue
{
public:
MamaQueue (void);
MamaQueue (mamaQueue cQueue);
virtual ~MamaQueue (void);
/**
* Create a queue. Queues allow applications to dispatch events in
* order with multiple threads using a single mamaDispatcher for
* each queue.
*
* Callers should call delete queue when done.
*
* @return a pointer the queue.
*/
virtual void create (
mamaBridge bridgeImpl);
virtual void create (
mamaBridge bridgeImpl,
void* nativeQueue);
/**
* Dispatch message. Blocks and dispatches messages until unblock
* is called.
*/
virtual void dispatch ();
/**
* Dispatch messages until timeout (see release notes for details)
*/
virtual void timedDispatch (
uint64_t timeout);
/**
* Dispatch a single event from the specified queue. If there is no event on
* the queue simply return and do nothing
*/
virtual void dispatchEvent ();
/** Add a user event to a queue.
*
* @param callback Instance of the MamaQueueEventCallback interface.
* MamaQueueEventCallback.onEvent() will be invoked when the event fires.
* @param closure Optional user supplied arbitrary closure data which will be
* passed back in the MamaQueueEventCallback.onEvent) callback
* @throws MamaException Not currently implemented for pure Java API.
*/
virtual void enqueueEvent (
MamaQueueEventCallback* callback,
void* closure);
virtual void enqueueEvent (
MamaQueueEventCallback& callback,
void* closure);
/**
* stopDispatch the queue.
*/
virtual void stopDispatch ();
/**
* Returns the number of events currently on the queue.
*
* @return size_t The number of the events on the queue.
*/
virtual size_t getEventCount ();
/**
* Set a callback which will be invoked as each event is added to the
* underlying event queue.
*
* @param cb Pointer to an instance of MamaQueueEnqueueCallback
* @param closure Arbitrary user supplied data. Passed back to
* onEventEnqueue() for each event enqueued.
*/
virtual void setEnqueueCallback (
MamaQueueEnqueueCallback* cb,
void* closure);
/**
* Register an object to receive callbacks for monitoring the behaviour of
* the MamaQueue.
*
* @param cb Reference to the object which will receive callbacks.
* @param closure User supplied data which will be returned as the
* callbacks are invoked.
*/
virtual void setQueueMonitorCallback (
MamaQueueMonitorCallback* cb,
void* closure);
/**
* Specify a high watermark for events on the queue.
*
* The behaviour for setting this value varies depending on the
* underlying middleware.
*
* LBM: LBM uses an unbounded event queue. Setting this values allows users
* of the API to receive a callback if the value is exceeded. (See
* mamaQueue_setQueueMonitorCallback() for setting queue related callbacks)
* the default behaviour is for the queue to grow unbounded without
* notifications.
* The high watermark for LBM can be set for all queues at once by setting the
* mama.lbm.eventqueuemonitor.queue_size_warning property for the API. Calls
* to this function will override the value specified in mama.properties.
*
* RV: This will set a queue limit policy of TIBRVQUEUE_DISCARD_FIRST whereby
* the oldest events in the queue are discarded first. The discard amount will
* be set with a value of 1. i.e. events will be dropped from the queue one at
* a time. The default behaviour is an unlimited queue which does not discard
* events.
*/
virtual void setHighWatermark (
size_t highWatermark);
/**
* Return the high water mark as set via <code>setHighWaterMark()</code>
*/
virtual size_t getHighWatermark (void) const;
/**
* Set the low watermark.
* Only supported for Wombat TCP middleware.
* @param lowWatermark The low water mark.
*/
virtual void setLowWatermark (
size_t lowWatermark);
/**
* Return the low water mark as set via <code>setLowWaterMark()</code>
*/
virtual size_t getLowWatermark (void) const;
/**
* Associate a name identifier with the event queue. This will be used in
* queue related logging statements.
* The string is copied by the API.
*
* @param name The string name identifier for the queue.
*/
virtual void setQueueName (
const char* name);
/**
* Retrieve the string name identifier for the queue as specified from a
* call to <code>setQueueName()</code>.
* If a name has not been specified via a call to<code>setQueueName()</code>
* the queue will assume a default name of "NO_NAME"
*
* @return The name identifier for the MamaQueue.
*/
virtual const char* getQueueName () const;
/**
* Retrieve the string name identifier for the queue's bridge.
*
* @return The name identifier for the bridge: "wmw", "lbm", or "tibrv".
*/
virtual const char* getQueueBridgeName () const;
/**
* Destroy a queue. Note that the queue can only be destroyed if all of the objects created
* on it, (timers, subscriptions etc), have been destroyed.
*
* @param queue The queue.
* @exception MamaStatus with a code of MAMA_STATUS_QUEUE_OPEN_OBJECTS if there are still
* objects open against the queue.
*/
virtual void destroy ();
virtual void setClosure (
void* closure);
virtual void* getClosure ();
/**
* Destroy a queue. Note that the queue can only be destroyed if all of the objects created
* on it, (timers, subscriptions etc), have been destroyed. This function will block for the
* specified time or until all of the objects have been destroyed and will then destroy the queue.
*
* @param timeout The time to block for in ms.
* @exception MamaStatus with a code of MAMA_STATUS_TIMEOUT if the time elapsed.
*/
virtual void destroyTimedWait (
long timeout);
/**
* Destroy a queue. Note that the queue can only be destroyed if all of the objects created
* on it, (timers, subscriptions etc), have been destroyed. This function will block until
* all of the objects have been destroyed and will then destroy the queue.
*
*/
virtual void destroyWait ();
/**
* Access to C types for implementation of related classes.
*/
mamaQueue getCValue ();
const mamaQueue getCValue () const;
/**
* This can only be set once and only
* if the c value is not already set - E.g. from calling create()
*/
void setCValue (
mamaQueue cQueue);
struct MamaQueueImpl;
MamaQueueImpl* mPimpl;
private:
mamaQueue mQueue;
void destroyInternal (
mama_status status);
};
} // namespace Wombat
#endif // MAMA_QUEUE_CPP_H__
|