summaryrefslogtreecommitdiff
path: root/replay/sv_recordingsessionblock.h
blob: 4d473eb5fef89e0bb07832455ba9cce40f34e8b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//========= Copyright Valve Corporation, All rights reserved. ============//
//
//=======================================================================================//

#ifndef SV_RECORDINGSESSIONBLOCK_H
#define SV_RECORDINGSESSIONBLOCK_H
#ifdef _WIN32
#pragma once
#endif

//----------------------------------------------------------------------------------------

#include "baserecordingsessionblock.h"

//----------------------------------------------------------------------------------------

class IFilePublisher;

//----------------------------------------------------------------------------------------

class CServerRecordingSessionBlock : public CBaseRecordingSessionBlock
{
	typedef CBaseRecordingSessionBlock BaseClass;

public:
	CServerRecordingSessionBlock( IReplayContext *pContext );

	virtual bool		Read( KeyValues *pIn );
	virtual void		Write( KeyValues *pOut );

	double				GetSecondsToExpiration();

	enum WriteStatus_t
	{
		WRITESTATUS_INVALID = -1,
		WRITESTATUS_WORKING,
		WRITESTATUS_SUCCESS,
		WRITESTATUS_FAILED
	};

	WriteStatus_t	m_nWriteStatus;				// SERVER: initially set to WRITESTATUS_INVALID, then set to STATUS_WORKING, STATUS_SUCCESS,
												// or STATUS_FAILED, depending on the state of the write process (which runs on a separate thread
	IFilePublisher	*m_pPublisher;				// Managed by session recorder

private:
	virtual void		OnDelete();
};

//----------------------------------------------------------------------------------------

inline CServerRecordingSessionBlock *SV_CastBlock( IReplaySerializeable *pBlock )
{
	return static_cast< CServerRecordingSessionBlock * >( pBlock );
}

inline const CServerRecordingSessionBlock *SV_CastBlock( const IReplaySerializeable *pBlock )
{
	return static_cast< const CServerRecordingSessionBlock * >( pBlock );
}

//----------------------------------------------------------------------------------------

#endif // SV_RECORDINGSESSIONBLOCK_H