/usr/include/mamda/MamdaSubscription.h is in libmamda-dev 2.2.2.1-10.
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 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | /* $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 MamdaSubscriptionH
#define MamdaSubscriptionH
#include <mamda/MamdaConfig.h>
#include <mama/mamacpp.h>
#include <mama/marketdata.h>
#include <mamda/MamdaFieldState.h>
namespace Wombat
{
class MamaSource;
class MamaTransport;
class MamaQueue;
class MamdaMsgListener;
class MamdaQualityListener;
class MamdaErrorListener;
/**
* A MamdaSubscription is used to register interest in a particular
* symbol and source. A MamaSource object is required to actually
* activate the subscription.
*
* Multiple listeners can be added to the MamdaSubscription. In this
* way, an application can make use of more than one of the
* specialized value added MAMDA listeners, such as MamdaTradeListener
* and MamdaQuoteListener.
*
* The queue argument may be null to use Mama's internal queue.
*/
class MAMDAExpDLL MamdaSubscription
{
public:
/**
* Default constructor. Use the create() method to create and
* activate the subscription.
*/
MamdaSubscription ();
/**
* Destructor.
*/
virtual ~MamdaSubscription ();
/**
* Clone this MamdaSubscription. Allocate an inactive
* MamdaSubscription object that is initialized as a duplicate of
* this one. The purpose of this facility is to enable a
* "template" of a MamdaSubscription for use with many
* subscriptions. The following subscription attributes are
* copied: source, symbol, queue, subscription type,
* service level, requires initial and timeout.
*/
virtual MamdaSubscription* clone() const;
/**
* Create and activate a subscription. Set any subscription properties
* prior to calling this method.
*/
void create (
MamaQueue* queue,
MamaSource* source,
const char* symbol,
void* closure = NULL);
/**
* Destroy a subscription.
*/
void destroy ();
/**
* Return whether subscription is active.
*/
bool isActive () const;
/**
* Set the data source name. Do this before calling activate().
*/
void setSource (MamaSource* source);
/**
* Set the symbol. Do this before calling activate().
*/
void setSymbol (const char* symbol);
/**
* Set the MAMA queue. Do this before calling activate().
*/
void setQueue (MamaQueue* queue);
/**
* Set the market data type. Do this before calling activate().
*/
void setMdDataType (mamaMdDataType mdDataType);
/**
* Set the subscription type. Do this before calling activate().
*/
void setType (mamaSubscriptionType type);
/**
* Set the MAMA service level.
*/
void setServiceLevel (mamaServiceLevel serviceLevel,
long serviceLevelOpt = 0);
/**
* Set whether an initial value is required. Do this before
* calling activate().
*/
void setRequireInitial (bool require);
/**
* Set the subscription timeout (in seconds). Do this before
* calling activate().
*/
void setTimeout (double timeout);
/**
* Set the subscription retries. Do this before
* calling activate().
*/
void setRetries (int retries);
/**
* Set the closure. Do this before calling activate().
*/
void setClosure (void* closure);
/**
* Set the group size hint. Do this before calling activate().
*/
void setGroupSizeHint (int groupSizeHint);
/**
* Set the MamaSubscription. This is normally done automatically.
*/
void setMamaSubscription (MamaSubscription* subscription);
/**
* Add a listener for regular messages.
*/
void addMsgListener (MamdaMsgListener* listener);
/**
* Add a listener for changes in quality status.
*/
void addQualityListener (MamdaQualityListener* listener);
/**
* Add a listener for error events.
*/
void addErrorListener (MamdaErrorListener* listener);
/**
* Return the vector of message listeners.
*
* @return Vector of message listeners registered with the object.
*/
std::vector<MamdaMsgListener*>& getMsgListeners ();
/**
* Activate the subscription. Until this method is invoked, no
* updates will be received. The parameters for the subscription
* should have been specified using the "set" methods.
*/
void activate ();
/**
* Deactivate the subscription. No more updates will be received
* for this subscription (unless activate() is invoked again).
*
* This function must be called from the same thread dispatching on the
* associated event queue unless both the default queue and dispatch queue are
* not actively dispatching.
*/
void deactivate ();
/**
* Deprecated.
* This method is now a no-op.
*/
void requestRecap ();
/**
* Return the source. Note: When using managed subscriptions this currently
* returns NULL
*/
MamaSource* getSource() const;
/**
* Return the publisher source name.
*/
const char* getSourceName() const;
/**
* Return the symbol.
*/
const char* getSymbol() const;
/**
* Return the exchange.
*/
const char* getExchange() const;
/**
* Return the transport.
*/
MamaTransport* getTransport() const;
/**
* Return the queue.
*/
MamaQueue* getQueue() const;
/**
* Return the MamaSubscription object.
*/
MamaSubscription* getMamaSubscription();
/**
* Return the subscription type.
*/
mamaSubscriptionType getType() const;
/**
* Return the service level.
*/
mamaServiceLevel getServiceLevel() const;
/**
* Return the service level option.
*/
long getServiceLevelOpt() const;
/**
* Return whether an initial is required.
*/
bool getRequireInitial() const;
/**
* Return the timeout (seconds).
*/
double getTimeout() const;
/**
* Return the retries.
*/
int getRetries() const;
/**
* Get the additional object passed as the closure to the create()
* method.
*/
void* getClosure() const;
/**
* Get the message-level sequence number. This number is normally
* sequential although there are some exceptions. Erroneous
* exceptions are reported via the "quality listener" interface.
*/
uint32_t getSeqNum() const;
/**
* Set the item closure for group subscriptions.
*
* Setting the item closure for a non-group subscription provides
* a second closure.
*/
void setItemClosure (void* closure);
/**
* Get the item closure for group subscriptions.
*/
void* getItemClosure (void);
/**
* Return whether the debug level for this subscription equals or
* exceeds some level.
*
* @param level The debug level to check.
* @return whether the level equals or exceeds the set level for this
* subscription.
*/
bool checkDebugLevel (MamaLogLevel level) const;
private:
struct MamdaSubscriptionImpl;
MamdaSubscriptionImpl& mImpl;
};
} // namespace
#endif // MamdaSubscriptionH
|