SwatDB
Loading...
Searching...
No Matches
include
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
22
class
Catalog
;
23
class
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
45
class
File
{
46
47
friend
class
Catalog
;
48
friend
class
FileManager
;
49
50
public
:
51
65
File
(
Catalog
*
catalog
,
BufferManager
*
buf_mgr
);
66
72
virtual
~File
();
73
78
virtual
void
createHeader
() = 0;
79
84
virtual
void
flushHeader
() = 0;
85
91
FileId
getFileId
();
92
98
virtual
void
printFile
();
99
100
// TODO add this method: maybe protected with Catalog friend
101
// void setMyFID(FileId *file_id);
102
103
112
PageId
getHeaderId
();
113
114
protected
:
115
119
FileId
file_id
;
120
124
Catalog
*
catalog
;
125
129
BufferManager
*
buf_mgr
;
130
134
PageId
header_id
;
135
154
void
_setFileId
(
FileId
file_id
);
155
156
157
};
158
159
#endif
BufferManager
Definition
bufmgr.h:121
Catalog
Definition
catalog.h:161
FileManager
Definition
filemgr.h:32
File
Definition
file.h:45
File::~File
virtual ~File()
Destructor. Data members are cleaned up, but none of the dynamically allocated data members are delet...
File::catalog
Catalog * catalog
Definition
file.h:124
File::header_id
PageId header_id
Definition
file.h:134
File::file_id
FileId file_id
Definition
file.h:119
File::File
File(Catalog *catalog, BufferManager *buf_mgr)
Constructor. Initializes common state associated with every file, including catalog,...
File::flushHeader
virtual void flushHeader()=0
Flushes Header Page to disk. Is a virtual method to be overridden at each derived class.
File::printFile
virtual void printFile()
Prints out information and/or the contents of the file. Can be overwritten in derived classes....
File::createHeader
virtual void createHeader()=0
Allocates and initializes the header. Is a virtual method to be overridden at each derived class.
File::buf_mgr
BufferManager * buf_mgr
Definition
file.h:129
File::getFileId
FileId getFileId()
Returns the FileId of the File.
File::getHeaderId
PageId getHeaderId()
Returns Header PageId.
File::_setFileId
void _setFileId(FileId file_id)
Sets the file_id and the schema fields of this File.
PageId
Definition
swatdb_types.h:54
swatdb_types.h
FileId
std::uint32_t FileId
Definition
swatdb_types.h:33
Generated by
1.9.8