Sleeping Wombat Common Library  0.50.0
swCommonLibrary
TestClasses.h
1 #pragma once
2 
3 
5 
6 #include "swCommonLib/ParameterAnimation/Parameters/DirectPropertyh.h"
9 
10 
11 #include <DirectXMath.h>
12 #include <DirectXPackedVector.h>
13 #include <string>
14 
15 
16 
17 struct Nested2
18 {
19  float SomeValue;
20  int IntValue;
21  std::string Name;
22 };
23 
24 struct Nested
25 {
26  float SomeValue;
27  int IntValue;
28  std::string Name;
29  Nested2 Additional;
30 };
31 
32 
33 
34 enum Methods
35 {
36  Discrete,
37  Linear,
38  Integral
39 };
40 
41 
43 class TestAnim : public Object
44 {
45  RTTR_ENABLE( Object );
46  RTTR_REGISTRATION_FRIEND;
47 public:
48  float m_energy;
49  float m_mass;
50  float m_power;
51  float m_shit;
52 
53  Nested m_otherData;
54 
55 protected:
56 public:
57  Ptr< FloatAnimation< StringPropertyPath > > FloatAnimString;
58  Ptr< FloatAnimation< PropertyPath > > FloatAnimProperty;
59  Ptr< FloatAnimation< DirectProperty > > FloatAnimDirect;
60 
61 public:
62  explicit TestAnim();
63  ~TestAnim() { };
64 
65 };
66 
67 
68 class TestInterpolators : public Object
69 {
70  RTTR_ENABLE( Object );
71  RTTR_REGISTRATION_FRIEND;
72 public:
73 
74  double DoubleField;
75  float FloatField;
76 
77  uint64 UIntField64;
78  int64 IntField64;
79  uint32 UIntField32;
80  int32 IntField32;
81  uint16 UIntField16;
82  int16 IntField16;
83  uint8 UIntField8;
84  int8 IntField8;
85 
86  char CharField;
87  bool BoolField;
88 
89  std::string StringField;
90  std::wstring WStringField;
91 
92  Methods EnumField;
93 
94  DirectX::XMFLOAT4 Color4F;
95  DirectX::XMFLOAT3 Position3F;
96  DirectX::PackedVector::XMCOLOR Color;
97 
98 public:
99  explicit TestInterpolators();
100  ~TestInterpolators() { };
101 
102  template< typename FieldType >
103  FieldType& GetField();
104 
105 #define DEFINE_GET_FIELD( type, name ) \
106 template<> \
107 type& GetField< type >() { return name; }
108 
109  DEFINE_GET_FIELD( uint64, UIntField64 );
110  DEFINE_GET_FIELD( int64, IntField64 );
111  DEFINE_GET_FIELD( uint32, UIntField32 );
112  DEFINE_GET_FIELD( int32, IntField32 );
113  DEFINE_GET_FIELD( uint16, UIntField16 );
114  DEFINE_GET_FIELD( int16, IntField16 );
115  DEFINE_GET_FIELD( uint8, UIntField8 );
116  DEFINE_GET_FIELD( int8, IntField8 );
117 
118  DEFINE_GET_FIELD( char, CharField );
119  DEFINE_GET_FIELD( bool, BoolField );
120  DEFINE_GET_FIELD( std::string, StringField );
121  DEFINE_GET_FIELD( std::wstring, WStringField );
122 
123  DEFINE_GET_FIELD( double, DoubleField );
124  DEFINE_GET_FIELD( float, FloatField );
125  DEFINE_GET_FIELD( Methods, EnumField );
126 
127  DEFINE_GET_FIELD( DirectX::XMFLOAT4, Color4F );
128  DEFINE_GET_FIELD( DirectX::XMFLOAT3, Position3F );
129  DEFINE_GET_FIELD( DirectX::PackedVector::XMCOLOR, Color );
130 
131 #undef DEFINE_GET_FIELD
132 };
133 
134 
135 
136 
137 
138 
139 //====================================================================================//
140 // Impl
141 //====================================================================================//
142 
143 inline TestAnim::TestAnim()
144 {
145  m_energy = 1.0f;
146  m_mass = 2.0f;
147  m_power = 3.0f;
148  m_shit = 4.0f;
149  m_otherData.SomeValue = 5.0f;
150  m_otherData.IntValue = 6;
151  m_otherData.Name = "Nested other data";
152  m_otherData.Additional.SomeValue = 7.0f;
153  m_otherData.Additional.Name = "Nested2 additional data";
154  m_otherData.Additional.IntValue = 8;
155 }
156 
157 
158 
159 inline TestInterpolators::TestInterpolators()
160 {
161  DoubleField = 1.0;
162  FloatField = 2.0;
163 
164  UIntField64 = 4;
165  IntField64 = 4;
166  UIntField32 = 4;
167  IntField32 = 4;
168  UIntField16 = 4;
169  IntField16 = 4;
170  UIntField8 = 4;
171  IntField8 = 4;
172 
173  CharField = 4;
174  BoolField = false;
175 
176  StringField = "To jest string";
177  WStringField = L"To jest wstring";
178 
179  EnumField = Methods::Integral;
180 }
181 
182 
Definition: TestClasses.h:68
Definition: TestClasses.h:43
Definition: TestClasses.h:24
Base clas for all objects in sleeping wombat libraries.
Definition: Object.h:42
Definition: TestClasses.h:17