OpenMAMA C++ API
MamaBasicSubscription.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_BASIC__SUBSCRIPTION_CPP_H__
23 #define MAMA_BASIC__SUBSCRIPTION_CPP_H__
24 
25 #include "mama/mama.h"
26 
27 namespace Wombat
28 {
29 class MamaStatus;
30 class MamaMsg;
31 class MamaQueue;
32 class MamaTransport;
33 class MamaBasicSubscriptionCallback;
34 
35 struct MamaBasicSubscriptionImpl;
44 class MAMACPPExpDLL MamaBasicSubscription
45 {
46 public:
47 
52  virtual ~MamaBasicSubscription ();
53 
57  MamaBasicSubscription (void);
58 
71  virtual void createBasic (
72  MamaTransport* transport,
73  MamaQueue* queue,
75  const char* topic,
76  void* closure = NULL);
77 
84  virtual void destroy ();
85 
95  virtual void destroyEx();
96 
102  virtual bool isActive (void) const;
103 
109  virtual const char* getTopic (void) const;
110 
115  virtual MamaTransport* getTransport (void) const;
116 
123  virtual MamaBasicSubscriptionCallback* getBasicCallback (void) const;
124 
130  virtual MamaQueue* getQueue (void) const;
131 
136  virtual void setClosure (void* closure);
137 
143  virtual void* getClosure (void) const;
144 
150  virtual void setDebugLevel (MamaLogLevel level);
151 
157  virtual MamaLogLevel getDebugLevel () const;
158 
167  virtual bool checkDebugLevel (MamaLogLevel level) const;
168 
177  virtual mamaSubscriptionState getState(void);
178 
179 private:
180 
181  /* Private functions. */
182  static void MAMACALLTYPE onSubscriptionCreate(mamaSubscription subsc, void *closure);
183  static void MAMACALLTYPE onSubscriptionDestroy(mamaSubscription subscription, void *closure);
184  static void MAMACALLTYPE onSubscriptionError(mamaSubscription subsc, mama_status status, void *platformError, const char *subject, void *closure);
185  static void MAMACALLTYPE onSubscriptionMessage(mamaSubscription subsc, mamaMsg msg, void *closure, void *itemClosure);
186 
187  // The callback class passed to the create function
189 
190  MamaBasicSubscriptionImpl* mImpl;
191 protected:
192 
193  // The closure passed to the create function
194  void *mClosure;
195 
196  // The queue passed to the create function
198 
199  // The underlying C subscription
200  mamaSubscription mSubscription;
201 
202  // The transport passed to the create function
204 };
205 
206 } // namespace Wombat
207 #endif // MAMA_BASIC__SUBSCRIPTION_CPP_H__
The message callback interface for basic subscriptions.
Definition: MamaBasicSubscriptionCallback.h:39
void * mClosure
Definition: MamaBasicSubscription.h:194
The MamaBasicSubscription interface represents a subscription to a topic with no market data semantic...
Definition: MamaBasicSubscription.h:44
Definition: MamaConnection.h:29
MamaTransport * mTransport
Definition: MamaBasicSubscription.h:203
Queue allows applications to dispatch events in order with multiple threads using a single MamaDispat...
Definition: MamaQueue.h:40
The MamaTransport class provides market data functionality.
Definition: MamaTransport.h:261
mamaSubscription mSubscription
Definition: MamaBasicSubscription.h:200
MamaQueue * mQueue
Definition: MamaBasicSubscription.h:197