-
Notifications
You must be signed in to change notification settings - Fork 0
/
file.h
39 lines (32 loc) · 950 Bytes
/
file.h
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
/*
* File: file.h
* Group: 14
* Description: Header for the File class. This class represents a file that is
* being replicated across network. Manages IO for the given file in chunks.
*/
#ifndef _FILE_H_
#define _FILE_H_
#include <string>
#include "file_chunk.h"
class File {
public:
File();
File(std::string, int, bool, int);
~File();
std::string getFilename() { return _filename; }
int getNumChunks() { return _numChunks; }
int getTotalChunks() { return _totalChunks; }
bool isAvailable(int i) { return _isAvailable[i]; }
bool* getIsAvailable() { return _isAvailable; }
int getFileSize() { return _fileSize; }
bool readChunk(FileChunk&);
bool writeChunk(FileChunk&);
std::string _filename;
int _numChunks;
int _totalChunks;
bool* _isAvailable;
int _fileSize;
friend std::ostream& operator<<(std::ostream&, File const&);
friend std::istream& operator>>(std::istream&, File&);
};
#endif /* _FILE_H_ */