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

POBox Class Reference

More...

#include <POBox.h>

Inheritance diagram for POBox:

POBoxIF List of all members.

Public Slots

void addMessage (const POMessage *msg)

Signals

void messageArrived ()
void messageArrived (const POMessage *msg)
 emited for every message that arrives

void messageSent (const POMessage *msg)

Public Member Functions

 POBox (const string &name, PostOffice *po)
 ~POBox ()
 Delete all unread messages.

const POMessagepopMessage ()
void setQueueState (bool state=true)
bool getQueueState () const
string getName () const
bool hasMessages (bool check_now=false) const
PostOfficegetPostOffice () const
bool sendTextMsg (const POAddress &adr, const char *format,...)
bool sendMessage (POMessage *msg, const POAddress &adr, bool send_now=false)
const POMessagesendBlockingMessage (POMessage *msg, const POAddress &adr, const DTime &timeout=DTime(2, 0))
void joinGroup (const POAddress &groupadr, bool create=false)
void leaveGroup (const POAddress &groupadr)

Detailed Description

Author:
Daniel Larimer


Constructor & Destructor Documentation

POBox::POBox const string &  name,
PostOffice po
 

Constructor

Parameters:
name - the name of the inbox
po - a pointer to the post office

POBox::~POBox  ) 
 

Delete all unread messages.


Member Function Documentation

void POBox::addMessage const POMessage msg  )  [virtual, slot]
 

Used by the PostOffice to add incomming messages to the box and then emits MessageArrived()

Parameters:
msg - the incomming message

Implements POBoxIF.

string POBox::getName  )  const [inline, virtual]
 

Implements POBoxIF.

PostOffice* POBox::getPostOffice  )  const [inline]
 

bool POBox::getQueueState  )  const [inline]
 

bool POBox::hasMessages bool  check_now = false  )  const [virtual]
 

Returns true if the mail box contains messages

Parameters:
check_now - true if you want Pony Express to check sockets before before checking messages. This will happen automatically next time qApp->processEvents() is called, but for the lowest latency we can call it now
Returns:
true if there are messages, otherwise false

Implements POBoxIF.

void POBox::joinGroup const POAddress groupadr,
bool  create = false
 

Sends a message to the group that will add this POBox to the list of group members. This box will start receiving all messages sent to the group

Parameters:
groupadr - the address of the group to join
create - ignored for the time being
Exceptions:
POErrorMsg* if an error occured

void POBox::leaveGroup const POAddress groupadr  ) 
 

Sends a message to the group that will remove this POBox from the list of group members. This box will stop receiving all messages sent to the group

Parameters:
groupadr - the address of the group to join
Exceptions:
POErrorMsg* if an error occured

void POBox::messageArrived const POMessage msg  )  [signal]
 

emited for every message that arrives

void POBox::messageArrived  )  [signal]
 

emited when a new message arives if QueueState is true slots hooked to this signal shouldn't set the QueueState to false unless they want the POBox to delete the message for them

void POBox::messageSent const POMessage msg  )  [signal]
 

const POMessage * POBox::popMessage  )  [virtual]
 

Returns the oldest message on the stack, you are responsible for deleting it.

Returns:
a pointer

Implements POBoxIF.

const POMessage * POBox::sendBlockingMessage POMessage msg,
const POAddress adr,
const DTime timeout = DTime(2,0)
 

Sends a message and blocks until a message is sent in response or the message times out. On a timeout or other error a POErrorMsg* exception is thrown.

Parameters:
msg - the message to send
adr - the address to send the message to
timeout - the max time to wait for a response, default is 2 seconds
Returns:
the message returned

bool POBox::sendMessage POMessage msg,
const POAddress adr,
bool  now = false
[virtual]
 

Sets the message from field to POBox::GetName()

Parameters:
msg - the message to send
adr - the address to send it to
now - wether or not to write it out the socket now, or wait until the next cycle
Returns:
true - if the message could be sent, otherwise false

Implements POBoxIF.

bool POBox::sendTextMsg const POAddress adr,
const char *  format,
... 
 

Provided for convience, sends a POTextMsg to the specified address

Parameters:
adr - the address to send the message to
format - the text to send
Returns:
true if adr is a valid address

void POBox::setQueueState bool  state = true  )  [inline]
 


The documentation for this class was generated from the following files:
Generated on Tue Jun 15 12:49:28 2004 for pexpr by doxygen 1.3.4