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.8 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef BASERECORDINGSESSIONBLOCKMANAGER_H
  5. #define BASERECORDINGSESSIONBLOCKMANAGER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "genericpersistentmanager.h"
  11. #include "replay/replayhandle.h"
  12. #include "replay/irecordingsessionblockmanager.h"
  13. #include "utlstring.h"
  14. #include "baserecordingsession.h"
  15. #include "replay/basereplayserializeable.h"
  16. #include "baserecordingsessionblock.h"
  17. //----------------------------------------------------------------------------------------
  18. class KeyValues;
  19. class CBaseReplayContext;
  20. class IReplayContext;
  21. //----------------------------------------------------------------------------------------
  22. //
  23. // Maintains a persistent list of session blocks in a keyvalues file
  24. //
  25. class CBaseRecordingSessionBlockManager : public CGenericPersistentManager< CBaseRecordingSessionBlock >,
  26. public IRecordingSessionBlockManager
  27. {
  28. typedef CGenericPersistentManager< CBaseRecordingSessionBlock > BaseClass;
  29. public:
  30. CBaseRecordingSessionBlockManager( IReplayContext *pContext );
  31. virtual bool Init();
  32. //
  33. // IRecordingSessionBlockManager
  34. //
  35. CBaseRecordingSessionBlock *GetBlock( ReplayHandle_t hBlock );
  36. virtual void DeleteBlock( CBaseRecordingSessionBlock *pBlock );
  37. virtual void UnloadBlock( CBaseRecordingSessionBlock *pBlock );
  38. virtual const char *GetBlockPath() const;
  39. virtual void LoadBlockFromFileName( const char *pFilename, IRecordingSession *pSession ); // NOTE: This will not actually add the block to the session block manager - this is for loading blocks and adding them to recording sessions so they can be deleted from disk and cleaned up from the fileserver if necessary.
  40. // Find the block for with the given reconstruction index for the given session
  41. CBaseRecordingSessionBlock *FindBlockForSession( ReplayHandle_t hSession, int iReconstruction );
  42. // Gets something like "replays/<client|server>/blocks/"
  43. const char *GetSavePath() const;
  44. protected:
  45. virtual bool ShouldSerializeToIndividualFiles() const { return true; }
  46. virtual const char *GetRelativeIndexPath() const;
  47. virtual bool ShouldLoadBlocks() const = 0;
  48. //
  49. // CBaseThinker
  50. //
  51. virtual float GetNextThinkTime() const;
  52. IReplayContext *m_pContext;
  53. private:
  54. virtual const char *GetDebugName() const { return "block manager"; }
  55. virtual int GetVersion() const;
  56. virtual const char *GetIndexFilename() const { return "blocks." GENERIC_FILE_EXTENSION; }
  57. };
  58. //----------------------------------------------------------------------------------------
  59. #endif // BASERECORDINGSESSIONBLOCKMANAGER_H