HerdSoftware  0.4.0
SidesArray.h
Go to the documentation of this file.
1 /*
2  * SidesArray.h
3  *
4  * Created on: 10 Jan 2019
5  * Author: Nicola Mori
6  */
7 
8 #ifndef HERD_SIDESARRAY_H_
9 #define HERD_SIDESARRAY_H_
10 
11 // HerdSoftware headers
14 
15 namespace Herd {
72 template <typename ContainedClass> class SidesArray : public ArrayForwarder<ContainedClass, RefFrame::NSides> {
73 public:
75 
84  ContainedClass &operator[](const RefFrame::Side &side) { return BaseType::operator[](static_cast<int>(side)); }
85 
94  const ContainedClass &operator[](const RefFrame::Side &side) const {
95  return BaseType::operator[](static_cast<int>(side));
96  }
97 
107  ContainedClass &at(const RefFrame::Side &side) { return BaseType::at(static_cast<int>(side)); }
108 
118  const ContainedClass &at(const RefFrame::Side &side) const { return BaseType::at(static_cast<int>(side)); }
119 };
120 
121 } // namespace Herd
122 
123 #endif /* HERD_SIDESARRAY_H_ */
Herd::SidesArray::operator[]
const ContainedClass & operator[](const RefFrame::Side &side) const
Accesses an element without validity check on the element index.
Definition: SidesArray.h:94
Herd::RefFrame::Side
Side
Aliases for the five sides.
Definition: RefFrame.h:111
Herd
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
Herd::ArrayForwarder< ContainedClass, RefFrame::NSides >::at
_GLIBCXX17_CONSTEXPR reference at(size_type __n)
Definition: ArrayForwarder.h:152
RefFrame.h
ArrayForwarder.h
Herd::SidesArray::operator[]
ContainedClass & operator[](const RefFrame::Side &side)
Accesses an element without validity check on the element index.
Definition: SidesArray.h:84
Herd::SidesArray::at
ContainedClass & at(const RefFrame::Side &side)
Accesses an element with validity check on the element index.
Definition: SidesArray.h:107
Herd::ArrayForwarder
A forwarder class for std::array.
Definition: ArrayForwarder.h:48
Herd::ArrayForwarder< ContainedClass, RefFrame::NSides >::operator[]
_GLIBCXX17_CONSTEXPR reference operator[](size_type __n) noexcept
Definition: ArrayForwarder.h:148
Herd::SidesArray
An array that accepts side as subscripts.
Definition: SidesArray.h:72
Herd::SidesArray::at
const ContainedClass & at(const RefFrame::Side &side) const
Accesses an element with validity check on the element index.
Definition: SidesArray.h:118