OpenMAMA C++ API
MamaFieldCache.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_FIELD_CACHE_CPP_H__
23 #define MAMA_FIELD_CACHE_CPP_H__
24 
25 #include <mama/mamacpp.h>
27 #include <mama/fieldcache/fieldcache.h>
28 
29 namespace Wombat
30 {
31  class MamaMsg;
32  class MamaDictionary;
33  class MamaFieldCacheRecord;
34 
41 class MAMACPPExpDLL MamaFieldCache
42 {
43 public:
50  class MAMACPPExpDLL MamaFieldCacheIterator
51  {
52  protected:
53  MamaFieldCacheIterator(mamaFieldCache fieldCache);
54  public:
57 
58  MamaFieldCacheIterator& operator=(const MamaFieldCacheIterator& rhs);
59 
60  bool operator==(const MamaFieldCacheIterator& rhs) const;
61  bool operator!=(const MamaFieldCacheIterator& rhs) const;
62 
63  MamaFieldCacheIterator& operator++();
64 
65  protected:
66  mamaFieldCacheIterator mIterator;
68 
69  private:
70  friend class MamaFieldCache;
71  };
72 
77  class MAMACPPExpDLL iterator : public MamaFieldCacheIterator
78  {
79  protected:
80  iterator(mamaFieldCache fieldCache);
81 
82  public:
83  typedef std::input_iterator_tag iterator_category;
85  typedef std::iterator_traits<MamaFieldCacheField> difference_type;
88 
89  reference operator*();
90  pointer operator->();
91 
92  private:
93  friend class MamaFieldCache;
94  };
99  class MAMACPPExpDLL const_iterator : public MamaFieldCacheIterator
100  {
101  protected:
102  const_iterator(mamaFieldCache fieldCache);
103 
104  public:
105  const_iterator(const iterator& it);
106 
107  typedef std::input_iterator_tag iterator_category;
109  typedef std::iterator_traits<MamaFieldCacheField> difference_type;
110  typedef const MamaFieldCacheField* pointer;
112 
113  reference operator*();
114  pointer operator->();
115 
116  private:
117  friend class MamaFieldCache;
118  };
119 
120 public:
125  MamaFieldCache();
126 
132  virtual ~MamaFieldCache();
133 
137  virtual void create();
138 
144  virtual void clear();
145 
151  virtual mama_size_t getSize() const;
152 
161  virtual void setTrackModified(bool value);
162 
168  virtual bool getTrackModified() const;
169 
176  virtual void setUseFieldNames(bool value);
177 
183  virtual bool getUseFieldNames() const;
184 
190  virtual void setUseLock(bool value);
191 
197  virtual bool getUseLock() const;
198 
202  virtual void lock();
203 
207  virtual void unlock();
208 
217  virtual const MamaFieldCacheField* find(mama_fid_t fid,
218  const char* name = NULL) const;
219 
228  virtual MamaFieldCacheField* find(mama_fid_t fid,
229  const char* name = NULL);
230 
235  virtual void setModified(MamaFieldCacheField& field);
236 
244  virtual void apply(const MamaFieldCacheField& field);
245 
254  virtual void apply(const MamaMsg& msg, const MamaDictionary* dict = NULL);
255 
262  virtual void apply(const MamaFieldCacheRecord& record);
263 
269  virtual void getFullMessage(MamaMsg& msg);
270 
279  virtual void getDeltaMessage(MamaMsg& msg);
280 
285  virtual void clearModifiedFields();
286 
293  virtual const_iterator begin() const;
294 
301  virtual iterator begin();
302 
310  virtual const_iterator end() const;
311 
319  virtual iterator end();
320 
321 private:
323  MamaFieldCache& operator=(const MamaFieldCache&);
324 
325 private:
326  struct MamaFieldCacheImpl;
327  MamaFieldCacheImpl* mPimpl;
328 };
329 
330 } // namespace Wombat
331 
332 #endif // MAMA_FIELD_CACHE_CPP_H__
The MamaDictionary class maps field identifiers (FIDs) to human readable strings. ...
Definition: MamaDictionary.h:41
Iterator type used to iterate over the fields contained in the cache.
Definition: MamaFieldCache.h:77
const MamaFieldCacheField & reference
Definition: MamaFieldCache.h:111
mamaFieldCacheIterator mIterator
Definition: MamaFieldCache.h:66
MamaFieldCacheField mField
Definition: MamaFieldCache.h:67
std::iterator_traits< MamaFieldCacheField > difference_type
Definition: MamaFieldCache.h:109
MAMA message representation.
Definition: MamaMsg.h:112
const MamaFieldCacheField * pointer
Definition: MamaFieldCache.h:110
MamaFieldCacheField * pointer
Definition: MamaFieldCache.h:86
std::iterator_traits< MamaFieldCacheField > difference_type
Definition: MamaFieldCache.h:85
Definition: MamaConnection.h:29
MamaFieldCacheField value_type
Definition: MamaFieldCache.h:108
Iterator type used to iterate over the fields contained in the cache.
Definition: MamaFieldCache.h:99
std::input_iterator_tag iterator_category
Definition: MamaFieldCache.h:107
The MamaFieldCacheRecord class is a collection of unordered MamaFieldCacheField elements.
Definition: MamaFieldCacheRecord.h:38
std::input_iterator_tag iterator_category
Definition: MamaFieldCache.h:83
MamaFieldCacheField & reference
Definition: MamaFieldCache.h:87
The MamaFieldCache class is a collection of unordered MamaFieldCacheField elements.
Definition: MamaFieldCache.h:41
MamaFieldCacheField value_type
Definition: MamaFieldCache.h:84
The MamaFieldCacheIterator class provides a way to iterate over the fields contained in the cache...
Definition: MamaFieldCache.h:50
The MamaFieldCacheField class is used to store the information on the type of a field and its value(s...
Definition: MamaFieldCacheField.h:41