OpenMAMA
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  protected:
90  friend class MamaSourceGroup;
91  struct iteratorImpl;
92  iteratorImpl& mImpl;
93 
94  public:
95  iterator ();
96  iterator (const iterator& copy);
97  iterator (const iteratorImpl& copy);
98  ~iterator ();
99 
100  iterator& operator= (const iterator& rhs);
101  const iterator& operator= (const iterator& rhs) const;
102  iterator& operator++ ();
103  const iterator& operator++ () const;
104  bool operator== (const iterator& rhs) const;
105  bool operator!= (const iterator& rhs) const;
106  MamaSource* operator* ();
107  const MamaSource* operator* () const;
108  };
109 
110  typedef const iterator const_iterator;
111 
112  iterator begin ();
113  const_iterator begin () const;
114  iterator end ();
115  const_iterator end () const;
116 
117  private:
118  struct MamaSourceGroupImpl;
119  MamaSourceGroupImpl& myImpl;
120 
121  // No copy contructor nor assignment operator.
122  MamaSourceGroup (const MamaSourceGroup& rhs);
123  MamaSourceGroup& operator= (const MamaSourceGroup& rhs);
124  };
125 
126 } // namespace Wombat
127 
128 
129 #endif // MamaSourceGroup_CPP_H__
Wombat::MamaSourceGroup
A MAMA source group monitors a set of MAMA sources that presumably provide a duplicate set of data.
Definition: MamaSourceGroup.h:42
Wombat::MamaSourceStateChangeCallback
Applications can register with MamaSourceGroup to receive state change notifications when the state o...
Definition: MamaSourceStateChangeCallback.h:39
MamaSourceStateChangeCallback.h
Wombat::MamaSourceGroup::iterator::mImpl
iteratorImpl & mImpl
Definition: MamaSourceGroup.h:91
Wombat::MamaSource
A MAMA source maintains information about a data source, including the quality of the data coming fro...
Definition: MamaSource.h:55
Wombat
Definition: MamaBasicSubscription.h:27
Wombat::MamaSourceGroup::iterator
Definition: MamaSourceGroup.h:87
Wombat::MamaSourceGroup::const_iterator
const typedef iterator const_iterator
Definition: MamaSourceGroup.h:110


© 2012 Linux Foundation