BIE::RecordOutputStream Class Reference

Record output streams are used to write a series of records to one or more sources. More...

#include <RecordOutputStream.h>

Inheritance diagram for BIE::RecordOutputStream:
Collaboration diagram for BIE::RecordOutputStream:

List of all members.

Public Member Functions

virtual ~RecordOutputStream ()
 Virtual destructor.
 RecordOutputStream (RecordType *streamtype)
 Construct a new root output stream with the given type.
virtual void pushRecord ()
 Pushes the contents of the buffer out to inheriting streams.
virtual void close ()
 Indicates the end of the stream to all inheriting streams.
RecordOutputStreamdeleteField (string fieldname)
 Create a new output stream which masks out the specified field, and inherits all other buffers.
RecordOutputStreamdeleteField (int fieldindex)
 Create a new output stream which masks out the specified field, and inherits all other buffers.
RecordOutputStreamdeleteRange (int startfield, int endfield)
 Deletes a range of fields & inherits all other buffers.
RecordOutputStreamselectFields (RecordType *selection)
 Creates a new output stream containing only the fields specified by the type descriptor.
RecordOutputStreamselectFields (vector< int > *selection)
 Creates a new output stream containing only the fields specified by the field indices.
RecordOutputStreamselectFields (vector< string > *selection)
 Creates a new stream containing only the fields specified by the field names.
RecordOutputStreamrenameField (string oldname, string newname)
 Creates a new stream with the specified field renamed.
RecordOutputStreamrenameField (int fieldindex, string newname)
 Creates a new stream with the specified field renamed.
RecordOutputStreammoveField (string fieldname, int newposition)
 Moves a field (specified by name) to a new position (specified by index) and "slides" the fields in between to fill in the vacated position.
RecordOutputStreammoveField (int oldposition, int newposition)
 Moves a field (specified by index) to a new position (specified by index) and "slides" the fields in between to fill in the vacated position.
RecordOutputStreamfilterWith (int position, RecordStreamFilter *filter)
 Pipes the input through a filter which can add new fields based on the values of the fields in the existing stream.
RecordOutputStreamfilterWith (RecordStreamFilter *filter)
 Pipes the input through a filter which can add new fields based on the values of the fields in the existing stream.
void setStringValue (int fieldindex, string value)
 Sets the value of a string field (referenced by index) in a root output stream.
void setIntValue (int fieldindex, int value)
 Sets the value of an integer field (referenced by index) in a root output stream.
void setRealValue (int fieldindex, double value)
 Sets the value of a real field (referenced by index) in a root output stream.
void setBoolValue (int fieldindex, bool value)
 Sets the value of a boolean field (referenced by index) in a root output stream.
void setStringValue (string fieldname, string value)
 Sets the value of a string field (referenced by name) in a root output stream.
void setIntValue (string fieldname, int value)
 Sets the value of an integer field (referenced by name) in a root output stream.
void setRealValue (string fieldname, double value)
 Sets the value of a real field (referenced by name) in a root output stream.
void setBoolValue (string fieldname, bool value)
 Sets the value of a boolean field (referenced by name) in a root output stream.
virtual string toString ()
 Returns a string representation of the stream.
bool isRootStream ()
 Returns true if this stream is a root stream.
bool inheritable ()
 Returns true if this stream can be inherited.
void registerForUpdates (RecordOutputStream *stream)
 This is called when another stream wants to receive updates (through pushRecord()).
void setIntArrayValue (int fieldindex, vector< int > value)
 Array field set methods.
void setRealArrayValue (int fieldindex, vector< double > value)
 Set an double vector to.
void setBoolArrayValue (int fieldindex, vector< bool > value)
 Set an bool vector to.

Static Public Member Functions

static RecordOutputStreamgetStream (int streamindex)
 Returns the stream corresponding to the given stream index.
static vector
< RecordOutputStream * > 
getInheritableStreams ()
 Returns a vector containing a pointer to all output streams that can be inherited from.

Protected Member Functions

 RecordOutputStream ()
 Constructs a new output stream with nothing set up - only used internally.

Static Protected Member Functions

static void addNewStream (RecordOutputStream *newstream)
 Called when a new stream is created.
static void removeOldStream (RecordOutputStream *oldstream)
 Called to remove a stream when it is deleted.

Protected Attributes

bool ros_isroot
 true if this is the root stream.
