#include <ConverterBox.h>
Inherited by SimpleConverterBox.
There are three ways to write a converter box to handle custom-formatted data from the network. In order of decreasing generality but increasing ease of use:
Include the AURORA_DECLARE_CONVERTER_BOX(ClassName)
macro inside the class declaration for your converter box, and AURORA_DEFINE_CONVERTER_BOX(ClassName)
in the definition of your box (ClassName.C).
Once you have written a converter box, you may add a line like the following to your Aurora configuration file, to bind your converter box to a particular network port and tuple stream:
<converter-box class='StockQuoteConverterBox' port='30000' stream='stock-quotes'/>
This listens for stock quotes on port 30000, and uses StockQuoteConverterBox
to convert input records to tuples on the stock-quotes
stream.
Public Member Functions | |
virtual | ~ConverterBox () |
Destructor. | |
TupleDescription | getSchema () const |
Returns the schema describing tuples generated by this converter box. | |
virtual unsigned int | handleData (constbuf input)=0 throw (AuroraException) |
Handles incoming data to be converted. | |
void | setStream (ptr< Stream > stream) |
Sets the stream that will receive data generated by this converter box. | |
ptr< Stream > | getStream () |
Returns the stream that will receive data generated by this converter box. | |
Protected Member Functions | |
ConverterBox (TupleDescription schema) | |
Create a converter box that generates tuples with a given schema. |
|
Create a converter box that generates tuples with a given schema.
|
|
Destructor.
|
|
Returns the schema describing tuples generated by this converter box. (This is the schema provided to the constructor.) |
|
Returns the stream that will receive data generated by this converter box.
|
|
Handles incoming data to be converted. Must be implemented by the subclass; the subclass should examine the incoming bytes, and enqueue data as necessary on the stream returned by the getStream() method.
Implemented in SimpleConverterBox.
|
|
Sets the stream that will receive data generated by this converter box.
|