Arxx::DataChannel Class Reference

#include <DataChannel.h>

Inheritance diagram for Arxx::DataChannel:

Inheritance graph
[legend]
Collaboration diagram for Arxx::DataChannel:

Collaboration graph
[legend]
List of all members.

Detailed Description

An abstract class defining the interface for data sources.

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.

Todo:
In order to really support different data sources it is crucial to define some way of asynchron data retrieval.


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::URIGetURI (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::DataChanneloperator= (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.


Constructor & Destructor Documentation

Arxx::DataChannel::DataChannel ( const Arxx::URI URI  ) 

The default constructor.

Parameters:
URI The URI that is handled by this data channel.
Initializes the use counter m_u4UseCounter with 0.

Initializes m_bWantsAutoDeletion with false.

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.


Member Function Documentation

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.

Parameters:
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.
Returns:
A boolean value indicating whether the fetch was successful.
When this function is called the derieved class is supposed to get the data from the external source and write it into the Buffer.

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

Returns the m_bWantsAutoDeletion member.

See also:
m_bWantsAutoDeletion.

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.


Member Data Documentation

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.

Arxx::u4byte Arxx::DataChannel::m_u4ReferenceCounter [private]

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.


The documentation for this class was generated from the following files:
Generated on Tue Oct 10 11:34:49 2006 for libarxx by  doxygen 1.4.7