Yate
Public Member Functions | Protected Attributes | Friends | List of all members
DataSource Class Reference

#include <yatephone.h>

Inheritance diagram for DataSource:
DataNode Mutex RefObject Lockable GenObject ThreadedSource

Public Member Functions

 DataSource (const char *format="slin")
 
virtual void destroyed ()
 
virtual void * getObject (const String &name) const
 
virtual bool valid () const
 
virtual bool control (NamedList &params)
 
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 ()
 
DataTranslatorgetTranslator () const
 
void synchronize (unsigned long tStamp)
 
unsigned long nextStamp () const
 
- Public Member Functions inherited from DataNode
 DataNode (const char *format=0)
 
virtual int costFormat (const DataFormat &format)
 
virtual bool setFormat (const DataFormat &format)
 
const DataFormatgetFormat () const
 
unsigned long timeStamp () const
 
virtual void attached (bool added)
 
- Public Member Functions inherited from RefObject
 RefObject ()
 
virtual ~RefObject ()
 
virtual bool alive () const
 
bool ref ()
 
bool deref ()
 
int refcount () const
 
virtual void destruct ()
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual const StringtoString () const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 
- Public Member Functions inherited from Mutex
 Mutex (bool recursive=false, const char *name=0)
 
 Mutex (const Mutex &original)
 
 ~Mutex ()
 
Mutexoperator= (const Mutex &original)
 
virtual bool lock (long maxwait=-1)
 
virtual bool unlock ()
 
virtual bool locked () const
 
const char * owner () const
 
bool recursive () const
 
- Public Member Functions inherited from Lockable
virtual ~Lockable ()
 
virtual bool check (long maxwait=-1)
 
virtual bool unlockAll ()
 

Protected Attributes

unsigned long m_nextStamp
 
ObjList m_consumers
 
- Protected Attributes inherited from DataNode
DataFormat m_format
 
unsigned long m_timestamp
 

Friends

class DataTranslator
 

Additional Inherited Members

- Public Types inherited from DataNode
enum  DataFlags {
  DataStart = 0x0001, DataEnd = 0x0002, DataMark = 0x0004, DataSilent = 0x0008,
  DataMissed = 0x0010, DataError = 0x0020, DataPrivate = 0x0100
}
 
- Static Public Member Functions inherited from DataNode
static unsigned long invalidStamp ()
 
- Static Public Member Functions inherited from RefObject
static bool alive (const RefObject *obj)
 
static bool efficientIncDec ()
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 
- Static Public Member Functions inherited from Mutex
static int count ()
 
static int locks ()
 
static bool efficientTimedLock ()
 
- Static Public Member Functions inherited from Lockable
static void wait (unsigned long maxwait)
 
static unsigned long wait ()
 
static void startUsingNow ()
 
static void enableSafety (bool safe=true)
 
static bool safety ()
 
- Protected Member Functions inherited from RefObject
virtual void zeroRefs ()
 
bool resurrect ()
 

Detailed Description

A data source

Constructor & Destructor Documentation

DataSource ( const char *  format = "slin")
inlineexplicit

Source constructor

Parameters
formatName of the data format, default "slin" (Signed Linear)

Member Function Documentation

bool attach ( DataConsumer consumer,
bool  override = false 
)

Attach a data consumer

Parameters
consumerData consumer to attach
overrideAttach as temporary source override
Returns
True on success, false on failure
void clear ( )

Detach all data consumers

virtual bool control ( NamedList params)
virtual

Modify source parameters, calls translator if one is set

Parameters
paramsThe list of parameters to change
Returns
True if processed

Reimplemented from DataNode.

virtual void destroyed ( )
virtual

Source's destruct notification - detaches all consumers

Reimplemented from RefObject.

Reimplemented in ThreadedSource.

bool detach ( DataConsumer consumer)

Detach a data consumer

Parameters
consumerData consumer to detach
Returns
True on success, false on failure
unsigned long Forward ( const DataBlock data,
unsigned long  tStamp = invalidStamp(),
unsigned long  flags = 0 
)

Forwards the data to its consumers

Parameters
dataThe raw data block to forward
tStampTimestamp of data - typically samples
flagsIndicator flags associated with the data block
Returns
Number of samples actually forwarded to all consumers
virtual void* getObject ( const String name) const
virtual

Get a pointer to a derived class given that class name

Parameters
nameName 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.

DataTranslator* getTranslator ( ) const
inline

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

Returns
A pointer to the DataTranslator object or NULL
unsigned long nextStamp ( ) const
inline

Get the next expected position in the data stream

Returns
Timestamp of next expected data position, may be invalid/unknown
void synchronize ( unsigned long  tStamp)

Synchronize the source and attached consumers with another timestamp

Parameters
tStampNew timestamp of data - typically samples
virtual bool 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.

Referenced by DataTranslator::valid().


The documentation for this class was generated from the following file: