OpenMAMA
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
MamaSourceManager.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 MamaSourceManager_CPP_H__
23 #define MamaSourceManager_CPP_H__
24 
25 #include <mama/sourceman.h>
26 #include <mama/types.h>
27 
28 namespace Wombat
29 {
30 
31  class MamaSource;
32 
38  class MAMACPPExpDLL MamaSourceManager
39  {
40  public:
42  virtual ~MamaSourceManager ();
43 
44  virtual MamaSource* create (const char* sourceName);
45  virtual MamaSource* findOrCreate (const char* sourceName);
46  virtual MamaSource* find (const char* sourceName);
47  virtual const MamaSource* find (const char* sourceName) const;
48  virtual void add (MamaSource* source);
49  virtual void add (const char* sourceName,
50  MamaSource* source);
51  mama_size_t size () const;
52 
53 
54  class MAMACPPExpDLL iterator
55  {
56  protected:
57  friend class MamaSourceManager;
58  struct iteratorImpl;
59  iteratorImpl& mImpl;
60 
61  public:
62  iterator ();
63  iterator (const iterator& copy);
64  iterator (const iteratorImpl& copy);
65  ~iterator ();
66 
67  iterator& operator= (const iterator& rhs);
68  const iterator& operator= (const iterator& rhs) const;
69  iterator& operator++ ();
70  const iterator& operator++ () const;
71  bool operator== (const iterator& rhs) const;
72  bool operator!= (const iterator& rhs) const;
73  MamaSource* operator* ();
74  const MamaSource* operator* () const;
75  };
76 
77  typedef const iterator const_iterator;
78 
79  iterator begin ();
80  const_iterator begin () const;
81  iterator end ();
82  const_iterator end () const;
83 
84  mamaSourceManager getCValue ()
85  {
86  return myManager;
87  }
88 
89  const mamaSourceManager getCValue () const
90  {
91  return myManager;
92  }
93 
94  private:
95  struct MamaSourceManagerImpl;
96  MamaSourceManagerImpl& myImpl;
97  mamaSourceManager myManager;
98 
99  // No copy constructor nor assignment operator.
101  MamaSourceManager& operator= (const MamaSourceManager& rhs);
102  };
103 
104 } // namespace Wombat
105 
106 #endif // MamaSourceManager_CPP_H__


© 2012 Linux Foundation