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

rovsoft::io::DeviceContainer Class Reference

Abstract class defining the general interface for all device containers. More...

#include <DeviceContainer.hh>

Inheritance diagram for rovsoft::io::DeviceContainer:

Inheritance graph
[legend]
Collaboration diagram for rovsoft::io::DeviceContainer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 DeviceContainer (messages::NewMessageReceiverListener *rListener=0, messages::NewMessageSenderListener *sListener=0)
 Construct a device container with specified listeners, which should receive events about newly created devices.
virtual void parseMessageStream (unsigned short sa, unsigned short da, IStreamer &stream, messages::MessageReceiver *out=0) throw (lib::ExceptionPtr)
 This method forwards the streamer to the device specified with sa and creates it if it didn't exist.
virtual void putMessage (const messages::MessagePtr message) throw (ReadOnlyExceptionPtr, lib::OutOfRangeExceptionPtr, lib::NullPointerExceptionPtr)
 Input from rovsoft.
void setNewMessageReceiverListener (messages::NewMessageReceiverListener *listener)
 Set a new Listener for new receiver devices.
void setNewMessageSenderListener (messages::NewMessageSenderListener *listener)
 Set a new listener that will be informed about new message sender devices being created.
messages::MessageReceiver & getMessageReceiver (unsigned char index) throw (ReadOnlyExceptionPtr, lib::NullPointerExceptionPtr, lib::OutOfRangeExceptionPtr)
 Gets the MessageReceiver device specified with index.
messages::MessageSenderInterface & getMessageSender (unsigned char index) throw (WriteOnlyExceptionPtr, lib::NullPointerExceptionPtr, lib::OutOfRangeExceptionPtr)
 Gets the MessageSender device specified with index.
virtual ~DeviceContainer ()

Protected Member Functions

virtual void newDevice (MessageStreamParser *&obj, messages::MessageReceiver *interface)=0
 Must be overridden by daughter classes, so that parseMessageStream can work.
MessageStreamParser * getMessageStreamParser (unsigned char index) throw (lib::OutOfRangeExceptionPtr)
 Gets a device from the devices vector.

Protected Attributes

std::vector< MessageStreamParser * > devices
 The mapping sa to device, is done via the index of the vector, to the vector element, just because of performance.
messages::NewMessageReceiverListener * newReceiverListener
messages::NewMessageSenderListener * newSenderListener

Detailed Description

Abstract class defining the general interface for all device containers.


Constructor & Destructor Documentation

rovsoft::io::DeviceContainer::DeviceContainer (  messages::NewMessageReceiverListener *  rListener = 0,
messages::NewMessageSenderListener *  sListener = 0
)  [inline]
 

Construct a device container with specified listeners, which should receive events about newly created devices.

Parameters:
rListener an object that should be informed about newly created message receiver devices.
sListener an object that should be informed about newly created message sender devices.

rovsoft::io::DeviceContainer::~DeviceContainer (   )  [virtual]
 


Member Function Documentation

messages::MessageReceiver & rovsoft::io::DeviceContainer::getMessageReceiver (  unsigned char  index  )  throw (ReadOnlyExceptionPtr, lib::NullPointerExceptionPtr, lib::OutOfRangeExceptionPtr)
 

Gets the MessageReceiver device specified with index.

You should not store the returned reference permanentely in a pointer, because its target could become invalid!

Parameters:
index of the device that should be returned.
Exceptions:
ReadOnlyExceptionPtr if the device does not support writting.
lib::NullPointerExceptionPtr if the target exists but is a NullPointer
lib::OutOfRangeExceptionPtr if the desired index is not available.

messages::MessageSenderInterface & rovsoft::io::DeviceContainer::getMessageSender (  unsigned char  index  )  throw (WriteOnlyExceptionPtr, lib::NullPointerExceptionPtr, lib::OutOfRangeExceptionPtr)
 

Gets the MessageSender device specified with index.

You should not store the returned reference permanentely in a pointer, because its target could become invalid!

Parameters:
index of the device that should be returned.
Exceptions:
WriteOnlyExceptionPtr if the device does not support reading.
lib::NullPointerExceptionPtr if the target exists but is a NullPointer
lib::OutOfRangeExceptionPtr if the desired index is not available.

MessageStreamParser * rovsoft::io::DeviceContainer::getMessageStreamParser (  unsigned char  index  )  throw (lib::OutOfRangeExceptionPtr) [protected]
 

Gets a device from the devices vector.

virtual void rovsoft::io::DeviceContainer::newDevice (  MessageStreamParser *&  obj,
messages::MessageReceiver *  interface
)  [protected, pure virtual]
 

Must be overridden by daughter classes, so that parseMessageStream can work.

Should return a pointer to a newly created object.

Parameters:
obj This Method should store its newly created object in this reference, a return is not used, because this method should inform any NewXXXDeviceListeners, just after the insertion into the array!
interface the interface used by receiver devices for sending messages to their interface.

Implemented in rovsoft::io::BoolCommandReceiverContainer, rovsoft::io::MotionCommandReceiverContainer, rovsoft::io::NConfirmedCommandSenderContainer, rovsoft::io::PeripheralReceiverContainer, rovsoft::io::PowerDownEventReceiverContainer, rovsoft::io::TsFloatTypeSenderContainer, rovsoft::io::TsUByteTypeReceiverContainer, and rovsoft::io::TsUByteTypeSenderContainer.

void rovsoft::io::DeviceContainer::parseMessageStream (  unsigned short  sa,
unsigned short  da,
IStreamer &  stream,
messages::MessageReceiver *  out = 0
)  throw (lib::ExceptionPtr) [virtual]
 

This method forwards the streamer to the device specified with sa and creates it if it didn't exist.

When the creation of a device was neccessary it reports this to the specified listeners.

Implements rovsoft::io::MessageStreamParser.

Here is the call graph for this function:

void rovsoft::io::DeviceContainer::putMessage (  const messages::MessagePtr  message  )  throw (ReadOnlyExceptionPtr, lib::OutOfRangeExceptionPtr, lib::NullPointerExceptionPtr) [virtual]
 

Input from rovsoft.

Exceptions:
ReadOnlyExceptionPtr if the device is a read only device- so it is not possible to write it a message.
lib::OutOfRangeExceptionPtr if the device to which the message should be sent, does not exist.
lib::NullPointerExceptionPtr if the index of the device exists, but it is a null pointer.

Implements rovsoft::messages::MessageReceiver.

void rovsoft::io::DeviceContainer::setNewMessageReceiverListener (  messages::NewMessageReceiverListener *  listener  )  [inline]
 

Set a new Listener for new receiver devices.

Parameters:
listener a listener that will be informed about new receiver devices being created. The null pointer is allowed.

void rovsoft::io::DeviceContainer::setNewMessageSenderListener (  messages::NewMessageSenderListener *  listener  )  [inline]
 

Set a new listener that will be informed about new message sender devices being created.

Parameters:
listener the object that gets informed about new devices. The null pointer is allowed.


Member Data Documentation

std::vector<MessageStreamParser* > rovsoft::io::DeviceContainer::devices [protected]
 

The mapping sa to device, is done via the index of the vector, to the vector element, just because of performance.

A dictionary would be better if there were big holes between the elements, for not wasting too much memory.

messages::NewMessageReceiverListener* rovsoft::io::DeviceContainer::newReceiverListener [protected]
 

messages::NewMessageSenderListener* rovsoft::io::DeviceContainer::newSenderListener [protected]
 


The documentation for this class was generated from the following files:
Generated on Tue May 31 14:19:31 2005 for Rovsoft by  doxygen 1.4.3