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.

65 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef SV_SESSIONINFOPUBLISHER_H
  5. #define SV_SESSIONINFOPUBLISHER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "utlbuffer.h"
  11. #include "sv_filepublish.h"
  12. #include "replay/replaytime.h"
  13. #include "sessioninfoheader.h"
  14. //----------------------------------------------------------------------------------------
  15. class CServerRecordingSession;
  16. class IFilePublisher;
  17. //----------------------------------------------------------------------------------------
  18. class CSessionInfoPublisher : public IPublishCallbackHandler
  19. {
  20. public:
  21. CSessionInfoPublisher( CServerRecordingSession *pSession );
  22. ~CSessionInfoPublisher();
  23. void Publish();
  24. void PublishAllSynchronous();
  25. bool IsPublishingSessionInfo() const { return m_flSessionInfoPublishTime != 0.0f || m_pFilePublisher; }
  26. bool IsDone() const;
  27. void OnStopRecord( bool bAborting );
  28. void AbortPublish();
  29. void Think(); // Called explicitly
  30. private:
  31. //
  32. // IPublishCallback
  33. //
  34. virtual void OnPublishComplete( const IFilePublisher *pPublisher, void *pUserData );
  35. virtual void OnPublishAborted( const IFilePublisher *pPublisher );
  36. virtual void AdjustHeader( const IFilePublisher *pPublisher, void *pHeaderData );
  37. void RefreshSessionInfoBlockData( CUtlBuffer &buf );
  38. IFilePublisher *m_pFilePublisher;
  39. float m_flSessionInfoPublishTime;
  40. SessionInfoHeader_t m_SessionInfoHeader;
  41. int m_itLastCompletedBlockWrittenToBuffer; // The last block written to the buffer that isn't going to change state
  42. CUtlBuffer m_bufSessionInfo; // Growable buffer for the session info block data (does not include header)
  43. CServerRecordingSession *m_pSession;
  44. bool m_bShouldPublish; // True if we should publish - can be true while already publishing. Means another publish is needed.
  45. };
  46. //----------------------------------------------------------------------------------------
  47. #endif // SV_SESSIONINFOPUBLISHER_H