-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInode.hpp
More file actions
103 lines (86 loc) · 2.36 KB
/
Inode.hpp
File metadata and controls
103 lines (86 loc) · 2.36 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef SEMESTRALNIPRACE_INODE_HPP
#define SEMESTRALNIPRACE_INODE_HPP
#include <cstdint>
#include <stdexcept>
/**
* Class representing an inode
*/
class Inode {
public:
/**
* Default constructor for inode class
*/
Inode() = default;
/**
* Gets the node id of the inode
* @return node id of the inode
*/
int32_t getNodeId() const;
/**
* Sets the node id of the inode
* @param nodeId - new node id
*/
void setNodeId(int32_t nodeId);
/**
* Gets the directory flag
* @return directory flag
*/
bool getIsDirectory() const;
/**
* Sets the directory flag
* @param isDirectory - new value of the directory flag
*/
void setIsDirectory(bool isDirectory);
/**
* Gets the references count
* @return references count
*/
int8_t getReferences() const;
/**
* Sets the references count
* @param references - new value of the references count
*/
void setReferences(int8_t references);
/**
* Gets the file size
* @return file size
*/
int32_t getFileSize() const;
/**
* Sets the file size
* @param fileSize - new file size
*/
void setFileSize(int32_t fileSize);
/**
* Gets the direct pointer at the given index, if the index is valid (0-4)
* @param index - index of the direct pointer
* @return direct pointer at the given index
*/
int32_t getDirect(int index) const;
/**
* Sets the direct pointer at the given index, if the index is valid (0-4)
* @param index - index of the direct pointer
* @param value - new value of the direct pointer
*/
void setDirect(int index, int32_t value);
/**
* Gets the indirect pointer at the given index, if the index is valid (0-1)
* @param index - index of the indirect pointer
* @return indirect pointer at the given index
*/
int32_t getIndirect(int index) const;
/**
* Sets the indirect pointer at the given index, if the index is valid (0-1)
* @param index - index of the indirect pointer
* @param value - new value of the indirect pointer
*/
void setIndirect(int index, int32_t value);
private:
int32_t nodeId;
bool isDirectory;
int8_t references;
int32_t fileSize;
int32_t direct[5];
int32_t indirect[2];
};
#endif //SEMESTRALNIPRACE_INODE_HPP