Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // The expression operator class - scalar math calculator
  4. // for a good list of operators and simple functions, see:
  5. // \\fileserver\user\MarcS\boxweb\aliveDistLite\v4.2.0\doc\alive\functions.txt
  6. // (although we'll want to implement elerp as the standard 3x^2 - 2x^3 with rescale)
  7. //
  8. //=============================================================================
  9. #ifndef DMEEXPRESSIONOPERATOR_H
  10. #define DMEEXPRESSIONOPERATOR_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "movieobjects/dmeoperator.h"
  15. #include "mathlib/expressioncalculator.h"
  16. //-----------------------------------------------------------------------------
  17. // An operator which computes the value of expressions
  18. //-----------------------------------------------------------------------------
  19. class CDmeExpressionOperator : public CDmeOperator
  20. {
  21. DEFINE_ELEMENT( CDmeExpressionOperator, CDmeOperator );
  22. public:
  23. virtual void Operate();
  24. virtual void GetInputAttributes ( CUtlVector< CDmAttribute * > &attrs );
  25. virtual void GetOutputAttributes( CUtlVector< CDmAttribute * > &attrs );
  26. void SetSpewResult( bool state );
  27. protected:
  28. bool Parse( const char *expr );
  29. bool IsInputAttribute( CDmAttribute *pAttribute );
  30. CExpressionCalculator m_calc;
  31. CDmaVar< float > m_result;
  32. CDmaString m_expr;
  33. CDmaVar< bool > m_bSpewResult;
  34. };
  35. #endif // DMEEXPRESSIONOPERATOR_H