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

simth::InputInterfaceT< T > Class Template Reference

Input interface with template argument as data type. More...

#include <interfaces.h>

Inheritance diagram for simth::InputInterfaceT< T >:

simth::InputInterface simth::DataInterface List of all members.

Public Member Functions

 InputInterfaceT (Device *const dev, int ID, size_t sequenceLength=undefinedLength, const typename T::value_type &default_val=typename T::value_type())
 InputInterfaceT (Device *const dev, int ID, const typename T::value_type &default_val)
virtual ~InputInterfaceT ()
T * externSequence (size_t size, size_t capacity)
T * internSequence ()
virtual void reset ()
virtual void acceptNewData (size_t size)
virtual size_t sequenceLength () const
virtual void setSequenceLength (size_t newLen)
virtual bool isFilled () const
virtual void flushProcessedSequence ()
virtual void releaseProcessedSequence ()
virtual void processFinished ()

Protected Member Functions

void incrementRefCount ()
void decrementRefCount ()
size_t storedElements () const

Detailed Description

template<class T>
class simth::InputInterfaceT< T >

Input interface with template argument as data type.

This generic class implements an input interface with the given template argument as data type. Classes that can be used as template argument are declared in signals.h. However, one can define own signals (or data) classes that can be used as template arguments. Of course these classes must define functions and operators used by the interface classes.


Constructor & Destructor Documentation

template<class T>
simth::InputInterfaceT< T >::InputInterfaceT Device *const   dev,
int  ID,
size_t  sequenceLength = undefinedLength,
const typename T::value_type &  default_val = typename T::value_type()
 

Class constructor.

template<class T>
simth::InputInterfaceT< T >::InputInterfaceT Device *const   dev,
int  ID,
const typename T::value_type &  default_val
 

Class that requires all arguments explicitly.

template<class T>
simth::InputInterfaceT< T >::~InputInterfaceT  )  [virtual]
 

Class destructor.


Member Function Documentation

template<class T>
T * simth::InputInterfaceT< T >::externSequence size_t  size,
size_t  capacity
 

Returns a pointer to a sequence that can be used for connected devices as output sequence.

The returned sequence is a shallow copy of a sub part from the internal buffer. Since a shallow copy can be receized to lengths that are smaller or equal the capacity only, the second parameter should be used, if the device will resize the sequence length interim.

Until now, only one copy can exist per time. In future versions maybe it could be usefull to maintain several copies simultanouesly, e.g. to allow parallel computing.

Parameters:
size The size of the returned sequence.
capacity The capacity of the returned sequence. Similar to the 'capacity' argument of a normal STL container.

template<class T>
T * simth::InputInterfaceT< T >::internSequence  ) 
 

Returns a sequence that is used from the parent device as input data.

Actually, this sequence is only a shallow copy of a sub part of the internal buffer to which the connected devices wrote their output data at.

If the sequence length equals 0 when calling this function, the sequence length is set to the number of received and so far not processed elements, i.e. it is set to the number of stored elements within the internal buffer (storedElements()).

template<class T>
void simth::InputInterfaceT< T >::reset  )  [virtual]
 

Resets the device. After calling that function the interface should behave as before any data had arrived.

Implements simth::InputInterface.

template<class T>
void simth::InputInterfaceT< T >::acceptNewData size_t  size  )  [virtual]
 

This function is invoked, when the interface got new data from the connected interface and the number of stored elements (including the number of the new data elements) is larger than the sequence length (see sequenceLenght()).

Implements simth::InputInterface.

template<class T>
size_t simth::InputInterfaceT< T >::sequenceLength  )  const [inline, virtual]
 

Returns the sequence length of the input interface.

The sequence length specifies when the parent device (see device()) is informed about new incoming data, i.e. if the number of stored elements exceeds the sequence length, device()->acceptNewData(ID()) is called (see InputInterface::acceptNewData()). Without setting the sequence length to a certain value, the sequence length is undefined. In that case the return value of this function equals Interface::undefindedLength().

Implements simth::InputInterface.

template<class T>
void simth::InputInterfaceT< T >::setSequenceLength size_t  newLen  )  [virtual]
 

Sets the number of elements needed at least to fill the buffer.

Implements simth::InputInterface.

template<class T>
bool simth::InputInterfaceT< T >::isFilled  )  const [virtual]
 

Returns true if the input buffer is filled (i.e. the buffer is filled with more than sequenceLength() elements) or if the interface is not connected with another device.

Implements simth::InputInterface.

template<class T>
void simth::InputInterfaceT< T >::flushProcessedSequence  )  [virtual]
 

Flushes the processed data elements.

This function is called after input data elements had been passed by the function internSequence() to the parent device. The number of elements that had been passed and that are now flushed equals the sequence length number (see sequenceLength()). The reference counter of the inteface is subtracted by one.

Implements simth::InputInterface.

template<class T>
void simth::InputInterfaceT< T >::releaseProcessedSequence  )  [virtual]
 

Releases the processed data elements.

Like in flushProcessedSequence() the reference counter of the interface is subtracted by one to release the accessed sequence. Unlike in flushProcessedSequence() the data is not flushed from the internal buffer.

Implements simth::InputInterface.

template<class T>
void simth::InputInterfaceT< T >::processFinished  )  [virtual]
 

This function is called by the connected device if it finished writing new data to this input interface.

Implements simth::InputInterface.

template<class T>
void simth::InputInterfaceT< T >::incrementRefCount  )  [protected]
 

template<class T>
void simth::InputInterfaceT< T >::decrementRefCount  )  [protected]
 

template<class T>
size_t simth::InputInterfaceT< T >::storedElements  )  const [inline, protected]
 


Generated on Mon Apr 24 21:19:19 2006 for simthetic by  doxygen 1.4.1