SwatDB
Loading...
Searching...
No Matches
file.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_FILE_H_
11#define _SWATDB_FILE_H_
12
17#include <string>
18#include <vector>
19#include "swatdb_types.h"
20
21// too many circular includes
22class Catalog;
23class BufferManager;
24
25/* The class heirarchy:
26 *
27 * File
28 * / \
29 *
30 * RelationFile IndexFile
31 *
32 * / \ / \
33 * HeapFile Sorted File BTreeIndex HashIndex
34 * (not impl) (not impl)
35 */
36
44// TODO: not fully implemented
45class File {
46
47 friend class Catalog;
48 friend class FileManager;
49
50 public:
51
66
72 virtual ~File();
73
78 virtual void createHeader() = 0;
79
84 virtual void flushHeader() = 0;
85
92
98 virtual void printFile();
99
100 // TODO add this method: maybe protected with Catalog friend
101 // void setMyFID(FileId *file_id);
102
103
113
114 protected:
115
120
125
130
135
155
156
157};
158
159#endif
Definition bufmgr.h:121
Definition catalog.h:161
Definition filemgr.h:32
Definition file.h:45
virtual ~File()
Destructor. Data members are cleaned up, but none of the dynamically allocated data members are delet...
Catalog * catalog
Definition file.h:124
PageId header_id
Definition file.h:134
FileId file_id
Definition file.h:119
File(Catalog *catalog, BufferManager *buf_mgr)
Constructor. Initializes common state associated with every file, including catalog,...
virtual void flushHeader()=0
Flushes Header Page to disk. Is a virtual method to be overridden at each derived class.
virtual void printFile()
Prints out information and/or the contents of the file. Can be overwritten in derived classes....
virtual void createHeader()=0
Allocates and initializes the header. Is a virtual method to be overridden at each derived class.
BufferManager * buf_mgr
Definition file.h:129
FileId getFileId()
Returns the FileId of the File.
PageId getHeaderId()
Returns Header PageId.
void _setFileId(FileId file_id)
Sets the file_id and the schema fields of this File.
Definition swatdb_types.h:54
std::uint32_t FileId
Definition swatdb_types.h:33