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

Method EvaluateExpression

trinity/Curves/Tr2CurveEulerRotationExpression.cpp:327–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325}
326
327BlueStdResult Tr2CurveEulerRotationExpression::EvaluateExpression( const char* expression, float& value ) const
328{
329 CcpParser::Variable s_variables[] = {
330 { "time", 0, offsetof( Arguments, m_time ) },
331 { "input1", 0, offsetof( Arguments, m_input1 ) },
332 { "input2", 0, offsetof( Arguments, m_input2 ) },
333 { "input3", 0, offsetof( Arguments, m_input3 ) },
334 { "input4", 0, offsetof( Arguments, m_input4 ) },
335 };
336
337 CcpParser::FunctionView functionView[] = { s_functions };
338 CcpParser::ConstantView constantView[] = { s_constants };
339 CcpParser::VariableView variableView[] = { s_variables };
340
341 CcpParser::Externals externals;
342 externals.functions = functionView;
343 externals.variables = variableView;
344 externals.constants = constantView;
345 CcpParser::Program program;
346 auto result = CcpParser::Parse( expression, externals, program );
347 if( !result )
348 {
349 return BlueStdResult( BLUE_STD_RESULT_VALUE_ERROR, ToString( result, expression ).c_str() );
350 }
351 std::unique_ptr<uint8_t[]> tempArena( new uint8_t[program.GetTempArenaSize()] );
352 auto self = this;
353 void* buffers[] = { (void*)&m_arguments, (void*)&self };
354 value = program.Eval( buffers, tempArena.get() );
355 return BlueStdResult();
356}

Callers

nothing calls this directly

Calls 4

ParseFunction · 0.85
EvalMethod · 0.80
getMethod · 0.80
ToStringFunction · 0.50

Tested by

no test coverage detected