MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / SampleRecord

Class SampleRecord

Engine/source/util/sampler.cpp:108–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 /// it in these sample records and then flush them to disk once we receive
107 /// the endFrame call.
108 struct SampleRecord
109 {
110 U32 mKey;
111 U32 mType; //< Console type code.
112 bool mSet;
113 union
114 {
115 bool mBool;
116 S32 mS32;
117 F32 mF32;
118 const char* mString;
119 } mValue;
120
121 SampleRecord() : mKey(0), mSet(false), mType(TypeBool) { mValue.mBool = false; }
122 SampleRecord( U32 key )
123 : mKey( key ), mSet( false ), mType(TypeBool) { mValue.mBool = false; }
124
125 void set( bool value )
126 {
127 mType = TypeBool;
128 mValue.mBool = value;
129 mSet = true;
130 }
131 void set( S32 value )
132 {
133 mType = TypeS32;
134 mValue.mS32 = value;
135 mSet = true;
136 }
137 void set( F32 value )
138 {
139 mType = TypeF32;
140 mValue.mF32 = value;
141 mSet = true;
142 }
143 void set( const char* str )
144 {
145 mType = TypeString;
146 mValue.mString = dStrdup( str );
147 mSet = true;
148 }
149
150 void clean()
151 {
152 if( mType == TypeString )
153 dFree( ( void* ) mValue.mString );
154 mSet = false;
155 }
156 };
157
158 FileStream mStream;
159 Vector< SampleRecord > mRecords;

Callers 1

initMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected