Atlas
0.7.0
Networking protocol for the Worldforge system.
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
() =
default
;
39
41
size_t
queueSize
() {
42
return
m_objectQueue.size();
43
}
45
MapType
popMessage
() {
46
MapType r = std::move(m_objectQueue.front());
47
m_objectQueue.pop();
48
return
r;
49
}
51
const
MapType&
frontMessage
() {
52
return
m_objectQueue.front();
53
}
54
55
protected
:
56
58
void
messageArrived
(MapType obj)
override
;
59
60
private
:
61
62
std::queue<MapType> m_objectQueue;
63
};
64
65
} }
// namespace Atlas::Message
66
67
#endif
Atlas::Message::QueuedDecoder::popMessage
MapType popMessage()
Pop an object from the front of the message queue.
Definition:
QueuedDecoder.h:45
Atlas::Message::QueuedDecoder::messageArrived
void messageArrived(MapType obj) override
This adds a message to the queue.
Definition:
QueuedDecoder.cpp:11
Atlas::Message::QueuedDecoder::queueSize
size_t queueSize()
Retrieve the current size of the message queue.
Definition:
QueuedDecoder.h:41
Atlas::Message::QueuedDecoder::frontMessage
const MapType & frontMessage()
Peek at the object at the front of the queue.
Definition:
QueuedDecoder.h:51
Atlas::Message::QueuedDecoder
Definition:
QueuedDecoder.h:35
Atlas::Message::DecoderBase
Definition:
DecoderBase.h:41
Atlas
Definition:
Bridge.h:20
src
Atlas
Message
QueuedDecoder.h
Generated by
1.8.18