-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathRelCacheTable.h
More file actions
45 lines (36 loc) · 1.11 KB
/
RelCacheTable.h
File metadata and controls
45 lines (36 loc) · 1.11 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
#ifndef NITCBASE_RELCACHETABLE_H
#define NITCBASE_RELCACHETABLE_H
#include "../Buffer/BlockBuffer.h"
#include "../define/constants.h"
#include "../define/id.h"
typedef struct RelCatEntry {
char relName[ATTR_SIZE];
int numAttrs;
int numRecs;
int firstBlk;
int lastBlk;
int numSlotsPerBlk;
} RelCatEntry;
typedef struct RelCacheEntry {
RelCatEntry relCatEntry;
bool dirty;
RecId recId;
RecId searchIndex;
} RelCacheEntry;
class RelCacheTable {
friend class OpenRelTable;
public:
// methods
static int getRelCatEntry(int relId, RelCatEntry *relCatBuf);
static int setRelCatEntry(int relId, RelCatEntry *relCatBuf);
static int getSearchIndex(int relId, RecId *searchIndex);
static int setSearchIndex(int relId, RecId *searchIndex);
static int resetSearchIndex(int relId);
private:
// field
static RelCacheEntry *relCache[MAX_OPEN];
// methods
static void recordToRelCatEntry(union Attribute record[RELCAT_NO_ATTRS], RelCatEntry *relCatEntry);
static void relCatEntryToRecord(RelCatEntry *relCatEntry, union Attribute record[RELCAT_NO_ATTRS]);
};
#endif // NITCBASE_RELCACHETABLE_H