# class DataSource | A data source More...
Full name | `TelEngine::DataSource`
Definition | `#include <yatephone.h>`
Inherits | TelEngine::DataNode [public ], TelEngine::Mutex [public ]
Inherited by | ThreadedSource
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- inline explicit DataSource (const char* format = "slin")
- virtual void destroyed ()
- virtual void* getObject (const String& name) const
- virtual bool valid () const
- unsigned long Forward (const DataBlock& data, unsigned long tStamp = invalidStamp(), unsigned long flags = 0)
- bool attach (DataConsumer* consumer, bool override = false)
- bool detach (DataConsumer* consumer)
- void clear ()
- inline DataTranslator* getTranslator () const
- void synchronize (unsigned long tStamp)
- inline unsigned long nextStamp () const

#### Protected Members

- unsigned long m_nextStamp
- ObjList m_consumers

## Detailed Description

A data source

inline explicit DataSource (const char* format = "slin") | ### DataSource

Source constructor

Parameters:

format | Name of the data format, default "slin" (Signed Linear)

void destroyed () | ### destroyed

[virtual]

Source's destruct notification - detaches all consumers

Reimplemented from RefObject.

void* getObject (const String& name) | ### getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:

name | Name of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from RefObject.

bool valid () | ### valid

[const virtual]

Check if this data source is still valid

Returns: True if still valid, false if node should be removed

Reimplemented from DataNode.

unsigned long Forward (const DataBlock& data, unsigned long tStamp = invalidStamp(), unsigned long flags = 0) | ### Forward

Forwards the data to its consumers

Parameters:

data | The raw data block to forward
tStamp | Timestamp of data - typically samples
flags | Indicator flags associated with the data block

Returns: Number of samples actually forwarded to all consumers

bool attach (DataConsumer* consumer, bool override = false) | ### attach

Attach a data consumer

Parameters:

consumer | Data consumer to attach
override | Attach as temporary source override

Returns: True on success, false on failure

bool detach (DataConsumer* consumer) | ### detach

Detach a data consumer

Parameters:

consumer | Data consumer to detach

Returns: True on success, false on failure

void clear () | ### clear

Detach all data consumers

inline DataTranslator* getTranslator () | ### getTranslator

[const]

Get the master translator object if this source is part of a translator

Returns: A pointer to the DataTranslator object or NULL

void synchronize (unsigned long tStamp) | ### synchronize

Synchronize the source and attached consumers with another timestamp

Parameters:

tStamp | New timestamp of data - typically samples

inline unsigned long nextStamp () | ### nextStamp

[const]

Get the next expected position in the data stream

Returns: Timestamp of next expected data position, may be invalid/unknown

unsigned long m_nextStamp | ### m_nextStamp

[protected]

ObjList m_consumers | ### m_consumers

[protected]

Generated by: paulc on bussard on Fri May 8 12:37:22 2015, using kdoc 2.0a54.