OpenMAMA C++ API
MamaSource.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_SOURCE_CPP_H__
23 #define MAMA_SOURCE_CPP_H__
24 
25 #include <mama/source.h>
26 #include <mama/MamaSourceManager.h>
27 
28 static const int MAX_SOURCE_STR_LEN = 32;
29 
30 
31 namespace Wombat
32 {
33  class MamaSubscription;
34  class MamaTransport;
35 
37  {
38  public:
39  virtual void onSubscription (MamaSource* source,
40  MamaSubscription* subscription,
41  void* closure)
42  {
43  return;
44  }
45 
47  {};
48  };
49 
55  class MAMACPPExpDLL MamaSource : public MamaSourceManager
56  {
57  public:
58  MamaSource ();
59 
60  MamaSource (const char* id,
61  const char* transportName,
62  const char* subscSourceName,
63  mamaBridge bridge,
64  bool createTransport = true);
65 
66  MamaSource (const char* id,
67  MamaTransport* transport,
68  const char* subscSourceName);
69 
70  virtual ~MamaSource ();
71 
72  void setId (const char* id);
73  void setMappedId (const char* id);
74  void setDisplayId (const char* id);
75  void setQuality (mamaQuality quality);
76  void setState (mamaSourceState state);
77  void setParent (MamaSource* parent);
78  void setTransport (MamaTransport* transport);
79  void setTransportName (const char* transportName);
80  void setPublisherSourceName (const char* sourceName);
81 
82  virtual const char* getId () const;
83  virtual const char* getMappedId () const;
84  virtual const char* getDisplayId () const;
85  virtual mamaQuality getQuality () const;
86  virtual mamaSourceState getState () const;
87  virtual MamaSource* getParent ();
88  virtual const MamaSource* getParent () const;
89  virtual MamaTransport* getTransport () const;
90  virtual const char* getTransportName () const;
91  virtual const char* getPublisherSourceName () const;
92 
93  // Access to C types for implementation of related classes.
94  mamaSource getCValue ();
95  const mamaSource getCValue () const;
96 
102  bool isPartOf (const MamaSource* source) const;
103  // Association of subscriptions with the MamaSource.
104 
108  void addSubscription (const char* symbol,
109  MamaSubscription* sub);
110 
114  MamaSubscription* findSubscription (const char* symbol);
115 
121  MamaSubscription* removeSubscription (const char* symbol);
122 
126  void deactivateSubscriptions ();
130  void activateSubscriptions ();
131 
136  void forEachSubscription (MamaSubscriptionIteratorCallback* callback,
137  void* closure);
138 
139  private:
140  mamaSource mySource;
141  MamaSource* myParent;
142  void* mySubs;
143  MamaTransport* myTransport;
144  mamaBridge myBridge;
145  MamaSubscriptionIteratorCallback* mySubscriptionIteratorCallback;
146  void* mySubscriptionIteratorClosure;
147 
148  // No copy contructor nor assignment operator.
149  MamaSource (const MamaSource& rhs);
150  MamaSource& operator= (const MamaSource& rhs);
151  };
152 
153 } // namespace Wombat
154 
155 
156 #endif // MAMA_SOURCE_CPP_H__
A MAMA source manager maintains information about a set of data sources, including the quality of the...
Definition: MamaSourceManager.h:38
A MAMA source maintains information about a data source, including the quality of the data coming fro...
Definition: MamaSource.h:55
virtual void onSubscription(MamaSource *source, MamaSubscription *subscription, void *closure)
Definition: MamaSource.h:39
Definition: MamaConnection.h:29
Definition: MamaSource.h:36
The MamaTransport class provides market data functionality.
Definition: MamaTransport.h:261
virtual ~MamaSubscriptionIteratorCallback()
Definition: MamaSource.h:46
The MamaSubscription interface represents a subscription to a topic.
Definition: MamaSubscription.h:43