Fabcoin Core  0.16.2
P2P Digital Currency
Public Member Functions | List of all members
Multichannel< T > Class Template Referenceabstract

Multiple channels support for custom signal processing. More...

#include <simple.h>

Inheritance diagram for Multichannel< T >:
[legend]
Collaboration diagram for Multichannel< T >:
[legend]

Public Member Functions

bool Flush (bool hardFlush, int propagation=-1, bool blocking=true)
 Flush buffered input and/or output, with signal propagation. More...
 
bool MessageSeriesEnd (int propagation=-1, bool blocking=true)
 Marks the end of a series of messages, with signal propagation. More...
 
byteCreatePutSpace (size_t &size)
 Request space which can be written into by the caller. More...
 
size_t Put2 (const byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes for processing. More...
 
size_t PutModifiable2 (byte *inString, size_t length, int messageEnd, bool blocking)
 Input multiple bytes that may be modified by callee. More...
 
byteChannelCreatePutSpace (const std::string &channel, size_t &size)
 
bool ChannelPutModifiable (const std::string &channel, byte *inString, size_t length)
 
virtual size_t ChannelPut2 (const std::string &channel, const byte *begin, size_t length, int messageEnd, bool blocking)=0
 
size_t ChannelPutModifiable2 (const std::string &channel, byte *begin, size_t length, int messageEnd, bool blocking)
 
virtual bool ChannelFlush (const std::string &channel, bool hardFlush, int propagation=-1, bool blocking=true)=0
 
SIGNALS

Detailed Description

template<class T>
class Multichannel< T >

Multiple channels support for custom signal processing.

Template Parameters
Tthe class or type

T should be a BufferedTransformation derived class

Definition at line 215 of file simple.h.

Member Function Documentation

template<class T>
byte* Multichannel< T >::ChannelCreatePutSpace ( const std::string &  channel,
size_t &  size 
)
inline

Definition at line 264 of file simple.h.

template<class T>
virtual bool Multichannel< T >::ChannelFlush ( const std::string &  channel,
bool  hardFlush,
int  propagation = -1,
bool  blocking = true 
)
pure virtual
template<class T>
virtual size_t Multichannel< T >::ChannelPut2 ( const std::string &  channel,
const byte begin,
size_t  length,
int  messageEnd,
bool  blocking 
)
pure virtual
template<class T>
bool Multichannel< T >::ChannelPutModifiable ( const std::string &  channel,
byte inString,
size_t  length 
)
inline

Definition at line 266 of file simple.h.

template<class T>
size_t Multichannel< T >::ChannelPutModifiable2 ( const std::string &  channel,
byte begin,
size_t  length,
int  messageEnd,
bool  blocking 
)
inline

Definition at line 270 of file simple.h.

template<class T>
byte* Multichannel< T >::CreatePutSpace ( size_t &  size)
inline

Request space which can be written into by the caller.

Parameters
sizethe requested size of the buffer

The purpose of this method is to help avoid extra memory allocations.

size is an IN and OUT parameter and used as a hint. When the call is made, size is the requested size of the buffer. When the call returns, size is the size of the array returned to the caller.

The base class implementation sets size to 0 and returns NULL.

Note
Some objects, like ArraySink, cannot create a space because its fixed. In the case of an ArraySink, the pointer to the array is returned and the size is remaining size.

Definition at line 241 of file simple.h.

template<class T>
bool Multichannel< T >::Flush ( bool  hardFlush,
int  propagation = -1,
bool  blocking = true 
)
inlinevirtual

Flush buffered input and/or output, with signal propagation.

Parameters
hardFlushis used to indicate whether all data should be flushed
propagationthe number of attached transformations the Flush() signal should be passed
blockingspecifies whether the object should block when processing input

propagation count includes this object. Setting propagation to 1 means this object only. Setting propagation to -1 means unlimited propagation.

Note
Hard flushes must be used with care. It means try to process and output everything, even if there may not be enough data to complete the action. For example, hard flushing a HexDecoder would cause an error if you do it after inputing an odd number of hex encoded characters.
For some types of filters, like ZlibDecompressor, hard flushes can only be done at "synchronization points". These synchronization points are positions in the data stream that are created by hard flushes on the corresponding reverse filters, in this example ZlibCompressor. This is useful when zlib compressed data is moved across a network in packets and compression state is preserved across packets, as in the SSH2 protocol.

Implements CustomFlushPropagation< T >.

Definition at line 218 of file simple.h.

template<class T>
bool Multichannel< T >::MessageSeriesEnd ( int  propagation = -1,
bool  blocking = true 
)
inline

Marks the end of a series of messages, with signal propagation.

Parameters
propagationthe number of attached transformations the MessageSeriesEnd() signal should be passed
blockingspecifies whether the object should block when processing input

Each object that receives the signal will perform its processing, decrement propagation, and then pass the signal on to attached transformations if the value is not 0.

propagation count includes this object. Setting propagation to 1 means this object only. Setting propagation to -1 means unlimited propagation.

Note
There should be a MessageEnd() immediately before MessageSeriesEnd().

Definition at line 229 of file simple.h.

template<class T>
size_t Multichannel< T >::Put2 ( const byte inString,
size_t  length,
int  messageEnd,
bool  blocking 
)
inline

Input multiple bytes for processing.

Parameters
inStringthe byte buffer to process
lengththe size of the string, in bytes
messageEndmeans how many filters to signal MessageEnd() to, including this one
blockingspecifies whether the object should block when processing input

Derived classes must implement Put2().

Definition at line 250 of file simple.h.

template<class T>
size_t Multichannel< T >::PutModifiable2 ( byte inString,
size_t  length,
int  messageEnd,
bool  blocking 
)
inline

Input multiple bytes that may be modified by callee.

Parameters
inStringthe byte buffer to process.
lengththe size of the string, in bytes.
messageEndmeans how many filters to signal MessageEnd() to, including this one.
blockingspecifies whether the object should block when processing input.

Internally, PutModifiable2() calls Put2().

Definition at line 259 of file simple.h.


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