OpenMAMA C++ API
MamaTransport.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_TRANSPORT_CPP_H__
23 #define MAMA_TRANSPORT_CPP_H__
24 
25 #include "mama/mama.h"
26 
27 namespace Wombat
28 {
29 
30  class MamaSymbolMap;
31  class MamaTransport;
32  class MamaConnection;
33  class MamaServerConnection;
34  class MamaQueue;
35 
40  class MAMACPPExpDLL MamaTransportTopicEventCallback
41  {
42  public:
44  {
45  };
50  virtual void onTopicSubscribe (MamaTransport* transport,
51  const char* topic,
52  const void* platformInfo)
53  {
54  return;
55  }
56 
57  virtual void onTopicUnsubscribe (MamaTransport* transport,
58  const char* topic,
59  const void* platformInfo)
60  {
61  return;
62  }
63 
64  virtual void onTopicPublishError (MamaTransport* transport,
65  const char* topic,
66  const void* platformInfo)
67  {
68  return;
69  }
70 
72  const char* topic,
73  const void* platformInfo)
74  {
75  return;
76  }
77 
78  virtual void onTopicPublishErrorBadSymbol (MamaTransport* transport,
79  const char* topic,
80  const void* platformInfo)
81  {
82  return;
83  }
84 
85  };
86 
90  class MAMACPPExpDLL MamaTransportCallback
91  {
92  public:
94  {
95  };
96 
110  virtual void onDisconnect (
111  MamaTransport* transport,
112  const void* platformInfo)
113  {
114  return;
115  }
116 
130  virtual void onReconnect (
131  MamaTransport* transport,
132  const void* platformInfo)
133  {
134  return;
135  }
136 
150  virtual void onQuality (
151  MamaTransport* transport,
152  short cause,
153  const void* platformInfo) = 0;
154 
167  virtual void onConnect (
168  MamaTransport* transport,
169  const void* platformInfo)
170  {
171  return;
172  }
173 
186  virtual void onAccept (
187  MamaTransport* transport,
188  const void* platformInfo)
189  {
190  return;
191  }
192 
205  virtual void onAcceptReconnect (
206  MamaTransport* transport,
207  const void* platformInfo)
208  {
209  return;
210  }
211 
224  virtual void onPublisherDisconnect (
225  MamaTransport* transport,
226  const void* platformInfo)
227  {
228  return;
229  }
230 
237  virtual void onNamingServiceConnect (
238  MamaTransport* transport,
239  const void* platformInfo)
240  {
241  return;
242  }
243 
251  MamaTransport* transport,
252  const void* platformInfo)
253  {
254  return;
255  }
256  };
257 
261  class MAMACPPExpDLL MamaTransport
262  {
263  public:
267  MamaTransport ();
268  virtual ~MamaTransport ();
269 
280  MamaTransport (
281  mamaTransport cTransport);
282 
291  void create (
292  const char* name,
293  mamaBridge bridgeImpl);
294 
301  void setName (
302  const char* name);
303 
307  const char* getName () const;
308 
312  const char* getMiddleware() const;
313 
320  double getOutboundThrottle (
321  mamaThrottleInstance instance = MAMA_THROTTLE_DEFAULT) const;
322 
331  void setOutboundThrottle (
332  double outboundThrottle,
333  mamaThrottleInstance instance = MAMA_THROTTLE_DEFAULT);
334 
338  void setTransportTopicCallback (MamaTransportTopicEventCallback* callback);
339 
343  void getTransportCallbackQueue(MamaQueue* queue);
344 
348  MamaQueue* getTransportCallbackQueue();
349 
353  void setTransportCallback (
354  MamaTransportCallback* callback);
355 
361  void setSymbolMap (
362  const MamaSymbolMap* mapper);
363 
367  const MamaSymbolMap* getSymbolMap () const;
368 
375  void setDescription (
376  const char* description);
377 
385  const char* getDescription () const;
386 
387  /*
388  * Find a connection for the specified IP address and port. If the port is 0
389  * the first connection for the specified IP address is returned.
390  *
391  * The caller must delete() the returned value.
392  */
393  MamaConnection* findConnection (
394  const char* IpAddress,
395  uint16_t port);
396 
397  /*
398  * Return a list of all connections.
399  *
400  * Note. The results (list and len) must be passed to freeAllConnections
401  * to free the resources allocated by this call.
402  */
403  virtual void getAllConnections (
404  MamaConnection**& list,
405  uint32_t& len);
406 
407  /*
408  * Free array returned by getAllConnections
409  */
410  virtual void freeAllConnections (
411  MamaConnection** list,
412  uint32_t len);
413 
414  /*
415  * Return a list of all server connections.
416  *
417  * Note. The results (list and len) must be passed to
418  * freeAllServerConnections to free the resources allocated by this call.
419  */
420  virtual void getAllServerConnections (
421  MamaServerConnection**& list,
422  uint32_t& len);
423 
424  /*
425  * Free array returned by getAllServerConnections.
426  */
427  virtual void freeAllServerConnections (
428  MamaServerConnection** list,
429  uint32_t& len);
430 
446  void setInvokeQualityForAllSubscs (
447  bool invokeQualityForAllSubscs);
448 
456  bool getInvokeQualityForAllSubscs () const;
457 
466  mamaQuality getQuality () const;
467 
473  void requestConflation () const;
474 
480  void requestEndConflation () const;
481 
485  MamaQueue* getTransportCallbackQueue() const;
486 
490  void setTransportCallbackQueue(MamaQueue* queue);
491 
492  // Access to C types for implementation of related classes.
493  mamaTransport getCValue ();
494  const mamaTransport getCValue () const;
495 
505  void* getNativeTransport (
506  int index);
507 
511  void disableRefresh (
512  bool disable);
513 
514  struct MamaTransportImpl;
515  MamaTransportImpl* mPimpl;
516 
517  private:
518  mamaTransport mTransport;
519  MamaQueue* mQueue; // used for transport callbacks
520  };
521 
522 } // namespace Wombat
523 
524 #endif // MAMA_TRANSPORT_CPP_H__
Definition: MamaConnection.h:32
virtual void onNamingServiceConnect(MamaTransport *transport, const void *platformInfo)
Invoked on the subscriber when the naming service connects.
Definition: MamaTransport.h:237
virtual ~MamaTransportCallback()
Definition: MamaTransport.h:93
virtual void onTopicUnsubscribe(MamaTransport *transport, const char *topic, const void *platformInfo)
Definition: MamaTransport.h:57
virtual void onConnect(MamaTransport *transport, const void *platformInfo)
Invoked on the subscriber when the transport connects.
Definition: MamaTransport.h:167
The MamaSymbolMap class provides the ability for MAMA to do client side symbology mapping...
Definition: MamaSymbolMap.h:36
MamaTransportImpl * mPimpl
Definition: MamaTransport.h:514
Definition: MamaServerConnection.h:28
virtual void onTopicPublishErrorBadSymbol(MamaTransport *transport, const char *topic, const void *platformInfo)
Definition: MamaTransport.h:78
virtual void onTopicPublishErrorNotEntitled(MamaTransport *transport, const char *topic, const void *platformInfo)
Definition: MamaTransport.h:71
Definition: MamaConnection.h:29
virtual void onAcceptReconnect(MamaTransport *transport, const void *platformInfo)
Invoked on the publisher when the transport accepts a reconnection.
Definition: MamaTransport.h:205
virtual ~MamaTransportTopicEventCallback()
Definition: MamaTransport.h:43
virtual void onNamingServiceDisconnect(MamaTransport *transport, const void *platformInfo)
Invoked on the subscriber when the naming service disconnects.
Definition: MamaTransport.h:250
virtual void onTopicPublishError(MamaTransport *transport, const char *topic, const void *platformInfo)
Definition: MamaTransport.h:64
virtual void onReconnect(MamaTransport *transport, const void *platformInfo)
Invoked when the transport reconnects.
Definition: MamaTransport.h:130
Transport callback.
Definition: MamaTransport.h:90
virtual void onAccept(MamaTransport *transport, const void *platformInfo)
Invoked on the publisher when the transport accepts a connection.
Definition: MamaTransport.h:186
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
TransportTopicEvent callback.
Definition: MamaTransport.h:40
virtual void onTopicSubscribe(MamaTransport *transport, const char *topic, const void *platformInfo)
Invoked when a topic is subscribed to.
Definition: MamaTransport.h:50
virtual void onPublisherDisconnect(MamaTransport *transport, const void *platformInfo)
Invoked on the subscriber when the transport disconnects from the publisher.
Definition: MamaTransport.h:224
virtual void onDisconnect(MamaTransport *transport, const void *platformInfo)
Invoked on a publisher when a subscriber disconnects.
Definition: MamaTransport.h:110