Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

ark::MessagePort< message_t > Class Template Reference

#include <MessagePort.h>

List of all members.

Public Member Functions

 MessagePort (unsigned int fifosz, Semaphore sem)
 MessagePort (unsigned int fifosz)
 MessagePort (MessagePort const &copy)
MessagePort & operator= (MessagePort const &copy)
 ~MessagePort ()
void setSemaphore (Semaphore sem, bool own=false)
bool waitForMessage (message_t &msg, unsigned long seconds, unsigned long nanoseconds)
bool sendMessage (message_t const &msg)
bool sendMessageAndSignal (message_t const &msg)
void signalReceiver ()
unsigned size () const
unsigned room () const
unsigned messagesWaiting () const

Private Attributes

Fifo< message_t > _msgFifo
Semaphore _semaphore
bool _semaphoreOk


Detailed Description

template<typename message_t>
class ark::MessagePort< message_t >

MessagePort Single reader, single writer thread safe message port, sending can be done from RealTime or other high priority threads safely, as it does NOT BLOCK.


Constructor & Destructor Documentation

template<typename message_t>
ark::MessagePort< message_t >::MessagePort (  unsigned int  fifosz,
Semaphore  sem
)  [inline]
 

template<typename message_t>
ark::MessagePort< message_t >::MessagePort (  unsigned int  fifosz  )  [inline]
 

template<typename message_t>
ark::MessagePort< message_t >::MessagePort (  MessagePort< message_t > const &  copy  )  [inline]
 

template<typename message_t>
ark::MessagePort< message_t >::~MessagePort (   )  [inline]
 


Member Function Documentation

template<typename message_t>
unsigned ark::MessagePort< message_t >::messagesWaiting (   )  const [inline]
 

room

Returns:
The amount of available room in the message port

template<typename message_t>
MessagePort& ark::MessagePort< message_t >::operator= (  MessagePort< message_t > const &  copy  )  [inline]
 

template<typename message_t>
unsigned ark::MessagePort< message_t >::room (   )  const [inline]
 

room

Returns:
The amount of available room in the message port

template<typename message_t>
bool ark::MessagePort< message_t >::sendMessage (  message_t const &  msg  )  [inline]
 

sendMessage msg The message to send

Returns:
True if the message was successfully sent
See also:
sendMessageAndSignal()

template<typename message_t>
bool ark::MessagePort< message_t >::sendMessageAndSignal (  message_t const &  msg  )  [inline]
 

sendMessageAndSignal msg The message to send

Returns:
True if the message was successfully sent
See also:
sendMessage()

template<typename message_t>
void ark::MessagePort< message_t >::setSemaphore (  Semaphore  sem,
bool  own = false
)  [inline]
 

setSemaphore Sets the message port's semaphore, destroying any previous semaphores.

Parameters:
sem The new semaphore
own True if the message port should take responsibility for destroying the semaphore

template<typename message_t>
void ark::MessagePort< message_t >::signalReceiver (   )  [inline]
 

signalReceiver Signals the reciever that a message is waiting. This should only be used after sendMessage().

template<typename message_t>
unsigned ark::MessagePort< message_t >::size (   )  const [inline]
 

size

Returns:
The amount of total room in the message port

template<typename message_t>
bool ark::MessagePort< message_t >::waitForMessage (  message_t &  msg,
unsigned long  seconds,
unsigned long  nanoseconds
)  [inline]
 

waitForMessage Waits the specified amount of time for a message to put into the passed msg parameter.

Parameters:
msg The message data to fill
seconds The amount of seconds to wait nanoseconds The amount of nanoseconds to wait in addition to the seconds param
Returns:
True if the message was received, false if the timeout passed with no messages


Member Data Documentation

template<typename message_t>
Fifo<message_t> ark::MessagePort< message_t >::_msgFifo [private]
 

template<typename message_t>
Semaphore ark::MessagePort< message_t >::_semaphore [private]
 

template<typename message_t>
bool ark::MessagePort< message_t >::_semaphoreOk [private]
 


The documentation for this class was generated from the following file:
Generated on Tue Sep 6 14:54:41 2005 for Arkonnekt Sound by  doxygen 1.4.4