diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /public/tier2/tier2dm.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'public/tier2/tier2dm.h')
| -rw-r--r-- | public/tier2/tier2dm.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/public/tier2/tier2dm.h b/public/tier2/tier2dm.h new file mode 100644 index 0000000..40ce58b --- /dev/null +++ b/public/tier2/tier2dm.h @@ -0,0 +1,76 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: A higher level link library for general use in the game and tools. +// +//===========================================================================// + + +#ifndef TIER2DM_H +#define TIER2DM_H + +#if defined( _WIN32 ) +#pragma once +#endif + +#include "tier2/tier2.h" + +//----------------------------------------------------------------------------- +// Set up methods related to datamodel interfaces +//----------------------------------------------------------------------------- +bool ConnectDataModel( CreateInterfaceFn factory ); +InitReturnVal_t InitDataModel(); +void ShutdownDataModel(); +void DisconnectDataModel(); + +//----------------------------------------------------------------------------- +// Helper empty implementation of an IAppSystem for tier2 libraries +//----------------------------------------------------------------------------- +template< class IInterface, int ConVarFlag = 0 > +class CTier2DmAppSystem : public CTier2AppSystem< IInterface, ConVarFlag > +{ + typedef CTier2AppSystem< IInterface, ConVarFlag > BaseClass; + +public: + CTier2DmAppSystem( bool bIsPrimaryAppSystem = true ) : BaseClass( bIsPrimaryAppSystem ) + { + } + + virtual bool Connect( CreateInterfaceFn factory ) + { + if ( !BaseClass::Connect( factory ) ) + return false; + + ConnectDataModel( factory ); + + return true; + } + + virtual InitReturnVal_t Init() + { + InitReturnVal_t nRetVal = BaseClass::Init(); + if ( nRetVal != INIT_OK ) + return nRetVal; + + nRetVal = InitDataModel(); + if ( nRetVal != INIT_OK ) + return nRetVal; + + return INIT_OK; + } + + virtual void Shutdown() + { + ShutdownDataModel(); + BaseClass::Shutdown(); + } + + virtual void Disconnect() + { + DisconnectDataModel(); + BaseClass::Disconnect(); + } +}; + + +#endif // TIER2DM_H + |