Class MsgQueue

java.lang.Object
  extended by MsgQueue
All Implemented Interfaces:
IMsgChannel

public class MsgQueue
extends java.lang.Object
implements IMsgChannel

MsgQueue is a channel for messages sent by robotic agents across a network. Each message is of type IMsg. There will be one message queue for each directed edge in a proximity graph or two for each undirected edge. See Lynch for details. Copying of message queues from graph induced by proximity graph at one point in statespace to the next is handled by calling the proper graph construction functions from implementations of IProximityGraphFunction.

Since:
1.0

Nested Class Summary
protected  class MsgQueue.MsgListNode
          Subclass to implement linked list of messages.
 
Constructor Summary
MsgQueue()
           Constructor
MsgQueue(MsgQueue src)
           Constructor : correct.
 
Method Summary
 IMsgChannel makeCopy()
          clone function for IMsgChannel interface.
 IMsgChannel makeLazyCopy()
          Clone function for IMsgChannel interface : Note the Lisp-like lazy internal copy semantics: This reflects the design intent of modelling discrete state transitions inspired by the functional paradigm, while modeling continuous-time state using the array-based programming paradigm (see http://en.wikipedia.org/wiki/Array-based_programming)
 IMsg readMsg()
           Read a message, alter state of this queue States of queues which share data are not altered.
 IMsgChannel sendMsg(IMsg msg)
           Add a message to the back of the queue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MsgQueue

public MsgQueue()

Constructor

Since:
1.0

MsgQueue

public MsgQueue(MsgQueue src)

Constructor : correct.

Parameters:
src - Allows this message queue to be constructed from an existing one.
Since:
1.0
Method Detail

makeCopy

public IMsgChannel makeCopy()
clone function for IMsgChannel interface.

Specified by:
makeCopy in interface IMsgChannel

makeLazyCopy

public IMsgChannel makeLazyCopy()

Clone function for IMsgChannel interface : Note the Lisp-like lazy internal copy semantics: This reflects the design intent of modelling discrete state transitions inspired by the functional paradigm, while modeling continuous-time state using the array-based programming paradigm (see http://en.wikipedia.org/wiki/Array-based_programming)

Also note that this sets m_bCopyOnWrite for the src queue, and not for this queue. The intent is that the copied queue will be written to more frequently then the source queue, and the extra bookkeeping is only there to make the queues semantically correct.

Specified by:
makeLazyCopy in interface IMsgChannel
Since:
1.0

sendMsg

public IMsgChannel sendMsg(IMsg msg)

Add a message to the back of the queue

If bugs occur, pay attention to nasty bookeeping required to handle "read the last item sent" events.

Specified by:
sendMsg in interface IMsgChannel
Parameters:
msg - is the message to be sent
Returns:
This queue

readMsg

public IMsg readMsg()

Read a message, alter state of this queue States of queues which share data are not altered. Garbage-collection ensures discarded head nodes are deletedif no sharing queue needs them.

Specified by:
readMsg in interface IMsgChannel
Returns:
IMsg just read.