sipxmedialib  Version 3.3
Protected Member Functions | Private Attributes | List of all members
StreamDataSource Class Referenceabstract

An abstraction definition of a stream data source. More...

#include <StreamDataSource.h>

Inheritance diagram for StreamDataSource:
Inheritance graph
[legend]
Collaboration diagram for StreamDataSource:
Collaboration graph
[legend]

Public Member Functions

Creators
 StreamDataSource (int iFlags=0)
 Constructors a StreamDataSource given optional flags. More...
 
virtual ~StreamDataSource ()
 Destructor. More...
 
Manipulators
virtual OsStatus open ()=0
 Opens the data source. More...
 
virtual OsStatus close ()=0
 Closes the data source. More...
 
virtual OsStatus destroyAndDelete ()=0
 Destroys and deletes the data source object. More...
 
virtual OsStatus read (char *szBuffer, int iLength, int &iLengthRead)=0
 
virtual OsStatus peek (char *szBuffer, int iLength, int &iLengthRead)=0
 Identical to read, except the stream pointer is not advanced. More...
 
virtual OsStatus interrupt ()
 Interrupts any time consuming operation. More...
 
virtual OsStatus seek (unsigned int iLocation)=0
 Moves the stream pointer to the an absolute location. More...
 
void setListener (StreamDataSourceListener *pListener)
 
Accessors
virtual OsStatus getLength (int &iLength)=0
 Gets the length of the stream (if available) More...
 
virtual OsStatus getPosition (int &iPosition)=0
 Gets the current position within the stream. More...
 
virtual OsStatus toString (UtlString &string)=0
 Renders a string describing this data source. More...
 
int getFlags ()
 Gets the flags specified at time of construction. More...
 

Protected Member Functions

 StreamDataSource (const StreamDataSource &rStreamDataSource)
 Copy constructor (not supported) More...
 
StreamDataSourceoperator= (const StreamDataSource &rhs)
 Assignment operator (not supported) More...
 
void fireEvent (StreamDataSourceEvent event)
 Fires a data source event to the interested consumer. More...
 

Private Attributes

StreamDataSourceListenermpListener
 data source listener More...
 
int miFlags
 flags specified during construction More...
 

Detailed Description

An abstraction definition of a stream data source.

Constructor & Destructor Documentation

StreamDataSource ( int  iFlags = 0)

Constructors a StreamDataSource given optional flags.

See also
StreamDefs.h for a description of available flags.
~StreamDataSource ( )
virtual

Destructor.

StreamDataSource ( const StreamDataSource rStreamDataSource)
protected

Copy constructor (not supported)

Member Function Documentation

virtual OsStatus open ( )
pure virtual

Opens the data source.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

virtual OsStatus close ( )
pure virtual

Closes the data source.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

virtual OsStatus destroyAndDelete ( )
pure virtual

Destroys and deletes the data source object.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

virtual OsStatus read ( char *  szBuffer,
int  iLength,
int &  iLengthRead 
)
pure virtual

Reads iLength bytes of data from the data source and places the data into the passed szBuffer buffer.

Parameters
szBuffer- Buffer to place data
iLength- Max length to read
iLengthRead- The actual amount of data read.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

virtual OsStatus peek ( char *  szBuffer,
int  iLength,
int &  iLengthRead 
)
pure virtual

Identical to read, except the stream pointer is not advanced.

Parameters
szBuffer- Buffer to place data
iLength- Max length to read
iLengthRead- The actual amount of data read.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

OsStatus interrupt ( )
virtual

Interrupts any time consuming operation.

For example, some data sources may require network access (e.g. http) to read or fetch data. Invoking an interrupt() will cause any time consuming or blocking calls to exit with more quickly with an OS_INTERRUPTED return code.

Reimplemented in StreamHttpDataSource.

virtual OsStatus seek ( unsigned int  iLocation)
pure virtual

Moves the stream pointer to the an absolute location.

Parameters
iLocation- The desired seek location

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

void setListener ( StreamDataSourceListener pListener)

Sets a listener to receive StreamDataSourceEvent events for this data source.

virtual OsStatus getLength ( int &  iLength)
pure virtual

Gets the length of the stream (if available)

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

virtual OsStatus getPosition ( int &  iPosition)
pure virtual

Gets the current position within the stream.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

virtual OsStatus toString ( UtlString &  string)
pure virtual

Renders a string describing this data source.

Implemented in StreamHttpDataSource, StreamBufferDataSource, and StreamFileDataSource.

int getFlags ( )

Gets the flags specified at time of construction.

StreamDataSource & operator= ( const StreamDataSource rhs)
protected

Assignment operator (not supported)

void fireEvent ( StreamDataSourceEvent  event)
protected

Fires a data source event to the interested consumer.

Member Data Documentation

StreamDataSourceListener* mpListener
private

data source listener

int miFlags
private

flags specified during construction