Essentia  2.1-beta6-dev
SourceBase Class Referenceabstract

#include <sourcebase.h>

Inheritance diagram for SourceBase:
Connector TypeProxy StreamConnector Source< Real > Source< TokenType > SourceProxyBase AbsoluteSource< TokenType > SourceProxy< TokenType >

Public Member Functions

 SourceBase (Algorithm *parent=0, const std::string &name="unnamed")
 
 SourceBase (const std::string &name)
 
 ~SourceBase ()
 
virtual void * buffer ()=0
 
virtual int totalProduced () const =0
 
const std::vector< SinkBase * > & sinks () const
 
std::vector< SinkBase * > & sinks ()
 
virtual void * getTokens ()=0
 
virtual void * getFirstToken ()=0
 
bool isProxied () const
 
const std::vector< SinkBase * > & proxiedSinks () const
 
template<typename TokenType >
void push (const TokenType &value)
 
virtual void setBufferType (BufferUsage::BufferUsageType type)=0
 
virtual BufferInfo bufferInfo () const =0
 
virtual void setBufferInfo (const BufferInfo &info)=0
 
- Public Member Functions inherited from Connector
 Connector (Algorithm *parent=0, const std::string &name="Unnamed")
 
 Connector (const std::string &name)
 
const Algorithmparent () const
 
Algorithmparent ()
 
void setParent (Algorithm *parent)
 
std::string parentName () const
 
std::string fullName () const
 
- Public Member Functions inherited from TypeProxy
 TypeProxy ()
 
 TypeProxy (const std::string &name)
 
virtual ~TypeProxy ()
 
const std::string & name () const
 
void setName (const std::string &name)
 
void checkType (const std::type_info &received, const std::type_info &expected) const
 
template<typename Type >
void checkType () const
 
void checkSameTypeAs (const TypeProxy &obj) const
 
void checkVectorSameTypeAs (const TypeProxy &obj) const
 
virtual const std::type_info & typeInfo () const =0
 
virtual const std::type_info & vectorTypeInfo () const =0
 
- Public Member Functions inherited from StreamConnector
 StreamConnector ()
 
virtual ~StreamConnector ()
 
virtual int available () const =0
 
bool acquire ()
 
virtual bool acquire (int n)=0
 
void release ()
 
virtual void release (int n)=0
 
virtual int acquireSize () const
 
virtual int releaseSize () const
 
virtual void setAcquireSize (int n)
 
virtual void setReleaseSize (int n)
 
virtual void reset ()=0
 

Protected Member Functions

virtual void connect (SinkBase &sink)
 
virtual void disconnect (SinkBase &sink)
 
virtual ReaderID addReader ()=0
 
virtual void removeReader (ReaderID id)=0
 
void attachProxy (SourceProxyBase *sproxy)
 
void detachProxy (SourceProxyBase *sproxy)
 

Protected Attributes

std::vector< SinkBase * > _sinks
 
SourceProxyBase_sproxy
 
- Protected Attributes inherited from Connector
Algorithm_parent
 
- Protected Attributes inherited from TypeProxy
std::string _name
 
- Protected Attributes inherited from StreamConnector
int _acquireSize
 
int _releaseSize
 

Friends

class SourceProxyBase
 
template<typename T >
class SourceProxy
 
template<typename T >
class SinkProxy
 
void connect (SourceBase &source, SinkBase &sink)
 
void disconnect (SourceBase &source, SinkBase &sink)
 
void attach (SourceBase &innerSource, SourceProxyBase &proxy)
 
void detach (SourceBase &innerSource, SourceProxyBase &proxy)
 

Detailed Description

This is the base class from which Sources should derive. It defines the basic interface a Source should provide, such as the acquire() and release() methods, and a way to get hold of one or more tokens that are waiting to be consumed. It is untyped (in the sense that it doesn't know which type are the tokens), but derives from TypeProxy and as such has functions that can do type-checking with respect to the types of the derived Sink (which is a templated class, the template being the token type). Look at the Source implementation for more information.

Constructor & Destructor Documentation

◆ SourceBase() [1/2]

SourceBase ( Algorithm parent = 0,
const std::string &  name = "unnamed" 
)
inline

◆ SourceBase() [2/2]

SourceBase ( const std::string &  name)
inline

◆ ~SourceBase()

~SourceBase ( )

Member Function Documentation

◆ addReader()

virtual ReaderID addReader ( )
protectedpure virtual

◆ attachProxy()

void attachProxy ( SourceProxyBase sproxy)
protected

◆ buffer()

virtual void* buffer ( )
pure virtual

◆ bufferInfo()

virtual BufferInfo bufferInfo ( ) const
pure virtual

◆ connect()

virtual void connect ( SinkBase sink)
protectedvirtual

Reimplemented in SourceProxyBase.

Referenced by SourceProxyBase::connect().

◆ detachProxy()

void detachProxy ( SourceProxyBase sproxy)
protected

◆ disconnect()

virtual void disconnect ( SinkBase sink)
protectedvirtual

Reimplemented in SourceProxyBase.

Referenced by SourceProxyBase::disconnect().

◆ getFirstToken()

virtual void* getFirstToken ( )
pure virtual

◆ getTokens()

virtual void* getTokens ( )
pure virtual

◆ isProxied()

bool isProxied ( ) const
inline

References SourceBase::_sproxy.

◆ proxiedSinks()

const std::vector<SinkBase*>& proxiedSinks ( ) const

Return the list of sinks that are connected through a proxy. Make sure to call isProxied() before.

◆ push()

◆ removeReader()

virtual void removeReader ( ReaderID  id)
protectedpure virtual

◆ setBufferInfo()

virtual void setBufferInfo ( const BufferInfo info)
pure virtual

◆ setBufferType()

virtual void setBufferType ( BufferUsage::BufferUsageType  type)
pure virtual

◆ sinks() [1/2]

std::vector<SinkBase*>& sinks ( )
inline

References SourceBase::_sinks.

◆ sinks() [2/2]

const std::vector<SinkBase*>& sinks ( ) const
inline

References SourceBase::_sinks.

◆ totalProduced()

virtual int totalProduced ( ) const
pure virtual

Friends And Related Function Documentation

◆ attach

void attach ( SourceBase innerSource,
SourceProxyBase proxy 
)
friend

◆ connect

void connect ( SourceBase source,
SinkBase sink 
)
friend

Global function used for connecting algorithms.

◆ detach

void detach ( SourceBase innerSource,
SourceProxyBase proxy 
)
friend

◆ disconnect

void disconnect ( SourceBase source,
SinkBase sink 
)
friend

Global function used for disconnecting outputs from inputs.

◆ SinkProxy

friend class SinkProxy
friend

◆ SourceProxy

friend class SourceProxy
friend

◆ SourceProxyBase

friend class SourceProxyBase
friend

Member Data Documentation

◆ _sinks

std::vector<SinkBase*> _sinks
protected

◆ _sproxy

SourceProxyBase* _sproxy
protected

Referenced by SourceBase::isProxied().


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