mirror of
https://github.com/YuhangQ/InvoDB.git
synced 2025-01-28 23:50:59 +00:00
38 lines
885 B
C++
38 lines
885 B
C++
//
|
|
// Created by YuhangQ on 2021/10/22.
|
|
//
|
|
|
|
#ifndef INVODB_STORAGE_PAGE_H
|
|
#define INVODB_STORAGE_PAGE_H
|
|
|
|
#include <iostream>
|
|
#include <cstring>
|
|
|
|
|
|
class PageManager;
|
|
|
|
class StoragePage {
|
|
public:
|
|
void print();
|
|
int next();
|
|
void setNext(const int& nextPage);
|
|
int last();
|
|
void setLast(const int& lastPage);
|
|
void save();
|
|
int getIntStartFrom(const int &index);
|
|
void setIntStartFrom(const int &index, const int &value);
|
|
void setStringStartFrom(const int &index, const char *str);
|
|
int *intArray();
|
|
StoragePage(const int& id) { memset(page, 0, sizeof(page)); this->address = id; }
|
|
char& operator[] (int index) { return this->page[index]; }
|
|
operator const char *() const { return this->page; }
|
|
operator char *() { return this->page; }
|
|
int getAddress();
|
|
private:
|
|
char page[1024];
|
|
int address;
|
|
};
|
|
|
|
|
|
#endif //INVODB_STORAGE_PAGE_H
|