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
72// @@@@ SWATDB_ASSIGNMENT: NOTEMSG Do not modify this class definition
73
74class Operation {
75
76 public:
77
87 Operation(FileId result_id, Catalog *catalog);
88
93 virtual ~Operation();
94
106 virtual void runOperation() = 0;
107
108
109 protected:
110
122 void _initState(FileId file_id,
123 std::vector<FieldId> fields, fileState *state);
124
125
133 void _delState(fileState *file_state);
134
135
136 /*
137 * fileState struct for the result file
138 */
139 fileState result_state;
140
141
142 /*
143 * Catalog for SwatDB
144 */
145 Catalog *catalog;
146
147};
148
149#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:74
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:40
Record * rec
Definition operation.h:56
FileId fid
Definition operation.h:48
Key * key
Definition operation.h:64
Schema * schema
Definition operation.h:52
RecordId rid
Definition operation.h:60
File * file
Definition operation.h:44
std::uint32_t FileId
Definition swatdb_types.h:33