20 #ifndef ESSENTIA_SOURCEPROXY_H
21 #define ESSENTIA_SOURCEPROXY_H
89 throw EssentiaException(
"Cannot acquire for SourceProxy ",
fullName(),
": you need to call acquire() on the Source which is proxied by it");
102 throw EssentiaException(
"Cannot release for SourceProxy ",
fullName(),
": you need to call release() on the Source which is proxied by it");
123 <<
"::connect(" << sink.
fullName() <<
")");
133 <<
"::disconnect(" << sink.
fullName() <<
")");
146 std::ostringstream msg;
147 msg <<
"Could not attach SourceProxy " <<
fullName() <<
" to " << source->
fullName()
174 template<
typename TokenType>
215 ": you need to call getTokens() on the Source which is proxied by it");
220 ": you need to call getFirstToken() on the Source which is proxied by it");
246 if (!
sameType(innerSource, proxy)) {
247 std::ostringstream msg;
248 msg <<
"Cannot attach " << innerSource.
fullName() <<
" (type: " <<
nameOfType(innerSource)
252 proxy.
attach(&innerSource);
257 attach(innerSource, proxy);
262 proxy.
detach(&innerSource);
void checkSameTypeAs(const TypeProxy &obj) const
Definition: types.h:302
const std::string & name() const
Definition: types.h:284
Definition: streamingalgorithm.h:140
std::string fullName() const
const Algorithm * parent() const
Definition: connector.h:53
virtual int availableForWrite(bool contiguous=true) const =0
Definition: sinkbase.h:52
Definition: sourcebase.h:52
virtual BufferInfo bufferInfo() const =0
std::vector< SinkBase * > _sinks
Definition: sourcebase.h:54
virtual void setBufferType(BufferUsage::BufferUsageType type)=0
virtual int totalProduced() const =0
virtual void setBufferInfo(const BufferInfo &info)=0
void attachProxy(SourceProxyBase *sproxy)
virtual void disconnect(SinkBase &sink)
void detachProxy(SourceProxyBase *sproxy)
virtual void connect(SinkBase &sink)
virtual void * buffer()=0
Definition: sourceproxy.h:37
SourceProxyBase(const std::string &name)
Definition: sourceproxy.h:45
virtual bool acquire(int n)
Definition: sourceproxy.h:88
void attach(SourceBase *source)
Definition: sourceproxy.h:142
void release()
Definition: sourceproxy.h:99
SourceBase * _proxiedSource
Definition: sourceproxy.h:39
virtual void setBufferType(BufferUsage::BufferUsageType type)
Definition: sourceproxy.h:71
SourceProxyBase(Algorithm *parent=0, const std::string &name="unnamed")
Definition: sourceproxy.h:42
void detach(SourceBase *source)
Definition: sourceproxy.h:159
virtual BufferInfo bufferInfo() const
Definition: sourceproxy.h:75
~SourceProxyBase()
Definition: sourceproxy.h:47
SourceBase * proxiedSource()
Definition: sourceproxy.h:52
virtual void setBufferInfo(const BufferInfo &info)
Definition: sourceproxy.h:79
virtual int releaseSize() const
Definition: sourceproxy.h:105
void detach()
Definition: sourceproxy.h:115
const void * buffer() const
Definition: sourceproxy.h:57
void * buffer()
Definition: sourceproxy.h:64
virtual int acquireSize() const
Definition: sourceproxy.h:92
virtual void disconnect(SinkBase &sink)
Definition: sourceproxy.h:129
virtual void release(int n)
Definition: sourceproxy.h:101
virtual void connect(SinkBase &sink)
Definition: sourceproxy.h:119
void acquire()
Definition: sourceproxy.h:86
Definition: sourceproxy.h:175
void removeReader(ReaderID id)
Definition: sourceproxy.h:209
MultiRateBuffer< TokenType > & typedBuffer()
Definition: sourceproxy.h:197
virtual int available() const
Definition: sourceproxy.h:224
const MultiRateBuffer< TokenType > & typedBuffer() const
Definition: sourceproxy.h:193
SourceProxy(const std::string &name)
Definition: sourceproxy.h:183
virtual void reset()
Definition: sourceproxy.h:235
int totalProduced() const
Definition: sourceproxy.h:228
SourceProxy(Algorithm *parent=0, const std::string &name="unnamed")
Definition: sourceproxy.h:180
ReaderID addReader()
Definition: sourceproxy.h:204
virtual void * getFirstToken()
Definition: sourceproxy.h:218
virtual void * getTokens()
Definition: sourceproxy.h:213
~SourceProxy()
Definition: sourceproxy.h:185
void release()
Definition: streamconnector.h:59
bool acquire()
Definition: streamconnector.h:49
virtual int releaseSize() const
Definition: streamconnector.h:74
virtual int acquireSize() const
Definition: streamconnector.h:69
#define E_DEBUG(module, msg)
Definition: debugging.h:157
#define E_WARNING(msg)
Definition: debugging.h:164
BufferUsageType
Definition: types.h:436
void detach(SinkProxyBase &proxy, SinkBase &innerSink)
Definition: sinkproxy.h:257
void operator>>(SourceBase &source, DevNullConnector devnull)
Definition: devnull.h:81
void attach(SinkProxyBase &proxy, SinkBase &innerSink)
Definition: sinkproxy.h:239
Definition: algorithm.h:28
bool sameType(const std::type_info &t1, const std::type_info &t2)
Definition: types.h:260
std::string nameOfType(const std::type_info &type)
int ReaderID
Definition: types.h:344
@ EMemory
Definition: debugging.h:48
@ EConnectors
Definition: debugging.h:43
#define USE_TYPE_INFO(TokenType)
Definition: types.h:332