16 #ifndef DABC_ModuleAsync
17 #define DABC_ModuleAsync
77 {
return Send(0, buf); }
81 {
return indx <
fInputs.size() ?
fInputs[indx]->CanRecv() :
false; }
85 {
return indx <
fInputs.size() ?
fInputs[indx]->NumCanRecv() : 0; }
89 {
return indx <
fInputs.size() ?
fInputs[indx]->TotalSizeCanRecv() : 0; }
110 {
return indx <
fInputs.size() ?
fInputs[indx]->SkipBuffers(nbuf) :
false; }
114 {
return pool <
fPools.size() ?
fPools[pool]->CanTakeBuffer() :
false; }
119 {
return pool <
fPools.size() ?
fPools[pool]->NumCanTake() : 0; }
190 virtual const char*
ClassName()
const {
return "ModuleAsync"; }
#define DABC_REFERENCE(RefClass, ParentClass, T)
Reference on memory from memory pool.
Represents command with its arguments.
Reference on dabc::ModuleAsync class
Base class for user-derived code, implementing event-processing.
BufferSize_t TotalSizeCanRecv(unsigned indx=0) const
Method return total size of buffers can be received via the port.
unsigned NumCanTake(unsigned pool=0) const
Method return number of buffers which could be taken from data queue assigned with the pool.
void ActivatePool(unsigned pool)
Produces event for specified pool handle.
ModuleAsync(const std::string &name, Command cmd=nullptr)
Constructor of ModuleAsync class.
virtual void ProcessPoolEvent(unsigned pool)
Method called by framework when pool event is produced.
bool RecvQueueFull(unsigned port=0)
Returns true if receive queue is full and block input.
Buffer RecvQueueItem(unsigned port=0, unsigned nbuf=0)
Returns buffer from receive queue of the input port.
virtual void ProcessOutputEvent(unsigned port)
Method called by framework when output event is produced.
bool CanRecv(unsigned indx=0) const
Method return true if recv from specified port can be done.
void ActivateInput(unsigned port=0)
Produces event for specified input port Should be used when processing was stopped due to return fals...
void SignalRecvWhenFull(unsigned port=0)
Let input signal only when queue is full.
bool SkipInputBuffers(unsigned indx=0, unsigned nbuf=1)
Remove items in input queue.
virtual ~ModuleAsync()
Destructor of ModuleAsync class.
virtual const char * ClassName() const
Returns class name of the object.
virtual void ProcessItemEvent(ModuleItem *item, uint16_t evid)
Generic event processing method [internal].
bool Send(unsigned indx, Buffer &buf)
Methods to send buffer via specified output port.
bool CanTakeBuffer(unsigned pool=0)
Returns true if memory pool can provide buffer.
virtual bool DoStart()
Activate module [internal].
unsigned NumCanSend(unsigned indx=0) const
Method return number of send operation can be done for specified port.
virtual void ProcessConnectEvent(const std::string &name, bool on)
Method called by framework when connection state of the item is changed.
Buffer PoolQueueItem(unsigned pool=0, unsigned nbuf=0)
Returns buffer from queue assigned with the pool.
virtual bool ProcessSend(unsigned port=0)
Method called by framework when at least one buffer can be send to output port.
bool Send(Buffer &buf)
Send buffer over first output port.
virtual bool ProcessBuffer(unsigned pool=0)
Method called by framework when at least one buffer available in pool handle.
void ActivateOutput(unsigned port=0)
Produces event for specified output port.
virtual void ProcessUserEvent(unsigned item)
Method called by framework when custom user event is produced.
virtual void ProcessTimerEvent(unsigned timer)
Method called by framework when timer event is produced.
unsigned NumCanRecv(unsigned indx=0) const
Method return number of buffers which can be received via the port.
virtual void ProcessInputEvent(unsigned port)
Method called by framework when input event is produced.
Buffer TakeBuffer(unsigned pool=0)
Take buffer from memory pool.
Buffer Recv(unsigned indx=0)
Methods receives buffers from the port.
virtual bool ProcessRecv(unsigned port=0)
Method called by framework when at least one buffer available in input port.
bool CanSend(unsigned indx=0) const
Method return true if send over specified port can be done.
Base class for module items like ports, timers, pool handles.
Reference on dabc::Module class
Base for dabc::ModuleSync and dabc::ModuleAsync classes.
std::vector< OutputPort * > fOutputs
array of output ports
std::vector< InputPort * > fInputs
array of input ports
std::vector< PoolHandle * > fPools
array of pools
void Release()
Releases reference on the object.