Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

ConverterBox Class Reference

#include <ConverterBox.h>

Inherited by SimpleConverterBox.

List of all members.


Detailed Description

Converts data received on a network port to tuples on a single stream.

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< StreamgetStream ()
 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.


Constructor & Destructor Documentation

ConverterBox::ConverterBox TupleDescription  schema  )  [protected]
 

Create a converter box that generates tuples with a given schema.

ConverterBox::~ConverterBox  )  [virtual]
 

Destructor.


Member Function Documentation

TupleDescription ConverterBox::getSchema  )  const
 

Returns the schema describing tuples generated by this converter box.

(This is the schema provided to the constructor.)

ptr<Stream> ConverterBox::getStream  ) 
 

Returns the stream that will receive data generated by this converter box.

virtual unsigned int ConverterBox::handleData constbuf  input  )  throw (AuroraException) [pure virtual]
 

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.

Parameters:
input data to be handled by the converter box.
Returns:
the number of bytes consumed by the converter box. Any remaining bytes will be buffered and presented to the box again when more bytes arrive.

Implemented in SimpleConverterBox.

void ConverterBox::setStream ptr< Stream stream  ) 
 

Sets the stream that will receive data generated by this converter box.


The documentation for this class was generated from the following files:
Generated on Fri Nov 12 15:15:23 2004 for Borealis by doxygen 1.3.8