SwatDB
Public Member Functions | Private Attributes | List of all members
Record Class Reference

#include <record.h>

Collaboration diagram for Record:
Collaboration graph
[legend]

Public Member Functions

 Record ()
 Default constructor. Sets schema and record_data to nullptr.
 
 Record (Schema *schema, Data *record_data)
 Constructor given appropriate Data* and Schema*. More...
 
 ~Record ()
 Destructor. More...
 
SchemagetSchema ()
 Getter function for schema. More...
 
DatagetRecordData ()
 Getter for record_data. More...
 
void setSchema (Schema *new_schema)
 Setter for schema. More...
 
void setRecordData (Data *new_data)
 Setter for record_data. More...
 
std::int32_t compare (Record other)
 Compare function for comparing 2 records. More...
 

Private Attributes

Schemaschema
 
Datarecord_data
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Record()

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
schemaSchema* of the Record.
record_dataData* record_data that stores the Record data.

◆ ~Record()

Record::~Record ( )
inline

Destructor.

Precondition
None.
Postcondition
Neither schema nor record_data is deleted. Both data members have to be deallocated manually by the user.

Member Function Documentation

◆ compare()

std::int32_t Record::compare ( Record  other)

Compare function for comparing 2 records.

Precondition
Valid Record object is provided as input.
Postcondition
If the schemas are different, -1 is returned. If the record_data of the two records do not have the same size or do not have the identical array up to first size number of bytes, -1 is returned. Else, 0 is returned.
Parameters
otherThe Record to be compared to.
Returns
-1 if the two records are not the same. 0 if the two records are the same.

◆ 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.

◆ setRecordData()

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_dataNew Data* schema is set to.

◆ 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_schemaNew Schema* schema is set to.

Member Data Documentation

◆ 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* Record::schema
private

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: