• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2            Copyright Hans Dembinski 2018 - 2019.
3   Distributed under the Boost Software License, Version 1.0.
4      (See accompanying file LICENSE_1_0.txt or copy at
5            https://www.boost.org/LICENSE_1_0.txt)
6]
7
8[section:Storage Storage]
9
10A [*Storage] handles memory for the bin counters and provides a uniform vector-like interface for accessing cell values for reading and writing. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable].
11
12[heading Required features]
13
14* `S` is a type meeting the requirements of [*Storage]
15* `s` is a  value of types `S`
16* `i` and `n` are values of type `std::size_t`
17* `Alloc` is an allocator type for `S`
18
19[table Valid expressions
20[[Expression] [Returns] [Semantics, Pre/Post-conditions]]
21[
22  [`S::value_type`]
23  []
24  [
25    Cell element type, may be either an integral type, floating-point type, or a type meeting the requirements of [link histogram.concepts.Accumulator [*Accumulator]].
26  ]
27]
28[
29  [`S::reference`]
30  []
31  [
32    `S::value_type&` or a proxy class which acts like a reference.
33  ]
34]
35[
36  [`S::const_reference`]
37  []
38  [
39    `const S::value_type&` or a proxy class which acts like a const reference. Implicitly convertible to `S::value_type`.
40  ]
41]
42[
43  [`S::iterator`]
44  []
45  [
46    Returns an STL-compliant iterator type which dereferences to `S::reference`.
47  ]
48]
49[
50  [`S::const_iterator`]
51  []
52  [
53    Returns an STL-compliant iterator type which dereferences to `S::const_reference`.
54  ]
55]
56[
57  [`S::has_threading_support`]
58  [bool]
59  [
60    Static constexpr member. True, if storage supports parallel read-write access to all cells.
61    False, if such parallel access would either cause data corruption or require synchronization so that effectively only one cell can be accessed at a time, making cell-access single-threaded.
62  ]
63]
64[
65  [`s.size()`]
66  [`std::size_t`]
67  [
68    Const member function which returns the current number of cells in the storage.
69  ]
70]
71[
72  [`s.reset(n)`]
73  []
74  [
75    Non-const member function which discards current cell values, changes storage size to `n` and initializes all cells to the default-constructed state.
76  ]
77]
78[
79  [`s.begin()`]
80  [`S::iterator`]
81  [
82    Non-const member function which returns the iterator to the first storage cell.
83  ]
84]
85[
86  [`s.begin()`]
87  [`S::const_iterator`]
88  [
89    Likewise, but a const member function which returns the const_iterator.
90  ]
91]
92[
93  [`s.end()`]
94  [`S::iterator`]
95  [
96    Member function which returns the iterator to the cell after the last valid storage cell.
97  ]
98]
99[
100  [`s.end()`]
101  [`S::const_iterator`]
102  [
103    Likewise, but a const member function which returns the const_iterator.
104  ]
105]
106[
107  [`s[i]`]
108  [`S::reference`]
109  [
110    Member function which returns a reference to the cell which is addressed by `i`. The index `i` must be valid: `i < s.size()`.
111  ]
112]
113[
114  [`s[i]`]
115  [`S::const_reference`]
116  [
117    Likewise, but a const member function which returns a const reference.
118  ]
119]
120[
121  [`s == t`]
122  [`bool`]
123  [
124    `t` is another value of a type which meets the requirements of [*Storage]. Returns `true` if arguments have the same number of cells and all cells compare equal. Otherwise returns `false`.
125  ]
126]
127[
128  [`s.get_allocator()`]
129  [`Alloc`]
130  [
131    Const member function which returns the allocator used by `S`. Must be omitted if `S` does not use allocators. If this member function exists, also a special constructor must exist so that `S(s.get_allocator())` is a valid expression.
132  ]
133]
134]
135
136[heading Optional features]
137
138* `S` is a type meeting the requirements of [*Storage]
139* `s` is a  value of types `S`
140* `x` is convertible to `double`
141* `ar` is a value of an archive with Boost.Serialization semantics
142
143[table Valid expressions
144[[Expression] [Returns] [Semantics, Pre/Post-conditions]]
145[
146  [`s *= x`]
147  [`S&`]
148  [
149    Scales all cell values by the factor `x` and returns a reference to self.
150  ]
151]
152[
153  [`s.serialize(ar, n)`]
154  []
155  [
156    `ar` is a value of an archive with Boost.Serialization semantics and `n` is an unsigned integral value. Saves to the archive or loads serialized state from the archive. The version number `n` is the stored version when the object is loaded or the current version when the object is saved.
157  ]
158]
159]
160
161[heading Models]
162
163* [classref boost::histogram::unlimited_storage]
164* [classref boost::histogram::storage_adaptor]
165* [classref boost::histogram::dense_storage]
166* [classref boost::histogram::weight_storage]
167* [classref boost::histogram::profile_storage]
168* [classref boost::histogram::weighted_profile_storage]
169
170[endsect]
171