Skip to main content

NumericValueComponent.ixx File

Generic scalar component with dirty-state tracking. More...

Included Headers

#include <cassert> #include <algorithm> #include <cmath> #include <helios.math>

Namespaces Index

namespacehelios
namespaceengine
namespacecore
namespacecomponents

Classes Index

classNumericValueComponent<TDomainTag, TNumericType, Args>

Generic numeric value component with dirty-state tracking. More...

Description

Generic scalar component with dirty-state tracking.

File Listing

The file content with the documentation metadata removed is:

1
5module;
6
7#include <cassert>
8#include <algorithm>
9#include <cmath>
10
11export module helios.engine.core.components.NumericValueComponent;
12
13import helios.math;
14
15using namespace helios::math;
16using namespace helios::math::concepts;
18
26 template<typename TDomainTag, typename TNumericType, typename ... Args>
29
30 TNumericType value_{};
31
32 bool isDirty_ = true;
33
34 public:
35
37
38
44 explicit NumericValueComponent(const TNumericType value) : value_(value){}
45
55 value_(other.value_),
56 isDirty_(true) {}
57
64
71 isDirty_ = true;
72 }
73
80 isDirty_ = true;
81 }
82
87 isDirty_ = false;
88 }
89
96 return isDirty_;
97 }
98
105 return value_;
106 }
107
109 return value_;
110 }
111
120 void setValue(const TNumericType value) noexcept {
121
122 if constexpr (std::floating_point<TNumericType>) {
123 if (std::abs(value_ - value) <= static_cast<TNumericType>(helios::math::EPSILON_LENGTH)) {
124 return;
125 }
126 } else {
127 if (value_ == value) {
128 return;
129 }
130 }
131
132
133 value_ = value;
134 isDirty_ = true;
135 };
136
137
138 };
139
140}

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.