...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Users can extend the library with various new types whose concepts are defined here.
An Axis maps input values to indices. It holds state specific to that axis, like the number of bins and any metadata. Must be CopyConstructible and CopyAssignable.
A
is a type meeting the
requirements of Axis
a
is a value of type
A
I
is an alias for boost::histogram::index_type
Table 1.1. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Const member function which returns the number of bins of the axis.
All indices from |
|
|
Const member function which maps a value |
|
|
Const member function which returns the allocator |
A
is a type meeting the
requirements of Axis
a
and b
are values of type A
M
is a metadata type
that is CopyConstructible
and CopyAssignable
Table 1.2. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Non-const member function which maps a value to an index (first
argument of the returned pair) and offset (second argument of the
returned pair). If the value is not covered by the axis, this method
may grow the current axis size ( |
|
|
Static constexpr member function which returns the |
|
|
Const member function which returns a const reference to the metadata associated with the axis (usually a string). |
|
|
Likewise, but non-const member function which returns a reference to the metadata. If this member function exists, also the previous one must exist. |
|
|
Returns |
|
|
Must be implemented if |
|
|
|
|
|
A DiscreteAxis is one of two optional refinements of the Axis concept, the other one is the IntervalAxis. This concept is for values that do not form intervals, and for axes with intervals that contain exactly one value.
A
is a type meeting the
requirements of DiscreteAxis
a
is a value of type
A
V
is the type accepted
for conversion into an index
v
is a value of type
V
i
is a value of type
boost::histogram::index_type
AxisIter
is an RandomAccessIterator
over the bins of A
ReAxisIter
is a reverse
RandomAccessIterator over the bins of A
Table 1.3. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Const member function which maps an index to a value. The mapping
must be injective: each index must be uniquely mapped to one value.
The effect must be exactly the inverse of |
|
|
Must have the same effect as |
|
|
Const member function which return an iterator to the bin with
index |
|
|
Const member function which returns an iterator to the bin with
index |
|
|
Const member function which return a reverse iterator to the bin
with index |
|
|
Const member function which returns an iterator to the bin with
index |
Tip | |
---|---|
The complete iterator interface can be added to a user-defined axis which
implements |
boost::histogram::axis::category
boost::histogram::axis::integer
,
if first template parameter is boost::histogram::index_type
A IntervalAxis is one of two optional refinements of the Axis concept, the other one is the DiscreteAxis. It is for ordered values that form intervals with a well-defined lower and upper edge, and a center. Each bin represents an interval of values.
A
is a type meeting the
requirements of IntervalAxis
a
is a value of type
A
V
is the type accepted
for conversion into an index
B
is the type that represents
the bin interval
v
is a value of type
V
i
is a value of type
boost::histogram::index_type
j
is a value of type
boost::histogram::real_index_type
AxisIter
is an RandomAccessIterator
over the bins of A
ReAxisIter
is a reverse
RandomAccessIterator over the bins of A
Table 1.4. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Const member function which maps an index to a value. The mapping
must be injective: each index must be uniquely mapped to one value.
The result of |
|
|
Const member function which returns an instance that represents
the current bin. Nothing about the type is required, but it is
recommended that the type has the methods |
|
|
Const member function which return an iterator to the bin with
index |
|
|
Const member function which returns an iterator to the bin with
index |
|
|
Const member function which return a reverse iterator to the bin
with index |
|
|
Const member function which returns an iterator to the bin with
index |
Tip | |
---|---|
The complete iterator interface can be added to a user-defined axis which
implements |
boost::histogram::axis::regular
boost::histogram::axis::variable
boost::histogram::axis::integer
,
if first template parameter is a floating point type
A Transform implements a monotonic mapping
between two real-valued domains, external and internal. It is used to extend
the regular axis
.
The bins in the internal domain are of equal width, while the bins in the
external domain are non-equal width. Must be DefaultConstructible,
CopyConstructible,
and CopyAssignable.
T
is a type meeting the
requirements of Transform
t
is a value of type
T
X
is a type with the
semantics of a floating-point type
x
is a value of type
X
Y
is a floating-point
type
y
is a value of type
Y
Table 1.5. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Const or static member function which maps the external value to
the corresponding internal value. The return type |
|
|
Const or static member function which maps the internal value to
the corresponding external value. The result of |
|
|
|
T
is a type meeting the
requirements of Transform
t
is a value of type
T
ar
is a value of an archive
with Boost.Serialization semantics
Table 1.6. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
Serializes |
A Storage handles memory for the bin counters and provides a uniform vector-like interface for accessing cell values for reading and writing. Must be DefaultConstructible, CopyConstructible, and CopyAssignable.
S
is a type meeting the
requirements of Storage
s
is a value of types
S
i
and n
are values of type std::size_t
Table 1.7. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
Cell element type, may be either an integral type, floating-point type, or a type meeting the requirements of Accumulator. |
|
|
|
|
|
|
|
|
Returns an STL-compliant iterator type which dereferences to |
|
|
Returns an STL-compliant iterator type which dereferences to |
|
|
|
Const member function which returns the current number of cells in the storage. |
|
Non-const member function which discards current cell values, changes
storage size to |
|
|
|
Non-const member function which returns the iterator to the first storage cell. |
|
|
Likewise, but a const member function which returns the const_iterator. |
|
|
Member function which returns the iterator to the cell after the last valid storage cell. |
|
|
Likewise, but a const member function which returns the const_iterator. |
|
|
Member function which returns a reference to the cell which is
addressed by |
|
|
Likewise, but a const member function which returns a const reference. |
|
|
|
|
|
Const member function which returns the allocator |
S
is a type meeting the
requirements of Storage
s
is a value of types
S
x
is convertible to
double
ar
is a value of an archive
with Boost.Serialization semantics
Table 1.8. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Scales all cell values by the factor |
|
Serializes |
An Accumulator is a functor which consumes the argument to update some internal state. The state can be read with member functions or free functions. Must be DefaultConstructible, CopyConstructible, and CopyAssignable.
A
is a type meeting the
requirements of Accumulator
a
and b
are values of type A
ts...
is a pack of values
Table 1.9. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
Either a call operator accepting a fixed number of arguments must be implemented, or the pre-increment operator. |
|
|
|
Returns |
|
|
Must be implemented if |
A
is a type meeting the
requirements of Accumulator
a
and b
are values of type A
Table 1.10. Valid expressions
Expression |
Return type |
Semantics, Pre/Post-conditions |
---|---|---|
|
|
Adds a second accumulator |
|
|
Scales the accumulator state by the real value |
|
|
|
|
|