DESC.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* Copyright (C) 2014 Carlos Aguilar Melchor, Joris Barrier, Marc-Olivier Killijian
  2. * This file is part of XPIR.
  3. *
  4. * XPIR is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * XPIR is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with XPIR. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef DEF_DESC
  18. #define DEF_DESC
  19. #include <string>
  20. #include <vector>
  21. #include <sstream>
  22. #include <iostream>
  23. #include <boost/signals2.hpp>
  24. #include "pir/events/MessageEvent.hpp"
  25. using namespace std;
  26. #define FILENAME_MAX_BYTE_SIZE 1023
  27. typedef boost::signals2::signal<void (MessageEvent&)> messageListener;
  28. class DESC
  29. {
  30. public :
  31. DESC (messageListener& messageListeners);
  32. void makeMenu(char* receivedBuffer);
  33. bool file_exists (uint64_t ID);
  34. string getFileName(uint64_t index);
  35. uint64_t getFileSize(uint64_t index);
  36. const vector<string>& getFileList();
  37. uint64_t getFilesNum();
  38. uint64_t getMaxFileSize();
  39. ~DESC();
  40. private:
  41. messageListener& messageListeners;
  42. vector<string> fileList;
  43. vector<uint64_t> fileSize;
  44. uint64_t maxFileSize;
  45. uint64_t nbFiles;
  46. };
  47. #endif