ArrayFiller.hpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * ArrayFiller.hpp
  3. *
  4. * Created on: Oct 1, 2016
  5. * Author: Sina M.Baharlou
  6. * The class for filling 1-D boolean array
  7. */
  8. #ifndef ARRAYFILLER_HPP_
  9. #define ARRAYFILLER_HPP_
  10. #include <iostream>
  11. #include <string.h>
  12. #include <string>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <vector>
  16. #include <set>
  17. #include <fstream>
  18. #include <random>
  19. #include <math.h>
  20. #include "FillMethod.hpp"
  21. #define DEFAULT_STEP_SIZE 0.05
  22. #define DEFAULT_CURR_STEP 0.05
  23. using namespace std;
  24. class ArrayFiller
  25. {
  26. private :
  27. bool *bArray ; // -- pointer to the boolean array
  28. unsigned int arrSize; // -- array size
  29. float stepSize; // -- STEP_FILL, step size
  30. float currStep; // -- STEP_FILL, current step
  31. float tRate; // -- PORTION_FILL, true-rate
  32. float* pArray; // -- PORTION_EL_FILL array
  33. std::uniform_real_distribution<float> rndReal; // -- sampling from real uniform distribution
  34. std::default_random_engine rndEngine; // -- sampling engine
  35. public:
  36. // -- Vector Filler constructor
  37. ArrayFiller(bool* bArray,unsigned int arrSize);
  38. // -- property methods --
  39. bool* getArray();
  40. void setPortionArray(float* pArray);
  41. void setPortionRate(float rate);
  42. // -- Fill array randomly with the given method --
  43. bool* fillArray(FillMethod method);
  44. };
  45. #endif /* ARRAYFILLER_HPP_ */