-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInode.cpp
More file actions
69 lines (53 loc) · 1.45 KB
/
Inode.cpp
File metadata and controls
69 lines (53 loc) · 1.45 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
#include "Inode.hpp"
#include "Constants.hpp"
using std::invalid_argument;
int32_t Inode::getNodeId() const {
return nodeId;
}
void Inode::setNodeId(int32_t nodeId) {
this->nodeId = nodeId;
}
bool Inode::getIsDirectory() const {
return isDirectory;
}
void Inode::setIsDirectory(bool isDirectory) {
this->isDirectory = isDirectory;
}
int8_t Inode::getReferences() const {
return references;
}
void Inode::setReferences(int8_t references) {
this->references = references;
}
int32_t Inode::getFileSize() const {
return fileSize;
}
void Inode::setFileSize(int32_t fileSize) {
this->fileSize = fileSize;
}
int32_t Inode::getDirect(int index) const {
if (index >= 0 && index <= 4) {
return direct[index];
}
throw invalid_argument(THE_INDEX_VALUE_HAS_TO_BE_BETWEEN_0_AND_4_TEXT);
}
void Inode::setDirect(int index, int32_t value) {
if (index >= 0 && index <= 4) {
direct[index] = value;
} else {
throw invalid_argument(THE_INDEX_VALUE_HAS_TO_BE_BETWEEN_0_AND_4_TEXT);
}
}
int32_t Inode::getIndirect(int index) const {
if (index >= 0 && index <= 1) {
return indirect[index];
}
throw invalid_argument(THE_INDEX_VALUE_HAS_TO_BE_BETWEEN_0_AND_1_TEXT);
}
void Inode::setIndirect(int index, int32_t value) {
if (index >= 0 && index <= 1) {
indirect[index] = value;
} else {
throw invalid_argument(THE_INDEX_VALUE_HAS_TO_BE_BETWEEN_0_AND_1_TEXT);
}
}