bool ros_inheritable
 true if this stream can be inherited.
bool ros_closed
 true if this stream has been closed.
RecordOutputStreamros_myinputstream
 A reference to the stream inherited from.


Detailed Description

Record output streams are used to write a series of records to one or more sources.

New output streams are created by inheriting an existing stream. When inherited, streams can be modified, processed by a filter, or the data can be output to a data sink (e.g. to a file or a network socket). Nodes can be inherited an unlimited number of times (with a few exceptions - see below)

As with input streams, inheriting streams creates an implicit tree structure Generally leaves are data sinks and internal nodes apply operations but this is not a strict rule. Data is pushed from the root node by the user/program to all inheriting streams - this is done by calling pushRecord() recursively (depth first).

This class implements all operations on output streams - field deletion, filtering, field selection, field renaming, etc. Subclasses implement systems to write to data sinks. If a subclass implements it, then these streams can be inherited, but a mechanism for telling when a stream cannot be inherited exists (so subclass writers are not required to always add this functionality).

TODO registerforUpdates should not be public. The class does not compile when it was protected (as it should be).


Constructor & Destructor Documentation

virtual BIE::RecordOutputStream::~RecordOutputStream (  )  [inline, virtual]

Virtual destructor.

This removes the stream from the output stream register.

Here is the call graph for this function:


Member Function Documentation

RecordOutputStream* BIE::RecordOutputStream::selectFields ( RecordType selection  ) 

Creates a new output stream containing only the fields specified by the type descriptor.

All the fields in the type descriptor must be present in the existing stream. Both field name and field type must match.

RecordOutputStream* BIE::RecordOutputStream::selectFields ( vector< int > *  selection  ) 

Creates a new output stream containing only the fields specified by the field indices.

All indices must be within the bounds of the existing stream. No duplicate indices are allowed.

RecordOutputStream* BIE::RecordOutputStream::selectFields ( vector< string > *  selection  ) 

Creates a new stream containing only the fields specified by the field names.

A NoSuchFieldException is thrown if a name is not present in the existing stream. No duplicate names are allowed.

RecordOutputStream* BIE::RecordOutputStream::moveField ( string  fieldname,
int  newposition 
)

Moves a field (specified by name) to a new position (specified by index) and "slides" the fields in between to fill in the vacated position.

RecordOutputStream* BIE::RecordOutputStream::filterWith ( int  position,
RecordStreamFilter filter 
)

Pipes the input through a filter which can add new fields based on the values of the fields in the existing stream.

The filter must be "useable".

RecordOutputStream* BIE::RecordOutputStream::filterWith ( RecordStreamFilter filter  ) 

Pipes the input through a filter which can add new fields based on the values of the fields in the existing stream.

The filter must be "useable".

void BIE::RecordOutputStream::setIntArrayValue ( int  fieldindex,
vector< int >  value 
)

Array field set methods.

Set an integer vector to

Parameters:
value at index
fieldindex 

void BIE::RecordOutputStream::setRealArrayValue ( int  fieldindex,
vector< double >  value 
)

Set an double vector to.

Parameters:
value at index
fieldindex 

void BIE::RecordOutputStream::setBoolArrayValue ( int  fieldindex,
vector< bool >  value 
)

Set an bool vector to.

Parameters:
value at index
fieldindex 

void BIE::RecordOutputStream::registerForUpdates ( RecordOutputStream stream  ) 

This is called when another stream wants to receive updates (through pushRecord()).

The stream this is called on must be inheritable.

static vector<RecordOutputStream*> BIE::RecordOutputStream::getInheritableStreams (  )  [static]

Returns a vector containing a pointer to all output streams that can be inherited from.

static void BIE::RecordOutputStream::addNewStream ( RecordOutputStream newstream  )  [static, protected]

Called when a new stream is created.

This information is used by the getAvailableStreams() function.

static void BIE::RecordOutputStream::removeOldStream ( RecordOutputStream oldstream  )  [static, protected]

Called to remove a stream when it is deleted.

Keeps a null reference in output stream list so other indices are not changed.

Here is the caller graph for this function:


Member Data Documentation

A reference to the stream inherited from.

This is used to tell how this stream gets its data.


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

Send suggestions, questions, and feedback to WEINBERG at ASTRO dot UMASS dot EDU.
Documentation generated at Fri Mar 26 00:35:13 2010 by doxygen