MCPcopy Create free account
hub / github.com/carbonengine/trinity / SetValue

Method SetValue

trinity/Controllers/Tr2BindingPoint.cpp:310–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void Tr2BindingPoint::SetValue( float value ) const
311{
312 if( !IsValid() )
313 {
314 return;
315 }
316 switch( m_entry->mType )
317 {
318 case Be::FLOAT:
319 *reinterpret_cast<float*>( m_destination ) = value;
320 break;
321 case Be::DOUBLE:
322 *reinterpret_cast<double*>( m_destination ) = value;
323 break;
324 case Be::BOOL:
325 *reinterpret_cast<bool*>( m_destination ) = value != 0;
326 break;
327 case Be::FLOATARRAY:
328 if( m_entryOffset == -1 )
329 {
330 for( int32_t i = 0; i < m_arraySize; ++i )
331 {
332 reinterpret_cast<float*>( m_destination )[i] = value;
333 }
334 }
335 else
336 {
337 reinterpret_cast<float*>( m_destination )[m_entryOffset] = value;
338 }
339 break;
340 case Be::DOUBLEARRAY:
341 if( m_entryOffset == -1 )
342 {
343 for( int32_t i = 0; i < m_arraySize; ++i )
344 {
345 reinterpret_cast<double*>( m_destination )[i] = value;
346 }
347 }
348 else
349 {
350 reinterpret_cast<double*>( m_destination )[m_entryOffset] = value;
351 }
352 break;
353 default:
354 return;
355 }
356 if( !!m_notifyPtr )
357 {
358 m_notifyPtr->OnModified( m_destination );
359 }
360}
361
362bool Tr2BindingPoint::GetValue( float& value ) const
363{

Callers 9

SetVariableMethod · 0.45
SetVariableMethod · 0.45
StartMethod · 0.45
UpdateMethod · 0.45
UpdateVariableStoreMethod · 0.45
PropagateMethod · 0.45

Calls 2

IsValidFunction · 0.50
OnModifiedMethod · 0.45

Tested by

no test coverage detected