Trading System API  3.0
Library for Simulating and Deploying Trading and Investment Strategies
tsa::record Class Reference

Class representing a database record. More...

#include <TSADBRecord.h>

Public Member Functions

 record (const record &record)
 Copy Constructor. More...
 
 record (size_t num_fields)
 Constructor. Sets record size to num_fields. Do not include the timestamp property in this number of fields as record timestamps are considered implicit to all records. is_init() will return false until a valid timestamp has been set via timstamp(). More...
 
 ~record (void)
 Destructor.
 
void clear (void)
 Sets the record's timestamp member as well as all value fields to an undefined state.
 
void operator= (fast::db_record *record)
 Copies values from given (internal) record representation. More...
 
const variantoperator[] (size_t position) const
 Returns the value stored at given position. It is up to the user to ensure that position is does not cause a bounds error. More...
 
variantoperator[] (size_t position)
 Returns a non const reference to the variant at given position. This reference can be used to update the value. More...
 
void print (std::ostream &stream)
 Prints the record to given stream. More...
 
size_t size (void) const
 Returns the size (number of fields) of the record. The timestamp property is not counted as a field! More...
 

Detailed Description

Class representing a database record.

Constructor & Destructor Documentation

tsa::record::record ( const record record)

Copy Constructor.

Parameters
recordThe other record.
tsa::record::record ( size_t  num_fields)

Constructor. Sets record size to num_fields. Do not include the timestamp property in this number of fields as record timestamps are considered implicit to all records. is_init() will return false until a valid timestamp has been set via timstamp().

Parameters
num_fieldsNumber of fields.

Member Function Documentation

void tsa::record::operator= ( fast::db_record *  record)

Copies values from given (internal) record representation.

Parameters
[in,out]recorddb_record pointer.
const variant & tsa::record::operator[] ( size_t  position) const

Returns the value stored at given position. It is up to the user to ensure that position is does not cause a bounds error.

Parameters
positionZero-based position of the value.
Returns
Constant reference to a variant object representing the value.
variant & tsa::record::operator[] ( size_t  position)

Returns a non const reference to the variant at given position. This reference can be used to update the value.

Parameters
positionZero-based index of the value.
Returns
Reference to a variant.
void tsa::record::print ( std::ostream &  stream)

Prints the record to given stream.

Parameters
[in,out]streamThe stream.
size_t tsa::record::size ( void  ) const

Returns the size (number of fields) of the record. The timestamp property is not counted as a field!

Returns
A size_t.