SwatDB
Loading...
Searching...
No Matches
operation.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, 2025 Swarthmore College Computer Science Department
7 * Swarthmore PA, Professors Tia Newhall, Ameet Soni
8 */
9
10#ifndef _SWATDB_OPERATION_H_
11#define _SWATDB_OPERATION_H_
12
13
18#include <string>
19#include <vector>
20#include "swatdb_types.h"
21
22class FileManager;
23class Catalog;
24class Schema;
25class File;
26class RelationFile;
27class HeapFile;
28class HeapPage;
29class Page;
30class HeapFileScanner;
31class Record;
32class Data;
33class Key;
34
35// @@@@ SWATDB_ASSIGNMENT: NOTEMSG Do not modify this struct
36
74// @@@@ SWATDB_ASSIGNMENT: NOTEMSG Do not modify this class definition
75
76class Operation {
77
78 public:
79
89 Operation(FileId result_id, Catalog *catalog);
90
95 virtual ~Operation();
96
108 virtual void runOperation() = 0;
109
110
111 protected:
126 void _initState(FileId file_id,
127 std::vector<FieldId> fields, fileState *state);
128
129
137 void _delState(fileState *file_state);
138
139
140 /*
141 * fileState struct for the result file
142 */
143 fileState result_state;
144
145
146 /*
147 * Catalog for SwatDB
148 */
149 Catalog *catalog;
150
151};
152
153#endif
Definition catalog.h:161
Definition data.h:26
Definition filemgr.h:32
Definition file.h:45
Definition heapfilescanner.h:39
Definition heapfile.h:76
Definition heappage.h:94
Definition key.h:38
Definition operation.h:76
Operation(FileId result_id, Catalog *catalog)
Constructor for the Operation class. Because Operation is an abstract class, an object cannot be crea...
void _initState(FileId file_id, std::vector< FieldId > fields, fileState *state)
Performs the file and temporary record setup for relational operators.
void _delState(fileState *file_state)
Deletes objects created in relop structs.
virtual ~Operation()
Destructor for the Operation class. Cleans up dynamic memory in result state.
virtual void runOperation()=0
Runs the operation. Other than initial setup in the initialization, all the work of each operation is...
Definition page.h:27
Definition record.h:34
Definition relationfile.h:32
Definition schema.h:37
Definition swatdb_types.h:70
Definition operation.h:42
Record * rec
Definition operation.h:58
FileId fid
Definition operation.h:50
Key * key
Definition operation.h:66
Schema * schema
Definition operation.h:54
RecordId rid
Definition operation.h:62
File * file
Definition operation.h:46
std::uint32_t FileId
Definition swatdb_types.h:33