-
Notifications
You must be signed in to change notification settings - Fork 0
/
Schema.h
69 lines (46 loc) · 1.36 KB
/
Schema.h
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
#ifndef SCHEMA_H
#define SCHEMA_H
#include <stdio.h>
#include <string>
#include "Record.h"
#include "Schema.h"
#include "File.h"
#include "Comparison.h"
#include "ComparisonEngine.h"
#include "Defs.h"
using namespace std;
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:
string schemaName = "";
// 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 (const char *fName, const char *relName);
// this composes a schema instance in-memory
Schema (char *fName, int num_atts, Attribute *atts);
// 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);
string getfileName();
~Schema ();
};
#endif