SwatDB
Loading...
Searching...
No Matches
relationfile.h
Go to the documentation of this file.
1/*
2 * SwatDB
3 *
4 * @authors: See Contributors.doc for code contributors
5 *
6 * Copyright (c) 2020 Swarthmore College Computer Science Department
7 * Swarthmore PA, Professors Tia Newhall, Ameet Soni
8 */
9
10#ifndef _SWATDB_RELATIONFILE_H_
11#define _SWATDB_RELATIONFILE_H_
12
13
18#include "file.h" //for inheritance
19
20class Schema;
21class Record;
22
32class RelationFile : public File {
33
34 friend class Catalog;
35 friend class FileManager;
36
37 public:
53
59 virtual ~RelationFile(){}
60
64 virtual std::uint32_t getNumPages() { return 0; }
65
70 virtual std::uint64_t getNumRecords() { return 0; }
71
78
82 virtual RecordId insertRecord(Record record) = 0;
83
87 virtual void getRecord(RecordId record_id, Record* record) = 0;
88
92 virtual void updateRecord(RecordId record_id, Record record) = 0;
93
97 virtual void deleteRecord(RecordId record_id) = 0;
98
99 protected:
106
107};
108
109#endif
Definition bufmgr.h:121
Definition catalog.h:161
Definition filemgr.h:32
Definition file.h:45
Catalog * catalog
Definition file.h:124
BufferManager * buf_mgr
Definition file.h:129
Definition record.h:34
Definition relationfile.h:32
virtual std::uint64_t getNumRecords()
virtual function that returns the number of records in the file
Definition relationfile.h:70
virtual void getRecord(RecordId record_id, Record *record)=0
Virtual method for getting record of the given RecordId.
virtual ~RelationFile()
Destructor. Data members are cleaned up, but none of the dynamically allocated data members are delet...
Definition relationfile.h:59
Schema * getSchema()
Returns the schema of the File.
virtual void deleteRecord(RecordId record_id)=0
Virtual method for deleting record of the given RecordId.
RelationFile(Catalog *catalog, BufferManager *buf_mgr, Schema *schema)
Constructor. Initializes common state associated with every file, including catalog,...
virtual std::uint32_t getNumPages()
virtual function that returns the number of pages in the file
Definition relationfile.h:64
virtual void updateRecord(RecordId record_id, Record record)=0
Virtual method for updating record of the given RecordId.
Schema * schema
Definition relationfile.h:105
virtual RecordId insertRecord(Record record)=0
Virtual method for inserting a Record into the RelationFile.
Definition schema.h:37
Definition swatdb_types.h:70