24 #ifndef __INTERFACE_MESSAGE_QUEUE_H_
25 #define __INTERFACE_MESSAGE_QUEUE_H_
27 #include <core/exception.h>
28 #include <core/exceptions/software.h>
76 unsigned int id()
const;
78 template <
class MessageType>
81 template <
class MessageType>
82 MessageType *
get()
const;
90 void remove(
const Message *msg);
91 void remove(
const unsigned int msg_id);
94 unsigned int size()
const;
110 void remove(msg_list_t *l, msg_list_t *p);
113 msg_list_t *__end_el;
123 template <
class MessageType>
127 MessageType *msg =
dynamic_cast<MessageType *
>(cur->msg);
138 template <
class MessageType>
142 MessageType *msg =
dynamic_cast<MessageType *
>(cur->msg);
Base class for all messages passed through interfaces in Fawkes BlackBoard.
void insert_after(const MessageIterator &it, Message *msg)
Enqueue message after given iterator.
Message * operator->() const
Act on current message.
bool operator==(const MessageIterator &c) const
Check equality of two iterators.
unsigned int id() const
Get ID of current element or 0 if element is end.
Message already enqueued exception.
MessageIterator & operator+=(unsigned int i)
Advance by a certain amount.
MessageIterator end()
Get iterator to element beyond end of message queue list.
Fawkes library namespace.
MessageQueue()
Constructor.
MessageType * get() const
Get current message of given type.
MessageAlreadyQueuedException()
Constructor.
MessageIterator()
Constructor.
MessageIterator & operator+(unsigned int i)
Advance by a certain amount.
MessageIterator & operator++()
Increment iterator.
Base class for exceptions in Fawkes.
virtual ~MessageQueue()
Destructor.
void flush()
Delete all messages from queue.
bool operator!=(const MessageIterator &c) const
Check inequality of two iterators.
Message queue used in interfaces.
bool try_lock()
Try to lock message queue.
bool is() const
Check if message is of given type.
Message * operator*() const
Get memory pointer of chunk.
MessageIterator begin()
Get iterator to first element in message queue.
bool empty() const
Check if message queue is empty.
void append(Message *msg)
Append message to queue.
void pop()
Erase first message from queue.
void unlock()
Unlock message queue.
Message * first()
Get first message from queue.
Mutex mutual exclusion lock.
unsigned int size() const
Get number of messages in queue.
void lock()
Lock message queue.
MessageIterator & operator=(const MessageIterator &c)
Assign iterator.