-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSchema.h
More file actions
85 lines (56 loc) · 1.75 KB
/
Schema.h
File metadata and controls
85 lines (56 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef SCHEMA_H
#define SCHEMA_H
#include <fstream>
#include <stdio.h>
#include <vector>
#include "Record.h"
#include "Schema.h"
#include "File.h"
#include "Comparison.h"
#include "ComparisonEngine.h"
using namespace std;
struct att_pair {
char *name;
Type type;
};
struct Attribute {
char *name;
Type myType;
};
class OrderMaker;
class Schema {
// gives the attributes in the schema
int numAtts;
Attribute *myAtts;
// gives the physical location of the binary file storing the relation
char *fileName;
friend class Record;
public:
// gets the set of attributes, but be careful with this, since it leads
// to aliasing!!!
Attribute *GetAtts();
// returns the number of attributes
int GetNumAtts();
// this finds the position of the specified attribute in the schema
// returns a -1 if the attribute is not present in the schema
int Find(char *attName);
// this finds the type of the given attribute
Type FindType(char *attName);
// this reads the specification for the schema in from a file
Schema(char *fName, char *relName);
// this composes a schema instance in-memory
Schema(char *fName, int num_atts, Attribute *atts);
// Create new Schema by merging input schemas
Schema(Schema *schema1, Schema *schema2);
Schema(OrderMaker &order);
Schema(Schema *baseSchema, NameList *nameList, vector<int> *keepMeVector);
// this constructs a sort order structure that can be used to
// place a lexicographic ordering on the records using this type of schema
int GetSortOrder(OrderMaker &order);
void AliasAttributes(std::string aliasName);
void Print();
void Write(char *fileName, char *tableName);
Schema();
~Schema();
};
#endif