fileman.h 743 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef FILEMAN_H
  2. #define FILEMAN_H
  3. #include <fstream>
  4. #include <string>
  5. #include <vector>
  6. #define BLOCKSIZE 8
  7. class FileMan {
  8. private:
  9. std::ifstream putfile;
  10. std::ofstream getfile;
  11. std::string getname, putname;
  12. const unsigned int max_read_len = 8;
  13. unsigned int putchunks;
  14. unsigned int putchunksRemaining;
  15. public:
  16. FileMan();
  17. ~FileMan();
  18. bool isGetting();
  19. bool isPutting();
  20. bool openPut(const std::string &name);
  21. bool openGet(const std::string &name);
  22. void closePut();
  23. void closeGet();
  24. std::string getPutName();
  25. std::string getGetName();
  26. // closes and deletes getfile
  27. void cancelGet();
  28. void writeGet(std::vector<char> data);
  29. std::vector<char> readPut();
  30. int getPutChunks();
  31. int getPutChunksRemaining();
  32. };
  33. #endif