24 static_assert(std::is_nothrow_move_constructible<std::vector<T>>::value,
25 "std::vector<T> is expected to be copy-constructible");
26 static_assert(std::is_nothrow_move_assignable<std::vector<T>>::value,
27 "std::vector<T> is expected to be copy-assignable");
38 ANALYSISTREE_ATTR_NODISCARD
size_t GetNumberOfChannels()
const noexcept {
39 return channels_.size();
44 channels_.emplace_back(T(channels_.size()));
45 return &(channels_.back());
49 channels_.emplace_back(T(channels_.size(), branch));
50 return channels_.back();
53 void ClearChannels() {
57 T& Channel(
size_t number)
59 if (number < GetNumberOfChannels()) {
60 return channels_.at(number);
62 throw std::out_of_range(
"Detector::Channel - wrong channel number " + std::to_string(number) +
" Number of channels in this detector is " + std::to_string(GetNumberOfChannels()));
66 const T& GetChannel(
size_t number)
const {
67 if (number < GetNumberOfChannels()) {
68 return channels_.at(number);
70 throw std::out_of_range(
"Detector::GetChannel - wrong channel number " + std::to_string(number) +
" Number of channels in this detector is " + std::to_string(GetNumberOfChannels()));
75 if (&that == &other) {
83 return std::equal(that.channels_.begin(), that.channels_.end(), other.channels_.begin());
86 ANALYSISTREE_ATTR_DEPRECATED(
"Please use range-based loops: for(const auto& channel : detector)")
87 const std::vector<T>* GetChannels()
const {
return &channels_; }
88 ANALYSISTREE_ATTR_DEPRECATED(
"Please use range-based loops: for(const auto& channel : detector)")
89 std::vector<T>* Channels() {
return &channels_; }
91 void Reserve(
size_t n) {
96 for (
const auto& channel : channels_) {
101 auto begin() ->
typename std::vector<T>::iterator {
return channels_.begin(); }
102 auto end() ->
typename std::vector<T>::iterator {
return channels_.end(); }
103 auto cbegin()
const ->
typename std::vector<T>::const_iterator {
return channels_.begin(); }
104 auto cend()
const ->
typename std::vector<T>::const_iterator {
return channels_.end(); }
105 auto begin()
const ->
typename std::vector<T>::const_iterator {
return channels_.begin(); }
106 auto end()
const ->
typename std::vector<T>::const_iterator {
return channels_.end(); }
109 std::vector<T> channels_{};