Multiple channels support for custom signal processing.
More...
#include <simple.h>
|
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...
|
|
byte * | CreatePutSpace (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...
|
|
byte * | ChannelCreatePutSpace (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 |
|
|
template<class T>
class Multichannel< T >
Multiple channels support for custom signal processing.
- Template Parameters
-
T should be a BufferedTransformation derived class
Definition at line 215 of file simple.h.
template<class T>
byte* Multichannel< T >::ChannelCreatePutSpace |
( |
const std::string & |
channel, |
|
|
size_t & |
size |
|
) |
| |
|
inline |
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 |
template<class T>
size_t Multichannel< T >::ChannelPutModifiable2 |
( |
const std::string & |
channel, |
|
|
byte * |
begin, |
|
|
size_t |
length, |
|
|
int |
messageEnd, |
|
|
bool |
blocking |
|
) |
| |
|
inline |
Request space which can be written into by the caller.
- Parameters
-
size | the 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
-
hardFlush | is used to indicate whether all data should be flushed |
propagation | the number of attached transformations the Flush() signal should be passed |
blocking | specifies 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
-
propagation | the number of attached transformations the MessageSeriesEnd() signal should be passed |
blocking | specifies 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
-
inString | the byte buffer to process |
length | the size of the string, in bytes |
messageEnd | means how many filters to signal MessageEnd() to, including this one |
blocking | specifies 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
-
inString | the byte buffer to process. |
length | the size of the string, in bytes. |
messageEnd | means how many filters to signal MessageEnd() to, including this one. |
blocking | specifies 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: