HerdSoftware  0.3.2
ViewArray.h
Go to the documentation of this file.
1 /*
2  * ViewArray.h
3  *
4  * Created on: 8 Feb 2022
5  * Author: Valerio Formato
6  */
7 
8 #ifndef HERD_VIEWARRAY_H_
9 #define HERD_VIEWARRAY_H_
10 
11 // HerdSoftware headers
12 #include "common/ArrayForwarder.h"
13 #include "common/RefFrame.h"
14 
15 namespace Herd {
27 template <typename ContainedClass> class ViewArray : public ArrayForwarder<ContainedClass, RefFrame::NViews> {
28 public:
30 
39  ContainedClass &operator[](const RefFrame::View &view) { return BaseType::operator[](static_cast<int>(view)); }
40 
49  const ContainedClass &operator[](const RefFrame::View &view) const {
50  return BaseType::operator[](static_cast<int>(view));
51  }
52 
62  ContainedClass &at(const RefFrame::View &view) { return BaseType::at(static_cast<int>(view)); }
63 
73  const ContainedClass &at(const RefFrame::View &view) const { return BaseType::at(static_cast<int>(view)); }
74 };
75 
76 } // namespace Herd
77 
78 #endif
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:24
const ContainedClass & at(const RefFrame::View &view) const
Accesses an element with validity check on the element index.
Definition: ViewArray.h:73
ContainedClass & operator[](const RefFrame::View &view)
Accesses an element without validity check on the element index.
Definition: ViewArray.h:39
const ContainedClass & operator[](const RefFrame::View &view) const
Accesses an element without validity check on the element index.
Definition: ViewArray.h:49
A forwarder class for std::array.
Definition: ArrayForwarder.h:48
ContainedClass & at(const RefFrame::View &view)
Accesses an element with validity check on the element index.
Definition: ViewArray.h:62
An array that accepts axis as subscripts.
Definition: ViewArray.h:27
_GLIBCXX17_CONSTEXPR reference operator[](size_type __n) noexcept
Definition: ArrayForwarder.h:148
_GLIBCXX17_CONSTEXPR reference at(size_type __n)
Definition: ArrayForwarder.h:152
View
Aliases for the three 2D projection planes. RefFrame.h common/RefFrame.h.
Definition: RefFrame.h:93