Photon Engine 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
TEstimationArray.h
Go to the documentation of this file.
1#pragma once
2
3#include <Common/assertion.h>
4
5#include <vector>
6#include <cstddef>
7
8namespace ph
9{
10
11template<typename EstimationType>
13{
14public:
16 explicit TEstimationArray(std::size_t numEstimations);
17
18 std::size_t numEstimations() const;
19
20 EstimationType& operator [] (std::size_t index);
21 const EstimationType& operator [] (std::size_t index) const;
22
23private:
24 std::vector<EstimationType> m_estimations;
25};
26
27// In-header Implementations:
28
29template<typename EstimationType>
33
34template<typename EstimationType>
35inline TEstimationArray<EstimationType>::TEstimationArray(const std::size_t numEstimations) :
36 m_estimations(numEstimations, EstimationType(0))
37{}
38
39template<typename EstimationType>
41{
42 return m_estimations.size();
43}
44
45template<typename EstimationType>
46inline EstimationType& TEstimationArray<EstimationType>::operator [] (const std::size_t index)
47{
48 PH_ASSERT_LT(index, m_estimations.size());
49
50 return m_estimations[index];
51}
52
53template<typename EstimationType>
54inline const EstimationType& TEstimationArray<EstimationType>::operator [] (const std::size_t index) const
55{
56 PH_ASSERT_LT(index, m_estimations.size());
57
58 return m_estimations[index];
59}
60
61}// namespace ph
Definition TEstimationArray.h:13
TEstimationArray()
Definition TEstimationArray.h:30
EstimationType & operator[](std::size_t index)
Definition TEstimationArray.h:46
std::size_t numEstimations() const
Definition TEstimationArray.h:40
The root for all renderer implementations.
Definition EEngineProject.h:6