Team Fortress 2 Source Code as on 22/4/2020
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.

77 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef DMELEMENTFRAMEWORK_H
  7. #define DMELEMENTFRAMEWORK_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "datamodel/idatamodel.h"
  12. #include "tier1/utlvector.h"
  13. #include "dependencygraph.h"
  14. //-----------------------------------------------------------------------------
  15. // element framework implementation
  16. //-----------------------------------------------------------------------------
  17. class CDmElementFramework : public IDmElementFramework
  18. {
  19. public:
  20. CDmElementFramework();
  21. public:
  22. // Methods of IAppSystem
  23. virtual bool Connect( CreateInterfaceFn factory );
  24. virtual void Disconnect();
  25. virtual void *QueryInterface( const char *pInterfaceName );
  26. virtual InitReturnVal_t Init();
  27. virtual void Shutdown();
  28. // Methods of IDmElementFramework
  29. virtual DmPhase_t GetPhase();
  30. virtual void SetOperators( const CUtlVector< IDmeOperator* > &operators );
  31. virtual void BeginEdit(); // ends in edit phase, forces apply/resolve if from edit phase
  32. virtual void Operate( bool bResolve ); // ends in output phase
  33. virtual void Resolve();
  34. public:
  35. // Other public methods
  36. void AddElementToDirtyList( DmElementHandle_t hElement );
  37. void RemoveCleanElementsFromDirtyList();
  38. // Non-virtual methods of identical virtual functions
  39. DmPhase_t FastGetPhase();
  40. private:
  41. void EditApply();
  42. // Invoke the resolve method
  43. void Resolve( bool clearDirtyFlags );
  44. CDependencyGraph m_dependencyGraph;
  45. CUtlVector< DmElementHandle_t > m_dirtyElements;
  46. DmPhase_t m_phase;
  47. };
  48. //-----------------------------------------------------------------------------
  49. // Singleton
  50. //-----------------------------------------------------------------------------
  51. extern CDmElementFramework *g_pDmElementFrameworkImp;
  52. //-----------------------------------------------------------------------------
  53. // Inline methods
  54. //-----------------------------------------------------------------------------
  55. inline DmPhase_t CDmElementFramework::FastGetPhase()
  56. {
  57. return m_phase;
  58. }
  59. #endif // DMELEMENTFRAMEWORK_H