Thread portable class


Gate portable class


Timer class


Pool class


Terimber 2.0


About C++


Downloads Products & Services Support Clients Open Source About



Home / Open source / Terimber 2.0

msg_queue< P, C > Class Template Reference

priority message queue More...

#include <msg_que.h>

List of all members.

Public Member Functions

bool block ()
 blocks queue
bool is_block ()
 checks the blocking state

Protected Member Functions

 msg_queue ()
 constructor
bool pop (msg_cpp *&item)
 removes message from queue
bool peek ()
 checks if there is a message in a queue
bool touch (size_t &top_priority)
 checks the top priority message in a queue
virtual void wakeup ()=0
 we don't know how to wake up yet
void push (msg_cpp *item)
 pushes incoming message to the queue
bool unblock ()
 unblocks queue

Private Types

enum  en_msg_queue { PRIORITY = P, CAPACITY = C }

Static Private Member Functions

static ub1_t _check (msg_cpp *item)
 returns the priority within the range

Private Attributes

bool _blocked
 block flag
mutex _mtx_queue
 mutex
list< msg_cpp * > _queue [PRIORITY]
 priority queues


Detailed Description

template<size_t P = 3, size_t C = 1024>
class msg_queue< P, C >

priority message queue

Definition at line 43 of file msg_que.h.


Member Enumeration Documentation

template<size_t P = 3, size_t C = 1024>
enum msg_queue::en_msg_queue [private]

Enumerator:
PRIORITY  priority levels
CAPACITY  max capacity

Definition at line 46 of file msg_que.h.


Constructor & Destructor Documentation

template<size_t P, size_t C>
msg_queue< P, C >::msg_queue (  )  [inline, protected]

constructor

Definition at line 105 of file msg_que.h.


Member Function Documentation

template<size_t P, size_t C>
bool msg_queue< P, C >::block (  )  [inline]

blocks queue

Definition at line 197 of file msg_que.h.

References msg_queue< P, C >::_blocked, and msg_queue< P, C >::_mtx_queue.

Referenced by msg_communicator::shutdown_connection().

template<size_t P, size_t C>
bool msg_queue< P, C >::is_block (  )  [inline]

checks the blocking state

Definition at line 217 of file msg_que.h.

References msg_queue< P, C >::_blocked, and msg_queue< P, C >::_mtx_queue.

Referenced by ServerPostBlock().

template<size_t P, size_t C>
bool msg_queue< P, C >::pop ( msg_cpp *&  item  )  [inline, protected]

removes message from queue

Parameters:
item  [out] pointer to message

Definition at line 140 of file msg_que.h.

References msg_queue< P, C >::_mtx_queue, msg_queue< P, C >::_queue, base_list< T >::front(), list< T >::pop_front(), and msg_queue< P, C >::PRIORITY.

template<size_t P, size_t C>
bool msg_queue< P, C >::peek (  )  [inline, protected]

checks if there is a message in a queue

Definition at line 162 of file msg_que.h.

References msg_queue< P, C >::_mtx_queue, msg_queue< P, C >::_queue, and msg_queue< P, C >::PRIORITY.

template<size_t P, size_t C>
bool msg_queue< P, C >::touch ( size_t &  top_priority  )  [inline, protected]

checks the top priority message in a queue

Parameters:
top_priority  [out] the top priority message in a queue

Definition at line 178 of file msg_que.h.

References msg_queue< P, C >::_mtx_queue, msg_queue< P, C >::_queue, and msg_queue< P, C >::PRIORITY.

template<size_t P = 3, size_t C = 1024>
virtual void msg_queue< P, C >::wakeup (  )  [protected, pure virtual]

we don't know how to wake up yet

Implemented in msg_communicator, msg_connection, and msg_user_connection.

Referenced by msg_queue< P, C >::push().

template<size_t P, size_t C>
void msg_queue< P, C >::push ( msg_cpp item  )  [inline, protected]

template<size_t P, size_t C>
bool msg_queue< P, C >::unblock (  )  [inline, protected]

unblocks queue

Definition at line 207 of file msg_que.h.

References msg_queue< P, C >::_blocked, and msg_queue< P, C >::_mtx_queue.

template<size_t P, size_t C>
ub1_t msg_queue< P, C >::_check ( msg_cpp item  )  [inline, static, private]

returns the priority within the range

Parameters:
item  pointer to message

Definition at line 113 of file msg_que.h.

References msg_queue< P, C >::PRIORITY, and msg_t::priority.

Referenced by msg_queue< P, C >::push().


Member Data Documentation

template<size_t P = 3, size_t C = 1024>
bool msg_queue< P, C >::_blocked [private]

template<size_t P = 3, size_t C = 1024>
list< msg_cpp* > msg_queue< P, C >::_queue[PRIORITY] [private]


The documentation for this class was generated from the following file:


© Copyright Terimber 2003-.