OpenMAMA
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
MamaSubscription.h
Go to the documentation of this file.
1 /* $Id$
2  *
3  * OpenMAMA: The open middleware agnostic messaging API
4  * Copyright (C) 2011 NYSE Technologies, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  */
21 
22 #ifndef MAMA_SUBSCRIPTION_CPP_H__
23 #define MAMA_SUBSCRIPTION_CPP_H__
24 
26 #include "mama/subscription.h"
27 
28 namespace Wombat
29 {
30  class MamaSubscriptionCallback;
31  class MamaSource;
32  class MamaSourceDerivative;
33 
34  struct MamaSubscriptionImpl;
43  class MAMACPPExpDLL MamaSubscription : public MamaBasicSubscription
44  {
45  public:
46  virtual ~MamaSubscription ();
47 
48  /* Construct a MamaSubscription. MamaSubscription::createXXX() must be
49  * called to activate the subscription.
50  */
51  MamaSubscription (void);
52 
53  virtual void setCSubscription (mamaSubscription subscription);
54  virtual mamaSubscription getCSubscription ();
55 
66  virtual void setup (MamaTransport* transport,
67  MamaQueue* queue,
68  MamaSubscriptionCallback* callback,
69  const char* source,
70  const char* symbol,
71  void* closure = NULL);
72 
83  virtual void setup (MamaQueue* queue,
84  MamaSubscriptionCallback* callback,
85  MamaSource* source,
86  const char* symbol,
87  void* closure = NULL);
88 
120  virtual void activate ();
121 
126  virtual void deactivate ();
127 
128 
140  virtual void create (MamaTransport* transport,
141  MamaQueue* queue,
142  MamaSubscriptionCallback* callback,
143  const char* source,
144  const char* symbol,
145  void* closure = NULL);
146 
158  virtual void create (MamaQueue* queue,
159  MamaSubscriptionCallback* callback,
160  MamaSource* source,
161  const char* symbol,
162  void* closure = NULL);
163 
177  virtual void createSnapshot (MamaTransport* transport,
178  MamaQueue* queue,
179  MamaSubscriptionCallback* callback,
180  const char* source,
181  const char* symbol,
182  void* closure = NULL);
183 
191  virtual void setRequiresInitial (bool requiresInitial);
192 
196  virtual bool getRequiresInitial (void);
197 
201  virtual bool getReceivedInitial (void);
202 
211  virtual void setRetries (int retries);
212 
216  virtual int getRetries (void);
217 
223  virtual void setSubscriptionType (mamaSubscriptionType type);
224 
228  virtual mamaSubscriptionType getSubscriptionType (void);
229 
233  virtual long getServiceLevelOpt (void);
234 
242  virtual void setServiceLevel (mamaServiceLevel svcLevel,
243  long svcLevelOpt);
244 
248  virtual mamaServiceLevel getServiceLevel (void);
249 
255  virtual const char* getSymbol (void) const;
256 
257  virtual MamaSubscriptionCallback* getCallback (void) const;
258 
263  virtual void setSymbol (const char* symbol);
264 
271  virtual const MamaSourceDerivative* getSourceDerivative (void) const;
272 
279  virtual MamaSourceDerivative* getSourceDerivative (void);
280 
286  virtual const MamaSource* getSource (void) const;
287 
293  virtual const char* getSubscSource (void) const;
294 
301  virtual void setTimeout (double timeout);
302 
306  virtual double getTimeout (void);
307 
314  virtual void setRecoverGaps (bool recover);
315 
322  virtual bool getRecoverGaps (void) const;
323 
329  virtual void setAppDataType (uint8_t dataType);
330 
336  virtual uint8_t getAppDataType () const;
337 
343  virtual void setGroupSizeHint (int groupSizeHint);
344 
357  virtual void setItemClosure (void* closure);
358 
366  virtual void* getItemClosure (void);
367 
379  virtual void setPreInitialCacheSize (int cacheSize);
380 
386  virtual int getPreInitialCacheSize (void);
387 
406  virtual void setMsgQualifierFilter (bool ignoreDefinitelyDuplicate,
407  bool ignorePossiblyDuplicate,
408  bool ignoreDefinitelyDelyaed,
409  bool ignorePossiblyDelayed,
410  bool ignoreOutOfSequence);
411 
431  virtual void getMsgQualifierFilter (bool &ignoreDefinitelyDuplicate,
432  bool &ignorePossiblyDuplicate,
433  bool &ignoreDefinitelyDelyaed,
434  bool &ignorePossiblyDelayed,
435  bool &ignoreOutOfSequence) const;
436 
443  virtual void destroy ();
444 
454  virtual void destroyEx();
455 
456  private:
457 
458  /* Private functions. */
459  static void MAMACALLTYPE onSubscriptionCreate (mamaSubscription subscription,
460  void *closure);
461 
462  static void MAMACALLTYPE onSubscriptionDestroy (mamaSubscription subscription,
463  void *closure);
464 
465  static void MAMACALLTYPE onSubscriptionError (mamaSubscription subscription,
466  mama_status status,
467  void *platformError,
468  const char *subject,
469  void *closure);
470 
471  static void MAMACALLTYPE onSubscriptionGap (mamaSubscription subscription,
472  void* closure);
473 
474  static void MAMACALLTYPE onSubscriptionMessage (mamaSubscription subscription,
475  mamaMsg msg,
476  void *closure,
477  void *topicClosure);
478 
479  static void MAMACALLTYPE onSubscriptionQuality (mamaSubscription subscription,
480  mamaQuality quality,
481  const char *symbol,
482  short cause,
483  const void *platformInfo,
484  void *closure);
485 
486  static void MAMACALLTYPE onSubscriptionRecapRequest (mamaSubscription subscription,
487  void* closure);
488 
489  // The callback class passed to the create function
490  MamaSubscriptionCallback *mCallback;
491 
492  // The source derivative
493  MamaSourceDerivative *mSourceDeriv;
494  MamaSubscriptionImpl *mImpl;
495  };
496 
497 } // namespace Wombat
498 #endif // MAMA_SUBSCRIPTION_CPP_H__


© 2012 Linux Foundation