12 #ifndef SHARED_BUFFER_H
13 #define SHARED_BUFFER_H
40 typedef std::list<MessageWithId>
Buffer;
112 Buffer::size_type
size();
117 Buffer::size_type
size()
const;
206 #endif // #ifndef SHARED_BUFFER_H
void lockBufferMutex()
Locks the buffer mutex.
MessageId generateNewMessageId()
Generates and returns a new message ID.
unsigned long MessageId
Message ID.
Definition: shared_buffer.h:33
Buffer _buffer
Buffer.
Definition: shared_buffer.h:199
void changeMessage(MessageId messageId, const std::string &newMessage)
Changes the selected message with a new one.
static const MessageWithId INVALID_MESSAGE
Invalid message.
Definition: shared_buffer.h:160
void unlockBufferMutex()
Locks the buffer mutex.
ThreadingError class - declarations.
MessageId _lastMessageId
Last message ID.
Definition: shared_buffer.h:201
Message buffer that can be used in separate threads.
Definition: shared_buffer.h:30
std::list< MessageWithId > Buffer
Buffer type.
Definition: shared_buffer.h:40
Buffer::size_type size()
Returns the size of the buffer.
void initializeBufferMutex()
Initializes the buffer mutex.
void addMessage(const std::string &message)
Adds the selected message to the buffer.
bool operator==(const SharedBuffer &other)
Equality comparison.
void removeMessage(MessageId messageId)
Removes the selected message from the buffer.
pthread_mutex_t _bufferMutex
Buffer mutex.
Definition: shared_buffer.h:203
SharedBuffer()
Default constructor.
bool operator!=(const SharedBuffer &other)
Non-equality comparison.
MessageWithId getMessage()
Returns the first message from the buffer.
std::pair< std::string, MessageId > MessageWithId
Message with identification.
Definition: shared_buffer.h:36
SharedBuffer & operator=(const SharedBuffer &other)
Assignment operator.
~SharedBuffer()
Destructor.
void swap(SharedBuffer &other)
Swap the contents of this object with the other object.