fwd.hpp 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. // some forward declarations must be hidden from doxygen to fix the reference docu :(
  32. #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
  33. namespace transform {
  34. struct id;
  35. struct log;
  36. struct sqrt;
  37. struct pow;
  38. } // namespace transform
  39. template <class Value = double, class Transform = use_default,
  40. class MetaData = use_default, class Options = use_default>
  41. class regular;
  42. template <class Value = int, class MetaData = use_default, class Options = use_default>
  43. class integer;
  44. template <class Value = double, class MetaData = use_default, class Options = use_default,
  45. class Allocator = std::allocator<Value>>
  46. class variable;
  47. template <class Value = int, class MetaData = use_default, class Options = use_default,
  48. class Allocator = std::allocator<Value>>
  49. class category;
  50. template <class... Ts>
  51. class variant;
  52. #endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED
  53. } // namespace axis
  54. #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
  55. template <class T>
  56. struct weight_type;
  57. template <class T>
  58. struct sample_type;
  59. namespace accumulators {
  60. template <class ValueType = double>
  61. class count;
  62. template <class ValueType = double>
  63. class sum;
  64. template <class ValueType = double>
  65. class weighted_sum;
  66. template <class ValueType = double>
  67. class mean;
  68. template <class ValueType = double>
  69. class weighted_mean;
  70. template <class T>
  71. class thread_safe;
  72. template <class T>
  73. struct is_thread_safe : std::false_type {};
  74. template <class T>
  75. struct is_thread_safe<thread_safe<T>> : std::true_type {};
  76. } // namespace accumulators
  77. struct unsafe_access;
  78. template <class Allocator = std::allocator<char>>
  79. class unlimited_storage;
  80. template <class T>
  81. class storage_adaptor;
  82. #endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED
  83. /// Vector-like storage for fast zero-overhead access to cells.
  84. template <class T, class A = std::allocator<T>>
  85. using dense_storage = storage_adaptor<std::vector<T, A>>;
  86. /// Default storage, optimized for unweighted histograms
  87. using default_storage = unlimited_storage<>;
  88. /// Dense storage which tracks sums of weights and a variance estimate.
  89. using weight_storage = dense_storage<accumulators::weighted_sum<>>;
  90. /// Dense storage which tracks means of samples in each cell.
  91. using profile_storage = dense_storage<accumulators::mean<>>;
  92. /// Dense storage which tracks means of weighted samples in each cell.
  93. using weighted_profile_storage = dense_storage<accumulators::weighted_mean<>>;
  94. // some forward declarations must be hidden from doxygen to fix the reference docu :(
  95. #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
  96. template <class Axes, class Storage = default_storage>
  97. class BOOST_ATTRIBUTE_NODISCARD histogram;
  98. #endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED
  99. } // namespace histogram
  100. } // namespace boost
  101. #endif