#include <DataChannel.h>
Inheritance diagram for Arxx::DataChannel:
Whenever Arxx::Item::vFetchData() is called it will indirectly lead to a call of Arxx::DataChannel::vFetchData() given an appropriate Arxx::DataChannel object is registered at the global Arxx::DataRepository. Appropriate here means that the Arxx::DataChannel's URI is an ancestor of the Arxx::Item's URI. The most appropriate URI is the one that gives the longest match and that one is chosen by the Arxx::DataRepository.
By derieving from this class it is possible to specify any kind of external data source.
Public Member Functions | |
DataChannel (const Arxx::URI &URI) | |
The default constructor. | |
virtual | ~DataChannel (void) |
A virtual destructor for there is a virtual function. | |
void | vReference (void) |
Adds a reference. | |
void | vDereference (void) |
Removes a reference. | |
bool | bIsReferenced (void) const |
Returns whether the DataChannel is referenced at all. | |
const Arxx::URI & | GetURI (void) const |
Returns m_URI. | |
virtual bool | bFetchData (const Arxx::URI &URI, Arxx::Buffer &Buffer, Arxx::FetchStatus &FetchStatus)=0 |
This abstract function is responsible for retrieving the data from the data source and writing it into a Buffers::Buffer. | |
bool | bWantsAutoDeletion (void) const |
Returns the m_bWantsAutoDeletion member. | |
Protected Member Functions | |
virtual void | vOnUnreferenced (void) |
Function that is called every time the reference counter goes to zero. | |
Protected Attributes | |
bool | m_bWantsAutoDeletion |
Derieved classes can set this flag true to indicate auto deletion to the data repository. | |
Private Member Functions | |
DataChannel (const Arxx::DataChannel &DataChannel) | |
Hidden copy constructor. | |
Arxx::DataChannel & | operator= (const Arxx::DataChannel &DataChannel) |
Hidden assignment operator. | |
Private Attributes | |
Arxx::u4byte | m_u4ReferenceCounter |
The channel's reference counter. | |
const Arxx::URI | m_URI |
The URI that this channel is applied to. |
Arxx::DataChannel::DataChannel | ( | const Arxx::URI & | URI | ) |
Arxx::DataChannel::~DataChannel | ( | void | ) | [virtual] |
A virtual destructor for there is a virtual function.
Will write an error to std::cerr if the reference counter m_u4ReferenceCounter is not 0.
Arxx::DataChannel::DataChannel | ( | const Arxx::DataChannel & | DataChannel | ) | [private] |
Hidden copy constructor.
virtual bool Arxx::DataChannel::bFetchData | ( | const Arxx::URI & | URI, | |
Arxx::Buffer & | Buffer, | |||
Arxx::FetchStatus & | FetchStatus | |||
) | [pure virtual] |
This abstract function is responsible for retrieving the data from the data source and writing it into a Buffers::Buffer.
URI | The URI that identifies the data location to be retrieved. | |
Buffer | The Buffer that the retrieved data should be written into. | |
FetchStatus | This variable takes the status of the fetching process. |
Implemented in Arxx::LocalArchiveChannel.
bool Arxx::DataChannel::bIsReferenced | ( | void | ) | const |
Returns whether the DataChannel is referenced at all.
If there is at least one reference remaining this function returns true.
bool Arxx::DataChannel::bWantsAutoDeletion | ( | void | ) | const |
const Arxx::URI & Arxx::DataChannel::GetURI | ( | void | ) | const |
Returns m_URI.
Arxx::DataChannel& Arxx::DataChannel::operator= | ( | const Arxx::DataChannel & | DataChannel | ) | [private] |
Hidden assignment operator.
void Arxx::DataChannel::vDereference | ( | void | ) |
Removes a reference.
Is called by the Arxx::DataRepository whenever some component dereferences a URI that matches closest with m_URI.
void Arxx::DataChannel::vOnUnreferenced | ( | void | ) | [protected, virtual] |
Function that is called every time the reference counter goes to zero.
The default implementation of this function is intentionally empty.
Reimplemented in Arxx::LocalArchiveChannel.
void Arxx::DataChannel::vReference | ( | void | ) |
Adds a reference.
Is called by the Arxx::DataRepository whenever some component references a URI that matches closest with m_URI.
bool Arxx::DataChannel::m_bWantsAutoDeletion [protected] |
Derieved classes can set this flag true to indicate auto deletion to the data repository.
Upon unreferencing a data channel the data repository will call bWantsAutoDeletion() which returns this value.
Either set it in the class constructor if you want class wide auto deletion or add an initializer to the constructor to allow different values per instance.
The channel's reference counter.
Every component having an interest in data that is to be fetched using this data channel will increment this reference counter by calling Arxx::DataChannel::vReference(). The referencing compoenents are responsible to dereference the data channel once they have no use of it anymore.
const Arxx::URI Arxx::DataChannel::m_URI [private] |
The URI that this channel is applied to.