-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOSFS.hpp
More file actions
83 lines (64 loc) · 1.33 KB
/
Copy pathOSFS.hpp
File metadata and controls
83 lines (64 loc) · 1.33 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
#ifndef OSFS_hpp
#define OSFS_hpp
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
const int DISK_SIZE = 100;
const int FILE_SIZE = 512;
static int openBlock = -1;
static int openMode = -1;
static int cursor = -1;
class Block
{
private:
int number;
Block* frwd;
Block* back;
string name;
public:
Block();
Block(int number, string name);
~Block();
int getNumber();
void setFrwd(Block* frwd);
void setBack(Block* back);
void reset();
Block* getFrwd();
Block* getBack();
string getName();
};
class File: public Block
{
private:
char data[FILE_SIZE];
public:
File(int number, string name);
~File();
void writeFile(int& count, string& input, int& current);
void readFile(int& count, int& current);
int getEnd();
};
class Disk: public Block
{
private:
Block* sector[DISK_SIZE];
bool freeSpaceList[DISK_SIZE];
public:
Disk();
~Disk();
int index();
bool isOpen();
void display();
void count();
void create(string name);
void open(string name);
void close();
void write(int count, string input);
void helpWrite(int&count,string&input,int¤t);
void read(int count);
void seek(int base, int offset);
Block* findBlock(string name);
Block* helpCreate(string name);
};
#endif