fwd.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // Copyright 2015-2019 Hans Dembinski
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt
  5. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_HISTOGRAM_FWD_HPP
  7. #define BOOST_HISTOGRAM_FWD_HPP
  8. /**
  9. \file boost/histogram/fwd.hpp
  10. Forward declarations, tag types and type aliases.
  11. */
  12. #include <boost/config.hpp> // BOOST_ATTRIBUTE_NODISCARD
  13. #include <boost/core/use_default.hpp>
  14. #include <vector>
  15. namespace boost {
  16. namespace histogram {
  17. /// Tag type to indicate use of a default type
  18. using boost::use_default;
  19. namespace axis {
  20. /// Integral type for axis indices
  21. using index_type = int;
  22. /// Real type for axis indices
  23. using real_index_type = double;
  24. /// Empty metadata type
  25. struct null_type {
  26. template <class Archive>
  27. void serialize(Archive&, unsigned /* version */) {}
  28. };
  29. /// Another alias for an empty metadata type
  30. using empty_type = null_type;
  31. #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
  32. namespace transform {
  33. struct id;
  34. struct log;
  35. struct sqrt;
  36. struct pow;
  37. } // namespace transform
  38. template <class Value = double, class Transform = use_default,
  39. class MetaData = use_default, class Options = use_default>
  40. class regular;
  41. template <class Value = int, class MetaData = use_default, class Options = use_default>
  42. class integer;
  43. template <class Value = double, class MetaData = use_default, class Options = use_default,
  44. class Allocator = std::allocator<Value>>
  45. class variable;
  46. template <class Value = int, class MetaData = use_default, class Options = use_default,
  47. class Allocator = std::allocator<Value>>
  48. class category;
  49. template <class... Ts>
  50. class variant;
  51. #endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED
  52. } // namespace axis
  53. #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
  54. template <class T>
  55. struct weight_type;
  56. template <class T>
  57. struct sample_type;
  58. namespace accumulators {
  59. template <class Value = double>
  60. class sum;
  61. template <class Value = double>
  62. class weighted_sum;
  63. template <class Value = double>
  64. class mean;
  65. template <class Value = double>
  66. class weighted_mean;
  67. template <class T>
  68. class thread_safe;
  69. template <class T>
  70. struct is_thread_safe : std::false_type {};
  71. template <class T>
  72. struct is_thread_safe<thread_safe<T>> : std::true_type {};
  73. } // namespace accumulators
  74. struct unsafe_access;
  75. template <class Allocator = std::allocator<char>>
  76. class unlimited_storage;
  77. template <class T>
  78. class storage_adaptor;
  79. #endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED
  80. /// Vector-like storage for fast zero-overhead access to cells.
  81. template <class T, class A = std::allocator<T>>
  82. using dense_storage = storage_adaptor<std::vector<T, A>>;
  83. /// Default storage, optimized for unweighted histograms
  84. using default_storage = unlimited_storage<>;
  85. /// Dense storage which tracks sums of weights and a variance estimate.
  86. using weight_storage = dense_storage<accumulators::weighted_sum<>>;
  87. /// Dense storage which tracks means of samples in each cell.
  88. using profile_storage = dense_storage<accumulators::mean<>>;
  89. /// Dense storage which tracks means of weighted samples in each cell.
  90. using weighted_profile_storage = dense_storage<accumulators::weighted_mean<>>;
  91. #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
  92. template <class Axes, class Storage = default_storage>
  93. class BOOST_ATTRIBUTE_NODISCARD histogram;
  94. #endif
  95. } // namespace histogram
  96. } // namespace boost
  97. #endif