BIE::RecordBuffer Class Reference

Holds buffers for each field in a record type. More...

#include <RecordBuffer.h>

Inheritance diagram for BIE::RecordBuffer:
Collaboration diagram for BIE::RecordBuffer:

List of all members.

Public Member Functions

 RecordBuffer ()
 Creates an empty RecordBuffer.
 RecordBuffer (RecordType *rt)
 Creates a RecordBuffer object with the specified record type.
 ~RecordBuffer ()
 Destructor: Cleans up the allocated memory.
RecordBufferdeleteField (string fieldname)
 Delete a field specified by name and inherit all other buffers.
RecordBufferdeleteField (int fieldindex)
 Delete a field specified by field index and inherit all other buffers.
RecordBufferdeleteRange (int startfield, int endfield)
 Delete a range of fields & inherit all other buffers.
RecordBufferinsertField (int position, string name, BasicType *type)
 Insert a new field.
RecordBufferinsertRecord (int position, RecordBuffer *insertRecord)
 Inserts a new RECORD buffer.
RecordBufferselectFields (RecordType *selection)
 Creates a new buffer containing only the fields specified by the type descriptor.
RecordBufferselectFields (vector< int > *selection)
 Creates a new buffer containing only the fields specified by the field indices.
RecordBufferselectFields (vector< string > *selection)
 Creates a new buffer containing only the fields specified by the field names.
RecordBufferrenameField (string oldname, string newname)
 Renames the field specified by the first argument to the name given by the second argument.
RecordBufferrenameField (int fieldindex, string newname)
 Renames the field specified by the first argument to the name given by the second argument.
RecordBuffermoveField (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.
RecordBuffermoveField (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.
TypedBuffergetFieldBuffer (int fieldindex)
 Returns the buffer of the field (specified by field index).
TypedBuffergetFieldBuffer (string fieldname)
 Returns the buffer of the field (specified by field name).
bool hasValue (string fieldname)
 The returns true if the field specified by name contains a value.
bool hasValue (int fieldindex)
 The returns true if the field specified by index contains a value.
bool hasValue ()
 Returns true if ALL fields have a value.
void reset ()
 Forgets all values the buffer may be holding.
int getFieldIndex (string fieldname)
 Get the field number from a field name.
string getFieldName (int fieldindex)
 Get the name of a field from a field number.
bool isValidFieldIndex (int fieldindex)
 Says whether the field index is legal for this type.
bool isValidFieldName (string fieldname)
 Says whether a field with this name exists in the type.
BasicTypegetFieldType (int fieldindex)
 Get the type of a field specified by number.
BasicTypegetFieldType (string fieldindex)
 Get the type of a field specified by name.
int numFields ()
 Returns the total number of fields in the type.
string toString ()
 Returns a string representation of the type.
RecordTypegetType ()
 Returns the record type descriptor.
Value retrieving methods.
These methods return the value contained in the buffer.

The type of the field must match the type required by the method and the buffer must have a value.

string getStringValue (int fieldindex)
int getIntValue (int fieldindex)
double getRealValue (int fieldindex)
bool getBoolValue (int fieldindex)
string getStringValue (string fieldname)
int getIntValue (string fieldname)
double getRealValue (string fieldname)
bool getBoolValue (string fieldname)
vector< int > getIntArrayValue (int fieldindex)
vector< double > getRealArrayValue (int fieldindex)
vector< bool > getBoolArrayValue (int fieldindex)
Value setting methods.
These methods are used to set the value of a field.

The type of the field must match the type required by the method.

void setStringValue (int fieldindex, string value)
void setIntValue (int fieldindex, int value)
void setRealValue (int fieldindex, double value)
void setBoolValue (int fieldindex, bool value)
void setStringValue (string fieldname, string value)
void setIntValue (string fieldname, int value)
void setRealValue (string fieldname, double value)
void setBoolValue (string fieldname, bool value)
void setIntArrayValue (int fieldindex, vector< int >)
void setRealArrayValue (int fieldindex, vector< double >)
void setBoolArrayValue (int fieldindex, vector< bool >)

Friends

class boost::serialization::access


Detailed Description

Holds buffers for each field in a record type.

Todo:
The destructor should eventually delete the typed buffers, but this will require a way of determining whether everyone else has finished using a typed buffer. The typed buffers are generally small so this is not crucial.

Member Function Documentation

RecordBuffer* BIE::RecordBuffer::insertField ( int  position,
string  name,
BasicType type 
)

Insert a new field.

A new TypedBuffer with the specified type is created and all others are inherited. This method can be used to append fields by inserting at position (n+1). The name must not be present already.

RecordBuffer* BIE::RecordBuffer::insertRecord ( int  position,
RecordBuffer insertRecord 
)

Inserts a new RECORD buffer.

Typed buffers from both record buffers are inherited. Can be used to append fields by inserting at position (n+1). None of the names in the record type being inserted can be present already.

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

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

All the fields in the type descriptor must be present for this call to succeed. Both field name and field type must match.

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

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

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

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

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

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

RecordBuffer* BIE::RecordBuffer::renameField ( string  oldname,
string  newname 
)

Renames the field specified by the first argument to the name given by the second argument.

RecordBuffer* BIE::RecordBuffer::renameField ( int  fieldindex,
string  newname 
)

Renames the field specified by the first argument to the name given by the second argument.

RecordBuffer* BIE::RecordBuffer::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.

RecordBuffer* BIE::RecordBuffer::moveField ( 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.


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:12 2010 by doxygen