The class used to download data. More...

Public Types | |
typedef DataType_t | DataType |
The type of data being exchanged. | |
enum | NewDatumAvailableBehavior { NoNotification, NoNotificationBlocking, QtEvent, Callback } |
The possible behaviors when a new datum arrives. More... |
Public Member Functions | |
DataDownloader (NewDatumAvailableBehavior b, DataUploader< DataType > *uploader=NULL) | |
Constructor. | |
DataDownloader (QObject *o, DataUploader< DataType > *uploader=NULL) | |
Constructor. | |
DataDownloader (NewDatumNotifiable< DataType > *o, DataUploader< DataType > *uploader=NULL) | |
Constructor. | |
~DataDownloader () | |
Destructor. | |
const DataType * | downloadDatum () |
Returns a pointer to the next datum. | |
NewDatumAvailableBehavior | getNewDatumAvailableBehavior () const |
Returns the NewDatumAvailableBehavior. | |
unsigned int | getNumAvailableData () const |
Returns the number of available data. | |
const DataUploader< DataType > * | getUploader () const |
Returns the uploader associated with this downloader. |
Friends | |
class | DataUploader< DataType > |
The uploader is friend to modify the queue, the pointer to the uploader and to call sendNotification() |
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 710 of file dataexchange.h.
Member Typedef Documentation
typedef DataType_t DataType |
The type of data being exchanged.
Definition at line 716 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 721 of file dataexchange.h.
Constructor & Destructor Documentation
DataDownloader | ( | NewDatumAvailableBehavior | b, |
DataUploader< DataType > * | uploader = NULL |
||
) |
Constructor.
- Parameters
-
b the behavior when a new datum arrives. In this constructor this must be either NoNotification or NoNotificationBlocking, otherwise an exception is thrown uploader the uploader to which we are associated. This can be NULL. If uploader is already associated with another downloader, an exception is thrown
Definition at line 1514 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, |
DataUploader< DataType > * | uploader = NULL |
||
) |
Constructor.
This constructor sets the NewDatumAvailableBehavior to QtEvent
- Parameters
-
o the object to send notifications to when a new datum is available. This must not be NULL. uploader the uploader to which we are associated. This can be NULL. If uploader is already associated with another downloader, an exception is thrown
Definition at line 1534 of file dataexchange.h.
DataDownloader | ( | NewDatumNotifiable< DataType > * | o, |
DataUploader< DataType > * | uploader = NULL |
||
) |
Constructor.
This constructor sets the NewDatumAvailableBehavior to Callback
- Parameters
-
o the object whose callback has to be called when a new datum is available. This must not be NULL. uploader the uploader to which we are associated. This can be NULL. If uplaoder is already associated with another downloader, an exception is thrown
Definition at line 1550 of file dataexchange.h.
~DataDownloader | ( | ) |
Destructor.
Definition at line 1566 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 1596 of file dataexchange.h.
References UploaderDownloaderAssociationNotPresentException::UploaderNotPresent.
|
inline |
Returns the NewDatumAvailableBehavior.
- Returns
- the NewDatumAvailableBehavior
Definition at line 778 of file dataexchange.h.
unsigned int getNumAvailableData | ( | ) | const |
Returns the number of available data.
- Returns
- the number of available data
Definition at line 1584 of file dataexchange.h.
References UploaderDownloaderAssociationNotPresentException::UploaderNotPresent.
|
inline |
Returns the uploader associated with this downloader.
- Returns
- the uploader associated with this downloader or NULL if we are not associated with any uploader
- Note
- the uploader probably lives in another thread, so you should not use the returned pointer for anything except comparison with other pointers (e.g. to understand if an association is present or not)
Definition at line 793 of file dataexchange.h.
Friends And Related Function Documentation
|
friend |
The uploader is friend to modify the queue, the pointer to the uploader and to call sendNotification()
Definition at line 855 of file dataexchange.h.
The documentation for this class was generated from the following file:
- utilities/include/dataexchange.h