fileman.h 679 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. public:
  15. FileMan();
  16. ~FileMan();
  17. bool isGetting();
  18. bool isPutting();
  19. bool openPut(const std::string &name);
  20. bool openGet(const std::string &name);
  21. void closePut();
  22. void closeGet();
  23. std::string getPutName();
  24. std::string getGetName();
  25. // closes and deletes getfile
  26. void cancelGet();
  27. void writeGet(std::vector<char> data);
  28. std::vector<char> readPut();
  29. int getPutChunks();
  30. };
  31. #endif