#include <record.h>
|
| Record () |
| Default constructor. Sets schema and record_data to nullptr.
|
|
| Record (Schema *schema) |
| Constructor given appropriate Schema*.
|
|
| Record (Schema *schema, Data *record_data) |
| Constructor given appropriate Data* and Schema*.
|
|
| ~Record () |
| Destructor.
|
|
Schema * | getSchema () |
| Getter function for schema.
|
|
Data * | getRecordData () |
| Getter for record_data.
|
|
void | setSchema (Schema *new_schema) |
| Setter for schema.
|
|
void | setRecordData (Data *new_data) |
| Setter for record_data.
|
|
void | setRecordData (std::vector< std::string > tuple_vals) |
| Setter for record_data with structured input.
|
|
std::string | getFieldData (FieldId field_id) |
| Method that returns the value of specified field in string format.
|
|
Key | getKey (SearchKeyFormat *key_format, Data *key_data) |
|
bool | compareFieldToValue (FieldId field_id, void *value, Comp comp) |
| Compare function for a record and a given value.
|
|
std::int32_t | getIntField (FieldId field_id) |
| Method that returns the int field from a record.
|
|
float | getFloatField (FieldId field_id) |
| Method that returns a float field from a record.
|
|
char * | getStringField (FieldId field_id, FieldOffset *length) |
| Method that returns a pointer to the start of the desired string field from a record.
|
|
void | combineRecords (std::vector< FieldId > field_list, Record *other_rec, Record *result_rec) |
| Method that combines two records fields into one larger method, with field_ids passed in that should be ommitted from the second record. This method is used in joins.
|
|
void | setRecordFromRecord (std::vector< FieldId > field_list, Record *result_rec) |
| Method that extracts data values from the current record and inserts the values associated with the passed in fields to the passed in result_rec. This method is similar to the setKeyFromRecord function. It is used for the project operation.
|
|
SwatDB Record Class. Record instantiates record in SwatDB. It consists of record data Data object, which is serialized in form of variable length record and Schema object, which allows appropriate access to the record data.
◆ Record() [1/2]
Record::Record |
( |
Schema * |
schema | ) |
|
Constructor given appropriate Schema*.
- Precondition
- Valid Schema* are provided as input. The schema is stored.
- Postcondition
- schema and record_data are set to the provided input.
- Parameters
-
◆ Record() [2/2]
Record::Record |
( |
Schema * |
schema, |
|
|
Data * |
record_data |
|
) |
| |
Constructor given appropriate Data* and Schema*.
- Precondition
- Valid Data* and Schema* are provided as input. The schema and the record data stored by record_data are consistent.
- Postcondition
- schema and record_data are set to the provided input.
- Parameters
-
schema | Schema* of the Record. |
record_data | Data* record_data that stores the Record data. |
◆ ~Record()
Destructor.
- Precondition
- None.
- Postcondition
- Neither schema nor record_data is deleted. Both data members have to be deallocated manually by the user.
◆ _getOffset()
helper method to calculate the offset value and field length given a field_id
- Parameters
-
FieldId | field_id position of the desired record field |
FieldOffset | *length pointer to the length of the field passed in from caller |
FieldOffset | *offset pointer to the offset passed in from caller |
- Postcondition
- offset and length are filled with the appropriate values based on field_id
◆ combineRecords()
void Record::combineRecords |
( |
std::vector< FieldId > |
field_list, |
|
|
Record * |
other_rec, |
|
|
Record * |
result_rec |
|
) |
| |
Method that combines two records fields into one larger method, with field_ids passed in that should be ommitted from the second record. This method is used in joins.
- Precondition
- Schema of resulting record is aligned with this->schema and the included fields from the passed in record.
- Postcondition
- result_rec data is filled with fields from this record data and included record's data
- Parameters
-
std::vector<FieldId> | field_list, field ids of this record that are not included in result. (so these search fields are not duplicated) |
Record | *other_rec second record to be combined with this record. |
Record | *result_rec record for combined field data to be inputted into. |
◆ compareFieldToValue()
bool Record::compareFieldToValue |
( |
FieldId |
field_id, |
|
|
void * |
value, |
|
|
Comp |
comp |
|
) |
| |
Compare function for a record and a given value.
- Precondition
- Value is the same type as the field it is being compared to
- Parameters
-
FieldId | field_id corresponding to the position of the field being compared to |
value | void*, to which the record field is being compared to |
Comp | comp specifying the type of comparison operation |
- Returns
- boolean corresponding to whether the record field satisfies the indicated comparison with the value
◆ getFieldData()
std::string Record::getFieldData |
( |
FieldId |
field_id | ) |
|
Method that returns the value of specified field in string format.
- Returns
- string equivalent of specified field value
◆ getFloatField()
float Record::getFloatField |
( |
FieldId |
field_id | ) |
|
Method that returns a float field from a record.
- Precondition
- field type of field id is FloatFieldT
- Parameters
-
FieldId | field_id corresponding to the position of the field of interest. |
- Returns
- the int value of the field
- Exceptions
-
invalid | type exception if the field type is not FloatFieldT |
◆ getIntField()
std::int32_t Record::getIntField |
( |
FieldId |
field_id | ) |
|
Method that returns the int field from a record.
- Precondition
- field type of field id is IntFieldT
- Parameters
-
FieldId | field_id corresponding to the position of the field of interest. |
- Returns
- the int value of the field
- Exceptions
-
invalid | type exception if the field type is not IntFieldT |
◆ getRecordData()
Data * Record::getRecordData |
( |
| ) |
|
Getter for record_data.
- Precondition
- None.
- Postcondition
- record_data is returned.
- Returns
- Data* to the record_data of the Record.
◆ getSchema()
Schema * Record::getSchema |
( |
| ) |
|
Getter function for schema.
- Precondition
- None.
- Postcondition
- schema is returned.
- Returns
- Schema* to the schema of the Record.
◆ getStringField()
Method that returns a pointer to the start of the desired string field from a record.
- Precondition
- field type of field id is StringFieldT
- Parameters
-
FieldId | field_id corresponding to the position of the field of interest. |
int | * that stores the length of the string being returned |
- Returns
- a char pointer to the start of a string in the record data buffer
- Exceptions
-
invalid | type exception if the field type is not StringFieldT |
◆ setRecordData() [1/2]
void Record::setRecordData |
( |
Data * |
new_data | ) |
|
Setter for record_data.
- Precondition
- Valid Data* is provided as an input.
- Postcondition
- record_data is set to new_data. The previous data is not deleted.
- Parameters
-
new_data | New Data* record_data is set to. |
◆ setRecordData() [2/2]
void Record::setRecordData |
( |
std::vector< std::string > |
tuple_vals | ) |
|
Setter for record_data with structured input.
- Precondition
- vector types match the schema
- Postcondition
- record_data is formatted with new data
- Parameters
-
tuple_vals | is a vector of variant types int, float, and string that match the types expected by the existing schema. |
◆ setRecordFromRecord()
void Record::setRecordFromRecord |
( |
std::vector< FieldId > |
field_list, |
|
|
Record * |
result_rec |
|
) |
| |
Method that extracts data values from the current record and inserts the values associated with the passed in fields to the passed in result_rec. This method is similar to the setKeyFromRecord function. It is used for the project operation.
- Postcondition
- result_rec data is filled with fields from this records data only for the fields passed in
- Parameters
-
std::vector<FieldId> | field_list, field ids of this record to be projected. |
Record | *result_rec record for projected data. |
◆ setSchema()
void Record::setSchema |
( |
Schema * |
new_schema | ) |
|
Setter for schema.
- Precondition
- Valid Schema* is provided as an input.
- Postcondition
- schema is set to new_schema. The previous schema is not deleted.
- Parameters
-
new_schema | New Schema* schema is set to. |
◆ record_data
Data* Record::record_data |
|
private |
Data of the Record. The object (not the pointer) is never modified in scope of this object.
◆ schema
Schema of the Record. The object (not the pointer) is never modified in scope of this object.
The documentation for this class was generated from the following file: