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.

79 lines
3.4 KiB

  1. //====== Copyright � 1996-2009, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: Declaration of the CDmeConnectionOperator class, a CDmeOperator
  4. // which copies one attribute value to another, providing similar functionality
  5. // to CDmeChannel, but does not store a log and is not effected by the
  6. // recording mode.
  7. //
  8. //=============================================================================
  9. #ifndef DMECONNECTIONOPERATOR_H
  10. #define DMECONNECTIONOPERATOR_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "movieobjects/dmeattributereference.h"
  15. #include "movieobjects/dmeoperator.h"
  16. //-------------------------------------------------------------------------------------------------
  17. // The CDmeConnectionOperator class is a CDmeOperator which copies the value from one attribute
  18. // to another. The CDmeConnectionOperator is frequently used in combination with the
  19. // CDmeExpressionOperator to allow a single value, often on controlled by a channel, to drive the
  20. // value of multiple targets. The connection operator may have multiple outputs, but only one
  21. // input. Only a single input is allowed because allowing multiple inputs would mean that the
  22. // operator could actually represent multiple unrelated connections, and this would could cause
  23. // various dependency and evaluation issues. Multiple outputs are allowed as it reduces the number
  24. // of individual operators required to accomplish many setups, all of the connections must be
  25. // related, and the dependency chain is essentially the same as having individual operators for
  26. // each connection, as the operator with multiple outputs can always be evaluated immediately
  27. // following the evaluation of its single input.
  28. //-------------------------------------------------------------------------------------------------
  29. class CDmeConnectionOperator : public CDmeOperator
  30. {
  31. DEFINE_ELEMENT( CDmeConnectionOperator, CDmeOperator );
  32. public:
  33. // Run the operator, which copies the value from the source attribute to the destination attributes.
  34. virtual void Operate();
  35. // Add the input attribute used by the operator to the provided list of attributes, This is
  36. // generally used by the evaluation process to find the attributes an operator is dependent on.
  37. virtual void GetInputAttributes( CUtlVector< CDmAttribute * > &attrs );
  38. // Add each of attributes the connection operator outputs to the provided list of attributes.
  39. // This is generally used by the evaluation process to find out what attributes are written by
  40. // the operator in order to determine what other operators are dependent on this operator.
  41. virtual void GetOutputAttributes( CUtlVector< CDmAttribute * > &attrs );
  42. // Determine if data has changed and the operator needs to be updated
  43. virtual bool IsDirty();
  44. // Set the input attribute of the connection.
  45. void SetInput( CDmElement* pElement, const char* pchAttributeName, int index = 0 );
  46. // Add an attribute to be written to by the connection.
  47. void AddOutput( CDmElement* pElement, const char* pchAttributeName, int index = 0 );
  48. // Get the number of output attributes
  49. int NumOutputAttributes() const;
  50. // Get the specified output attribute
  51. CDmAttribute *GetOutputAttribute( int index ) const;
  52. // Get the input attribute
  53. CDmAttribute *GetInputAttribute();
  54. protected:
  55. CDmaElement< CDmeAttributeReference > m_Input; // Reference to the input attribute
  56. CDmaElementArray< CDmeAttributeReference > m_Outputs; // Array of references to output attributes
  57. };
  58. #endif // DMECONNECTIONOPERATOR_H