Tools for testing Jastacry on runtime https://jastacry.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MeasureBase.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * @file MeasureBase.h
  3. * @author Kai KRETSCHMANN
  4. *
  5. * @copyright SPDX-License-Identifier: MIT
  6. *
  7. * @brief Base class for doing measurements.
  8. *
  9. **/
  10. #pragma once
  11. #ifndef MEASUREBASE_H_
  12. #define MEASUREBASE_H_
  13. #include <iostream>
  14. #include <vector>
  15. #include <memory>
  16. namespace jastacry {
  17. /**
  18. * @brief MeasureBase class.
  19. */
  20. class MeasureBase {
  21. private:
  22. /**
  23. * @brief Main action to read the given file. Child classes then can measure values out of it.
  24. * @return bool status of read action.
  25. */
  26. bool readFile();
  27. std::string _filename;
  28. size_t _filesize;
  29. protected:
  30. std::vector<unsigned char> _buffer; /*!< Buffer to read file into */
  31. /**
  32. * @brief Getter function for filename.
  33. * @return String reference to file name.
  34. */
  35. std::string& getFilename();
  36. /**
  37. * @brief Getter function for file size.
  38. * @return size_t file size.
  39. */
  40. size_t getFilesize();
  41. public:
  42. /**
  43. * @brief Constructor for base class.
  44. *
  45. * @param filename [in] - String by reference of file to read.
  46. *
  47. */
  48. explicit MeasureBase(const std::string& filename);
  49. /**
  50. * @brief Destructor default implementation.
  51. */
  52. virtual ~MeasureBase() = default;
  53. /**
  54. * @brief Abstract base function.
  55. */
  56. virtual void measure() = 0;
  57. /**
  58. * @brief Abstract base function.
  59. */
  60. virtual void printResult() = 0;
  61. /**
  62. * @brief Abstract base function.
  63. */
  64. virtual double getResult() = 0;
  65. };
  66. } /* namespace jastacry */
  67. #endif /* MEASUREBASE_H_ */
Social stuff:
Mastodon