Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

SenderBase< T > Class Template Reference

The class implements a the base class for senders. More...

#include <Sender.h>

Inheritance diagram for SenderBase< T >:

Inheritance graph
[legend]
Collaboration diagram for SenderBase< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SenderBase (PlatformProcess *process, const char *senderName, bool blocking)
 The constructor.

int fillEntryTable (ObjectEntry *entryTable, int id)
 Fills the Aperios entry table for global functions.

bool requestedNew () const
 Returns whether a new package was requested from the sender.

void send ()
 Marks the package for sending and transmits it to all receivers that already requested for it.


Protected Member Functions

virtual void preparePackage ()
 The function prepares a package.

virtual void setPackage (const ObserverID &receiver)
 The functions sets a package for a receiver.

virtual void freePackage ()
 The function frees the package.


Private Member Functions

void handleMessage (OReadyMessage &msg)
 The function is called when a receiver announces that it is ready to receive a package.

void sendPackage ()
 The function sends a package to all receivers that requested it.


Static Private Member Functions

void aperiosControl (OControlMessage *msg)
 The Aperios control handler.

void aperiosReady (OReadyMessage *msg)
 The Aperios handler that is called when a receiver announces that it is ready to receive a package.


Private Attributes

ObserverID receiver [RECEIVERS_MAX]
 A list of all receivers that are ready to receive a package.

ObserverID alreadyReceived [RECEIVERS_MAX]
 A list of all receivers that have already received the current package.

int numOfReceivers
 The number of entries in the receiver list.

int numOfAlreadyReceived
 The number of entries in the alreadyReceived list.


Static Private Attributes

SenderBase< T > * theInstance = 0
 The only instance of SenderBase<T>.


Detailed Description

template<class T>
class SenderBase< T >

The class implements a the base class for senders.

A sender is an object that sends packages to an Aperios queue. Note that the template parameter is required to force a different instantiation of the static members for each package type.

Definition at line 106 of file Sender.h.


Constructor & Destructor Documentation

template<class T>
SenderBase< T >::SenderBase PlatformProcess process,
const char *  senderName,
bool  blocking
[inline]
 

The constructor.

Parameters:
process The process this sender is associated with.
senderName The Aperios connection name of the sender without the process name.
blocking Decides whether this sender blocks the execution of the next frame until all connected receivers have requested a new package.

Definition at line 236 of file Sender.h.


Member Function Documentation

template<class T>
void SenderBase< T >::handleMessage OReadyMessage &  msg  )  [inline, private]
 

The function is called when a receiver announces that it is ready to receive a package.

Parameters:
msg An Open-R message that contains the object id of the receiver.

Todo:
Currently, assert fails in conjunction with wlan, so avoid crash! However, it may work correctly, because TCPGateway will be the only receiver.

Definition at line 120 of file Sender.h.

template<class T>
void SenderBase< T >::aperiosControl OControlMessage *  msg  )  [inline, static, private]
 

The Aperios control handler.

Parameters:
msg A message provided by Aperios.

Definition at line 143 of file Sender.h.

template<class T>
void SenderBase< T >::aperiosReady OReadyMessage *  msg  )  [inline, static, private]
 

The Aperios handler that is called when a receiver announces that it is ready to receive a package.

Parameters:
msg An Open-R message that contains the object id of the receiver.

Definition at line 153 of file Sender.h.

template<class T>
virtual void SenderBase< T >::preparePackage  )  [inline, protected, virtual]
 

The function prepares a package.

The function should be pure virtual, but GreenHills does not like that.

Reimplemented in MotorCommandsSender, Sender< T >, SoundDataSender, and Sender< MessageQueue >.

Definition at line 164 of file Sender.h.

Referenced by SenderBase< MotorCommands >::sendPackage().

template<class T>
virtual void SenderBase< T >::setPackage const ObserverID &  receiver  )  [inline, protected, virtual]
 

The functions sets a package for a receiver.

The function should be pure virtual, but GreenHills does not like that.

Parameters:
receiver The receive the package will be sent to.

Reimplemented in MotorCommandsSender, Sender< T >, SoundDataSender, and Sender< MessageQueue >.

Definition at line 171 of file Sender.h.

Referenced by SenderBase< MotorCommands >::sendPackage().

template<class T>
virtual void SenderBase< T >::freePackage  )  [inline, protected, virtual]
 

The function frees the package.

The function should be pure virtual, but GreenHills does not like that.

Reimplemented in MotorCommandsSender, Sender< T >, SoundDataSender, and Sender< MessageQueue >.

Definition at line 177 of file Sender.h.

Referenced by SenderBase< MotorCommands >::sendPackage().

template<class T>
void SenderBase< T >::sendPackage  )  [inline, private, virtual]
 

The function sends a package to all receivers that requested it.

Implements SenderList.

Definition at line 183 of file Sender.h.

Referenced by SenderBase< MotorCommands >::send().

template<class T>
int SenderBase< T >::fillEntryTable ObjectEntry *  entryTable,
int  id
[inline, virtual]
 

Fills the Aperios entry table for global functions.

The function will write two entries into the table.

Parameters:
entryTable The Aperios entry table.
id The first empty id in the entry table.
Returns:
The new first empty id in the entry table.

Implements SenderList.

Definition at line 251 of file Sender.h.

template<class T>
bool SenderBase< T >::requestedNew  )  const [inline]
 

Returns whether a new package was requested from the sender.

This is always true if this is a blocking sender.

Returns:
Has a new package been requested?

Definition at line 268 of file Sender.h.

Referenced by MultiDebugSender< MessageQueue >::send().

template<class T>
void SenderBase< T >::send void   )  [inline]
 

Marks the package for sending and transmits it to all receivers that already requested for it.

All other receiver may get it later if they request for it before the package is changed.

Reimplemented in MultiDebugSender< T >, and MultiDebugSender< MessageQueue >.

Definition at line 274 of file Sender.h.

Referenced by MultiDebugSender< MessageQueue >::send().


Member Data Documentation

template<class T>
SenderBase< T > * SenderBase< T >::theInstance = 0 [static, private]
 

The only instance of SenderBase<T>.

Definition at line 282 of file Sender.h.

template<class T>
ObserverID SenderBase< T >::receiver[RECEIVERS_MAX] [private]
 

A list of all receivers that are ready to receive a package.

Definition at line 110 of file Sender.h.

template<class T>
ObserverID SenderBase< T >::alreadyReceived[RECEIVERS_MAX] [private]
 

A list of all receivers that have already received the current package.

Definition at line 110 of file Sender.h.

template<class T>
int SenderBase< T >::numOfReceivers [private]
 

The number of entries in the receiver list.

Definition at line 112 of file Sender.h.

template<class T>
int SenderBase< T >::numOfAlreadyReceived [private]
 

The number of entries in the alreadyReceived list.

Definition at line 112 of file Sender.h.


The documentation for this class was generated from the following file:
Generated on Thu Sep 23 20:11:39 2004 for GT2004 by doxygen 1.3.6