summaryrefslogtreecommitdiff
path: root/tier2/dmconnect.cpp
blob: b8b41f197aa618ae85e42d5a01a14333993f2791 (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//===========================================================================//

#include <tier2/tier2.h>
#include "datamodel/idatamodel.h"
#include "dmserializers/idmserializers.h"


//-----------------------------------------------------------------------------
// Set up methods related to datamodel interfaces
//-----------------------------------------------------------------------------
bool ConnectDataModel( CreateInterfaceFn factory )
{
	if ( !g_pDataModel->Connect( factory ) )
		return false;

	if ( !g_pDmElementFramework->Connect( factory ) )
		return false;

	if ( !g_pDmSerializers->Connect( factory ) )
		return false;

	return true;
}

InitReturnVal_t InitDataModel()
{
	InitReturnVal_t nRetVal;

	nRetVal = g_pDataModel->Init( );
	if ( nRetVal != INIT_OK )
		return nRetVal;

	nRetVal = g_pDmElementFramework->Init();
	if ( nRetVal != INIT_OK )
		return nRetVal;

	nRetVal = g_pDmSerializers->Init();
	if ( nRetVal != INIT_OK )
		return nRetVal;

	return INIT_OK;
}

void ShutdownDataModel()
{
	g_pDmSerializers->Shutdown();
	g_pDmElementFramework->Shutdown();
	g_pDataModel->Shutdown( );
}

void DisconnectDataModel()
{
	g_pDmSerializers->Disconnect();
	g_pDmElementFramework->Disconnect();
	g_pDataModel->Disconnect();
}