print_helpers.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef __PRINT_HELPERS_HPP
  2. #define __PRINT_HELPERS_HPP
  3. #include <iomanip>
  4. #include <istream>
  5. #include <ostream>
  6. #include <iostream>
  7. #include <cstring>
  8. #include <string>
  9. extern "C" {
  10. #include "fp12e.h"
  11. #include "fp6e.h"
  12. #include "fp2e.h"
  13. #include "fpe.h"
  14. }
  15. class BinarySizeT {
  16. public:
  17. BinarySizeT()
  18. { /* */ }
  19. BinarySizeT(size_t data)
  20. : data(data)
  21. { /* */ }
  22. void set(size_t in)
  23. { data = in; }
  24. size_t val() const
  25. { return data; }
  26. friend std::ostream& operator<<(std::ostream& os, const BinarySizeT& output);
  27. friend std::istream& operator>>(std::istream& is, BinarySizeT& input);
  28. private:
  29. size_t data;
  30. };
  31. class BinaryBool {
  32. public:
  33. BinaryBool()
  34. { /* */ }
  35. BinaryBool(bool data)
  36. : data(data)
  37. { /* */ }
  38. void set(bool in)
  39. { data = in; }
  40. bool val() const
  41. { return data; }
  42. friend std::ostream& operator<<(std::ostream& os, const BinaryBool& output);
  43. friend std::istream& operator>>(std::istream& is, BinaryBool& input);
  44. private:
  45. bool data;
  46. };
  47. class Fp12e {
  48. public:
  49. Fp12e();
  50. Fp12e(const fp12e_t& input);
  51. friend std::ostream& operator<<(std::ostream& os, const Fp12e& output);
  52. friend std::istream& operator>>(std::istream& is, Fp12e& input);
  53. fp12e_t data;
  54. };
  55. class Fp6e {
  56. public:
  57. Fp6e();
  58. Fp6e(const fp6e_t& input);
  59. friend std::ostream& operator<<(std::ostream& os, const Fp6e& output);
  60. friend std::istream& operator>>(std::istream& is, Fp6e& input);
  61. fp6e_t data;
  62. };
  63. class Fp2e {
  64. public:
  65. Fp2e();
  66. Fp2e(const fp2e_t& input);
  67. friend std::ostream& operator<<(std::ostream& os, const Fp2e& output);
  68. friend std::istream& operator>>(std::istream& is, Fp2e& input);
  69. fp2e_t data;
  70. };
  71. class Fpe {
  72. public:
  73. Fpe();
  74. Fpe(const fpe_t& input);
  75. friend std::ostream& operator<<(std::ostream& os, const Fpe& output);
  76. friend std::istream& operator>>(std::istream& is, Fpe& input);
  77. fpe_t data;
  78. };
  79. std::ostream& hex_double(std::ostream& os, double d);
  80. std::istream& hex_double(std::istream& is, double& d);
  81. std::ostream& raw_double(std::ostream& os, double d);
  82. std::istream& raw_double(std::istream& is, double& d);
  83. #endif