DataDownloader< DataType_t > Class Template Reference

The class used to download data. More...

Inheritance diagram for DataDownloader< DataType_t >:

Public Types

typedef DataType_t DataType
 The type of data being exchanged. More...
 
enum  NewDatumAvailableBehavior { NoNotification, NoNotificationBlocking, QtEvent, Callback }
 The possible behaviors when a new datum arrives. More...
 

Public Member Functions

 DataDownloader (NewDatumAvailableBehavior b)
 Constructor. More...
 
 DataDownloader (QObject *o)
 Constructor. More...
 
 DataDownloader (NewDatumNotifiable< DataType > *o)
 Constructor. More...
 
 ~DataDownloader ()
 Destructor. More...
 
const DataTypedownloadDatum ()
 Returns a pointer to the next datum. More...
 
NewDatumAvailableBehavior getNewDatumAvailableBehavior () const
 Returns the NewDatumAvailableBehavior. More...
 
unsigned int getNumAvailableData () const
 Returns the number of available data. More...
 
bool uploaderPresent () const
 Returns true if we are associated with an uploader. More...
 

Friends

class DataUploader< DataType >
 The uploader is friend to call sendNotification() More...
 
class GlobalUploaderDownloader
 GlobalUploaderDownloader is friend to access private members. More...
 

Detailed Description

template<class DataType_t>
class farsa::DataDownloader< DataType_t >

The class used to download data.

See dataexchange.h for more information

Warning
Functions in this class are NOT thread safe

Definition at line 230 of file dataexchange.h.

Member Typedef Documentation

typedef DataType_t DataType

The type of data being exchanged.

Definition at line 678 of file dataexchange.h.

Member Enumeration Documentation

The possible behaviors when a new datum arrives.

Enumerator
NoNotification 

No notification

NoNotificationBlocking 

Like NoNotification but blocks the downloader if it tries to get a datum when the queue is empty

QtEvent 

Send NewDatumEvent when a new datum is available

Callback 

Calls a function when a new datum is available

Definition at line 683 of file dataexchange.h.

Constructor & Destructor Documentation

Constructor.

Parameters
bthe behavior when a new datum arrives. In this constructor this must be either NoNotification or NoNotificationBlocking, otherwise an exception is thrown

Definition at line 1607 of file dataexchange.h.

References DataDownloader< DataType_t >::Callback, DataDownloader< DataType_t >::NoNotification, DataDownloader< DataType_t >::NoNotificationBlocking, and DataDownloader< DataType_t >::QtEvent.

DataDownloader ( QObject *  o)

Constructor.

This constructor sets the NewDatumAvailableBehavior to QtEvent

Parameters
othe object to send notifications to when a new datum is available. This must not be NULL.

Definition at line 1624 of file dataexchange.h.

Constructor.

This constructor sets the NewDatumAvailableBehavior to Callback

Parameters
othe object whose callback has to be called when a new datum is available. This must not be NULL.

Definition at line 1637 of file dataexchange.h.

Destructor.

Definition at line 1650 of file dataexchange.h.

Member Function Documentation

const DataType_t * downloadDatum ( )

Returns a pointer to the next datum.

This returns the next datum. The returned datum is guaranteed to remain valid until the next call to this function. If the queue is empty this function blocks if the NewDatumAvailableBehavior is set to NoNotificationBlocking, otherwise it returns NULL. If we are not associated with any uploader, this function returns NULL.

Returns
the next datum

Definition at line 1689 of file dataexchange.h.

References UploaderDownloaderAssociationNotPresentException::UploaderNotPresent.

NewDatumAvailableBehavior getNewDatumAvailableBehavior ( ) const
inline

Returns the NewDatumAvailableBehavior.

Returns
the NewDatumAvailableBehavior

Definition at line 731 of file dataexchange.h.

unsigned int getNumAvailableData ( ) const

Returns the number of available data.

Returns
the number of available data

Definition at line 1675 of file dataexchange.h.

References UploaderDownloaderAssociationNotPresentException::UploaderNotPresent.

bool uploaderPresent ( ) const

Returns true if we are associated with an uploader.

Returns
true if we are associated with an uploader

Definition at line 1661 of file dataexchange.h.

Friends And Related Function Documentation

friend class DataUploader< DataType >
friend

The uploader is friend to call sendNotification()

Definition at line 810 of file dataexchange.h.

friend class GlobalUploaderDownloader
friend

GlobalUploaderDownloader is friend to access private members.

Definition at line 815 of file dataexchange.h.


The documentation for this class was generated from the following file: