OpenMAMA C++ API
mamacpp.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_CPP_H__
23 #define MAMA_CPP_H__
24 
25 #include <stdio.h>
26 #include <cstring>
27 
28 #include <mama/mama.h>
30 #include <mama/MamaMsg.h>
31 #include <mama/MamaQueueGroup.h>
36 #include <mama/MamaSubscription.h>
38 #include <mama/MamaTransport.h>
39 #include <mama/MamaPublisher.h>
41 #include <mama/MamaInboxCallback.h>
42 #include <mama/MamaInbox.h>
43 #include <mama/MamaQueue.h>
47 #include <mama/MamaDispatcher.h>
48 #include <mama/MamaTimerCallback.h>
49 #include <mama/MamaTimer.h>
50 #include <mama/MamaIoCallback.h>
51 #include <mama/MamaIo.h>
53 #include <mama/MamaDictionary.h>
55 #include <mama/MamaDateTime.h>
56 #include <mama/MamaPrice.h>
58 #include <mama/MamaMsgField.h>
59 #include <mama/MamaStatus.h>
60 #include <mama/MamaSymbolMap.h>
61 #include <mama/MamaSymbolMapFile.h>
62 #include <mama/MamaLogFile.h>
64 #include <mama/MamaSymbolSource.h>
65 #include <mama/MamaMsgQual.h>
66 #include <mama/msgstatus.h>
67 #include <mama/types.h>
69 #include <mama/MamaSource.h>
70 #include <mama/MamaSourceManager.h>
71 #include <mama/MamaSourceGroup.h>
74 
75 
76 namespace Wombat
77 {
118 class MAMACPPExpDLL MamaLogFileCallback
119 {
120 public:
121  virtual ~MamaLogFileCallback () {}
122  virtual void onLogSizeExceeded () = 0;
123 };
124 
131 class MAMACPPExpDLL MamaStartCallback
132 {
133 public:
134  virtual ~MamaStartCallback () {};
135  virtual void onStartComplete (MamaStatus status) = 0;
136 };
137 
143 class MAMACPPExpDLL MamaEntitlementCallback
144 {
145 public:
159  virtual void
160  onSessionDisconnect (const sessionDisconnectReason reason,
161  const char* userId,
162  const char* host,
163  const char* appName) = 0;
164 
168  virtual void
169  onEntitlementUpdate () = 0;
170 
175  virtual void
176  onEntitlementCheckingSwitch (const int isEntitlementsCheckingDisabled) {};
177 };
178 
183 class MAMACPPExpDLL Mama
184 {
185 public:
186 
195  static mamaBridge loadBridge (const char* middleware);
196 
197 
207  static mamaBridge loadBridge (const char* middleware, const char* path);
208 
218  static mamaPayloadBridge loadPayloadBridge (const char* payload);
219 
227  static mamaBridge getMiddlewareBridge (const char* middleware);
228 
236  static mamaPayloadBridge getPayloadBridge (const char* payload);
237 
242  static const char* getVersion (mamaBridge bridgeImpl);
243 
254  static void open ();
255 
270  static unsigned int openCount ();
271 
304  static unsigned int openCount (const char* path,
305  const char* filename);
306 
335  static void open (const char* path,
336  const char* filename);
337 
345  static void registerEntitlementCallbacks (MamaEntitlementCallback* callback);
346 
363  static void setProperty (const char* name, const char* value);
364 
374  static const char * getProperty (const char* name);
375 
386  static void close ();
387 
398  static unsigned int closeCount ();
399 
416  static void start (mamaBridge bridgeImpl);
417 
425  static void startBackground (mamaBridge bridgeImpl,
426  MamaStartCallback* callback);
427 
440  static void stop (mamaBridge bridgeImpl);
441 
442 
446  static void stopAll (void);
447 
454  static void enableLogging (
455  MamaLogLevel level,
456  FILE* logFile);
457 
465  static void logToFile (
466  const char* file,
467  MamaLogLevel level);
468 
472  static void disableLogging (void);
473 
478  static void setLogLevel (MamaLogLevel level);
479 
484  static MamaLogLevel getLogLevel (void);
485 
491  static void setLogSize (unsigned long size);
492 
498  static void setNumLogFiles(int numFiles);
499 
511  static void setLogFilePolicy(mamaLogFilePolicy policy);
512 
519  static void setAppendToLogFile(bool append);
520 
526  static bool loggingToFile(void);
527 
533  static void setLogSizeCb(MamaLogFileCallback* callback);
534 
541  static void setApplicationName (const char* applicationName);
542 
549  static void setApplicationClassName (const char* className);
550 
557  static MamaQueue* getDefaultEventQueue (mamaBridge bridgeImpl);
558 
574  template <typename T>
575  static void deleteObject (T* object);
576 
582  static void setBridgeCallback (mamaBridge bridge, MamaBridgeCallback* callback);
583 
588  static void addStatsCollector (MamaStatsCollector* statsCollector);
589 
594  static void removeStatsCollector (MamaStatsCollector* statsCollector);
595 
596 
597 private:
601  Mama (void) {}
602 
606  static std::vector<MamaQueue*> mDefaultQueueWrappers;
607 };
608 
609 } /* namespace Wombat */
610 #endif // MAMA_CPP_H__
Callback object passed to Mama::startBackground().
Definition: mamacpp.h:131
virtual void onEntitlementCheckingSwitch(const int isEntitlementsCheckingDisabled)
Function invoked after entitlements checking has been switched, for example, from enabled to disabled...
Definition: mamacpp.h:176
Subclass this to receive log notifications.
Definition: mamacpp.h:118
Definition: MamaConnection.h:29
The Mama class provides methods global initialization and manipulating global options.
Definition: mamacpp.h:183
virtual ~MamaEntitlementCallback()
Definition: mamacpp.h:146
Bridge callback.
Definition: MamaBridgeCallback.h:33
Callback object passed to Mama::registerEntitlmentCallbacks().
Definition: mamacpp.h:143
virtual ~MamaLogFileCallback()
Definition: mamacpp.h:121
Queue allows applications to dispatch events in order with multiple threads using a single MamaDispat...
Definition: MamaQueue.h:40
Definition: MamaStatsCollector.h:32
Definition: MamaStatus.h:30
virtual ~MamaStartCallback()
Definition: mamacpp.h:134