OpenMAMA C++ API
MamaSourceGroup.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 MamaSourceGroup_CPP_H__
23 #define MamaSourceGroup_CPP_H__
24 
25 #include <mama/types.h>
27 
28 namespace Wombat
29 {
30 
31  class MamaSource;
32  class MamaSourceStateChangeCallback;
33 
42  class MAMACPPExpDLL MamaSourceGroup
43  {
44  public:
45  MamaSourceGroup (const char* name);
46  ~MamaSourceGroup ();
47 
48  const char* getName () const;
49 
50  MamaSource* find (const char* sourceName);
51  const MamaSource* find (const char* sourceName) const;
52 
53  void add (MamaSource* source,
54  mama_u32_t weight);
55  void add (const char* sourceName,
56  mama_u32_t weight,
57  MamaSource* source);
58 
59  void setWeight (const char* sourceName,
60  mama_u32_t weight);
61  mama_u32_t getWeight (const char* sourceName) const;
62 
63  mama_size_t size () const;
64 
70  void registerStateChangeCallback (MamaSourceStateChangeCallback& cb);
71 
77  void unregisterStateChangeCallback (MamaSourceStateChangeCallback& cb);
78 
85  bool reevaluate ();
86 
87  class MAMACPPExpDLL iterator
88  {
89  private:
90  friend class MamaSourceGroup;
91  struct iteratorImpl;
92  iteratorImpl& mImpl;
93  iterator (const iteratorImpl& copy);
94  public:
95  iterator ();
96  iterator (const iterator& copy);
97  ~iterator ();
98 
99  iterator& operator= (const iterator& rhs);
100  const iterator& operator= (const iterator& rhs) const;
101  iterator& operator++ ();
102  const iterator& operator++ () const;
103  bool operator== (const iterator& rhs) const;
104  bool operator!= (const iterator& rhs) const;
105  MamaSource* operator* ();
106  const MamaSource* operator* () const;
107  };
108 
109  typedef const iterator const_iterator;
110 
111  iterator begin ();
112  const_iterator begin () const;
113  iterator end ();
114  const_iterator end () const;
115 
116  private:
117  struct MamaSourceGroupImpl;
118  MamaSourceGroupImpl& myImpl;
119 
120  // No copy contructor nor assignment operator.
121  MamaSourceGroup (const MamaSourceGroup& rhs);
122  MamaSourceGroup& operator= (const MamaSourceGroup& rhs);
123  };
124 
125 } // namespace Wombat
126 
127 
128 #endif // MamaSourceGroup_CPP_H__
const iterator const_iterator
Definition: MamaSourceGroup.h:109
Applications can register with MamaSourceGroup to receive state change notifications when the state o...
Definition: MamaSourceStateChangeCallback.h:39
A MAMA source maintains information about a data source, including the quality of the data coming fro...
Definition: MamaSource.h:55
A MAMA source group monitors a set of MAMA sources that presumably provide a duplicate set of data...
Definition: MamaSourceGroup.h:42
Definition: MamaConnection.h:29
Definition: MamaSourceGroup.h:87