Atlas-C++
QueuedDecoder.h
1 // This file may be redistributed and modified only under the terms of
2 // the GNU Lesser General Public License (See COPYING for details).
3 // Copyright (C) 2000 Stefanus Du Toit
4 
5 // $Id$
6 
7 #ifndef ATLAS_MESSAGE_QUEUEDDECODER_H
8 #define ATLAS_MESSAGE_QUEUEDDECODER_H
9 
10 #include <Atlas/Message/DecoderBase.h>
11 #include <Atlas/Message/Element.h>
12 
13 #include <queue>
14 
15 namespace Atlas { namespace Message {
16 
17 class Element;
18 
19 typedef std::map<std::string, Element> MapType;
20 
34 class QueuedDecoder : public DecoderBase
35 {
36 public:
37 
38  QueuedDecoder();
39 
41  size_t queueSize() {
42  return m_objectQueue.size();
43  }
45  const MapType popMessage() {
46  MapType r = m_objectQueue.front();
47  m_objectQueue.pop();
48  return r;
49  }
51  const MapType frontMessage() {
52  return m_objectQueue.front();
53  }
55  void clearQueue();
56 
57 protected:
58 
60  void messageArrived(const MapType& obj);
61 
62 private:
63 
64  std::queue<MapType> m_objectQueue;
65 };
66 
67 } } // namespace Atlas::Message
68 
69 #endif
const MapType frontMessage()
Peek at the object at the front of the queue.
Definition: QueuedDecoder.h:51
const MapType popMessage()
Pop an object from the front of the message queue.
Definition: QueuedDecoder.h:45
The Atlas namespace.
Definition: Bridge.h:20
void clearQueue()
Clear the message queue.
void messageArrived(const MapType &obj)
This adds a message to the queue.
Decoder that presents a queue of Atlas::Message::Element.
Definition: QueuedDecoder.h:34
size_t queueSize()
Retrieve the current size of the message queue.
Definition: QueuedDecoder.h:41
Base class for decoders that take Atlas::Message::Object.
Definition: DecoderBase.h:40

Copyright 2000-2004 the respective authors.

This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.