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.

76 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef SV_SESSIONPUBLISHMANAGER_H
  5. #define SV_SESSIONPUBLISHMANAGER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "replay/replayhandle.h"
  11. //----------------------------------------------------------------------------------------
  12. class CServerRecordingSession;
  13. class CSessionBlockPublisher;
  14. class CSessionInfoPublisher;
  15. //----------------------------------------------------------------------------------------
  16. //
  17. // CSessionPublishManager takes care of all the publishing for a particular session.
  18. // For asynchronous publishing of block and session info data, publishing can
  19. // sometimes overlap between rounds, as is sometimes the case for FTP.
  20. //
  21. // A CSessionPublishManager instance are created by passing in the in-progress recording
  22. // session into the constructor.
  23. //
  24. // CSessionRecorder maintains a list of CSessionPublishManager instances and cleans
  25. // them up once all publishing for their corresponding session is completed.
  26. //
  27. class CSessionPublishManager
  28. {
  29. public:
  30. CSessionPublishManager( CServerRecordingSession *pSession );
  31. ~CSessionPublishManager();
  32. void Think(); // Called explicitly
  33. // Finish any publish jobs synchronously
  34. void PublishAllSynchronous();
  35. // Have all publish job completed?
  36. bool IsDone() const;
  37. // This will flag this publish manager as recording
  38. void OnStartRecording();
  39. // This will write out and publish any final session block
  40. void OnStopRecord( bool bAborting );
  41. // Get the handle for the associated session
  42. ReplayHandle_t GetSessionHandle() const;
  43. // Unlock the associated session - this should only be called if IsDone() returns true.
  44. void UnlockSession();
  45. // Abort publishing
  46. void AbortPublish();
  47. #ifdef _DEBUG
  48. void Validate();
  49. #endif
  50. private:
  51. CServerRecordingSession *m_pSession;
  52. CSessionBlockPublisher *m_pBlockPublisher;
  53. CSessionInfoPublisher *m_pSessionInfoPublisher;
  54. };
  55. //----------------------------------------------------------------------------------------
  56. #endif // SV_SESSIONPUBLISHMANAGER_H