Plasma Engine  2.0
Loading...
Searching...
No Matches
VarianceTypes.h
1#pragma once
2
3#include <Foundation/Basics.h>
4#include <Foundation/Reflection/Implementation/StaticRTTI.h>
5#include <Foundation/Types/TypeTraits.h>
6
7#define PL_DECLARE_VARIANCE_HASH_HELPER(TYPE) \
8 template <> \
9 struct plHashHelper<TYPE> \
10 { \
11 PL_ALWAYS_INLINE static plUInt32 Hash(const TYPE& value) \
12 { \
13 return plHashingUtils::xxHash32(&value, sizeof(TYPE)); \
14 } \
15 PL_ALWAYS_INLINE static bool Equal(const TYPE& a, const TYPE& b) \
16 { \
17 return a == b; \
18 } \
19 };
20
21struct PL_FOUNDATION_DLL plVarianceTypeBase
22{
23 PL_DECLARE_POD_TYPE();
24
25 float m_fVariance = 0;
26};
27
28PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL, plVarianceTypeBase);
29
30struct PL_FOUNDATION_DLL plVarianceTypeFloat : public plVarianceTypeBase
31{
32 PL_DECLARE_POD_TYPE();
33 bool operator==(const plVarianceTypeFloat& rhs) const
34 {
35 return m_fVariance == rhs.m_fVariance && m_Value == rhs.m_Value;
36 }
37 bool operator!=(const plVarianceTypeFloat& rhs) const
38 {
39 return !(*this == rhs);
40 }
41 float m_Value = 0;
42};
43
44PL_DECLARE_VARIANCE_HASH_HELPER(plVarianceTypeFloat);
45PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL, plVarianceTypeFloat);
46PL_DECLARE_CUSTOM_VARIANT_TYPE(plVarianceTypeFloat);
47
48struct PL_FOUNDATION_DLL plVarianceTypeTime : public plVarianceTypeBase
49{
50 PL_DECLARE_POD_TYPE();
51 bool operator==(const plVarianceTypeTime& rhs) const
52 {
53 return m_fVariance == rhs.m_fVariance && m_Value == rhs.m_Value;
54 }
55 bool operator!=(const plVarianceTypeTime& rhs) const
56 {
57 return !(*this == rhs);
58 }
59 plTime m_Value;
60};
61
62PL_DECLARE_VARIANCE_HASH_HELPER(plVarianceTypeTime);
63PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL, plVarianceTypeTime);
64PL_DECLARE_CUSTOM_VARIANT_TYPE(plVarianceTypeTime);
65
66struct PL_FOUNDATION_DLL plVarianceTypeAngle : public plVarianceTypeBase
67{
68 PL_DECLARE_POD_TYPE();
69 bool operator==(const plVarianceTypeAngle& rhs) const
70 {
71 return m_fVariance == rhs.m_fVariance && m_Value == rhs.m_Value;
72 }
73 bool operator!=(const plVarianceTypeAngle& rhs) const
74 {
75 return !(*this == rhs);
76 }
77 plAngle m_Value;
78};
79
80PL_DECLARE_VARIANCE_HASH_HELPER(plVarianceTypeAngle);
81PL_DECLARE_REFLECTABLE_TYPE(PL_FOUNDATION_DLL, plVarianceTypeAngle);
82PL_DECLARE_CUSTOM_VARIANT_TYPE(plVarianceTypeAngle);
Float wrapper struct for a safe usage and conversions of angles.
Definition Angle.h:10
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12
Definition VarianceTypes.h:67
Definition VarianceTypes.h:22
Definition VarianceTypes.h:31
Definition VarianceTypes.h:49