OpenMAMA
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
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>
40 #include <mama/MamaInboxCallback.h>
41 #include <mama/MamaInbox.h>
42 #include <mama/MamaQueue.h>
46 #include <mama/MamaDispatcher.h>
47 #include <mama/MamaTimerCallback.h>
48 #include <mama/MamaTimer.h>
49 #include <mama/MamaIoCallback.h>
50 #include <mama/MamaIo.h>
52 #include <mama/MamaDictionary.h>
54 #include <mama/MamaDateTime.h>
55 #include <mama/MamaPrice.h>
57 #include <mama/MamaMsgField.h>
58 #include <mama/MamaStatus.h>
59 #include <mama/MamaSymbolMap.h>
60 #include <mama/MamaSymbolMapFile.h>
61 #include <mama/MamaLogFile.h>
63 #include <mama/MamaSymbolSource.h>
64 #include <mama/MamaMsgQual.h>
65 #include <mama/msgstatus.h>
66 #include <mama/types.h>
68 #include <mama/MamaSource.h>
69 #include <mama/MamaSourceManager.h>
70 #include <mama/MamaSourceGroup.h>
73 
74 
75 namespace Wombat
76 {
117 class MAMACPPExpDLL MamaLogFileCallback
118 {
119 public:
120  virtual ~MamaLogFileCallback () {}
121  virtual void onLogSizeExceeded () = 0;
122 };
123 
130 class MAMACPPExpDLL MamaStartCallback
131 {
132 public:
133  virtual ~MamaStartCallback () {};
134  virtual void onStartComplete (MamaStatus status) = 0;
135 };
136 
137 #ifdef WITH_ENTITLEMENTS
138 
143 class MAMACPPExpDLL MamaEntitlementCallback
144 {
145 public:
146  virtual ~MamaEntitlementCallback () {};
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 #endif /*WITH_ENTITLEMENTS*/
179 
184 class MAMACPPExpDLL Mama
185 {
186 public:
187 
197  static mamaBridge loadBridge (const char* middleware);
198 
199 
210  static mamaBridge loadBridge (const char* middleware, const char* path);
215  static const char* getVersion (mamaBridge bridgeImpl);
216 
232  static void open ();
233 
256  static void open (const char* path,
257  const char* filename);
258 
259 #ifdef WITH_ENTITLEMENTS
260 
267  static void registerEntitlementCallbacks (MamaEntitlementCallback* callback);
268 #endif /*WITH_ENTITLEMENTS*/
269 
286  static void setProperty (const char* name, const char* value);
287 
297  static const char * getProperty (const char* name);
298 
309  static void close ();
310 
327  static void start (mamaBridge bridgeImpl);
328 
336  static void startBackground (mamaBridge bridgeImpl,
337  MamaStartCallback* callback);
338 
351  static void stop (mamaBridge bridgeImpl);
352 
353 
357  static void stopAll (void);
358 
365  static void enableLogging (
366  MamaLogLevel level,
367  FILE* logFile);
368 
376  static void logToFile (
377  const char* file,
378  MamaLogLevel level);
379 
383  static void disableLogging (void);
384 
389  static void setLogLevel (MamaLogLevel level);
390 
395  static MamaLogLevel getLogLevel (void);
396 
402  static void setLogSize (unsigned long size);
403 
409  static void setNumLogFiles(int numFiles);
410 
422  static void setLogFilePolicy(mamaLogFilePolicy policy);
423 
430  static void setAppendToLogFile(bool append);
431 
437  static bool loggingToFile(void);
438 
444  static void setLogSizeCb(MamaLogFileCallback* callback);
445 
452  static void setApplicationName (const char* applicationName);
453 
460  static void setApplicationClassName (const char* className);
461 
468  static MamaQueue* getDefaultEventQueue (mamaBridge bridgeImpl);
469 
485  template <typename T>
486  static void deleteObject (T* object);
487 
493  static void setBridgeCallback (mamaBridge bridge, MamaBridgeCallback* callback);
494 
499  static void addStatsCollector (MamaStatsCollector* statsCollector);
500 
505  static void removeStatsCollector (MamaStatsCollector* statsCollector);
506 
507 
508 private:
512  Mama (void) {}
513 };
514 
515 } /* namespace Wombat */
516 #endif // MAMA_CPP_H__


© 2012 Linux Foundation