Base class for all axes
| 28 | |
| 29 | /// Base class for all axes |
| 30 | class base { |
| 31 | public: |
| 32 | /// Returns the number of bins without overflow/underflow. |
| 33 | int size() const noexcept { return size_; } |
| 34 | /// Returns the number of bins, including overflow/underflow if enabled. |
| 35 | int shape() const noexcept { return shape_; } |
| 36 | /// Returns number of extra bins to count under- or overflow. |
| 37 | int uoflow() const noexcept { return shape_ - size_; } |
| 38 | |
| 39 | protected: |
| 40 | base(unsigned size, axis::uoflow_type uo) |
| 41 | : size_(size), shape_(size + static_cast<int>(uo)) { |
| 42 | if (size_ == 0) { throw std::invalid_argument("bins > 0 required"); } |
| 43 | } |
| 44 | |
| 45 | base() = default; |
| 46 | base(const base&) = default; |
| 47 | base& operator=(const base&) = default; |
| 48 | base(base&& rhs) : size_(rhs.size_), shape_(rhs.shape_) { |
| 49 | rhs.size_ = 0; |
| 50 | rhs.shape_ = 0; |
| 51 | } |
| 52 | base& operator=(base&& rhs) { |
| 53 | if (this != &rhs) { |
| 54 | size_ = rhs.size_; |
| 55 | shape_ = rhs.shape_; |
| 56 | rhs.size_ = 0; |
| 57 | rhs.shape_ = 0; |
| 58 | } |
| 59 | return *this; |
| 60 | } |
| 61 | |
| 62 | bool operator==(const base& rhs) const noexcept { |
| 63 | return size_ == rhs.size_ && shape_ == rhs.shape_; |
| 64 | } |
| 65 | |
| 66 | private: |
| 67 | int size_ = 0, shape_ = 0; |
| 68 | |
| 69 | friend class ::boost::serialization::access; |
| 70 | template <class Archive> |
| 71 | void serialize(Archive&, unsigned); |
| 72 | }; |
| 73 | |
| 74 | /// Base class with a label |
| 75 | template <typename Allocator> |
nothing calls this directly
no outgoing calls
no test coverage detected