Counter Strike : Global Offensive Source Code
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.

72 lines
1.7 KiB

  1. //===== Copyright � 2005-2005, Valve Corporation, All rights reserved. ======//
  2. //
  3. // Purpose: A higher level link library for general use in the game and tools.
  4. //
  5. //===========================================================================//
  6. #ifndef TIER2DM_H
  7. #define TIER2DM_H
  8. #if defined( _WIN32 )
  9. #pragma once
  10. #endif
  11. #include "tier2/tier2.h"
  12. //-----------------------------------------------------------------------------
  13. // Set up methods related to datamodel interfaces
  14. //-----------------------------------------------------------------------------
  15. bool ConnectDataModel( CreateInterfaceFn factory );
  16. InitReturnVal_t InitDataModel();
  17. void ShutdownDataModel();
  18. void DisconnectDataModel();
  19. //-----------------------------------------------------------------------------
  20. // Helper empty implementation of an IAppSystem for tier2 libraries
  21. //-----------------------------------------------------------------------------
  22. template< class IInterface, int ConVarFlag = 0 >
  23. class CTier2DmAppSystem : public CTier2AppSystem< IInterface, ConVarFlag >
  24. {
  25. typedef CTier2AppSystem< IInterface, ConVarFlag > BaseClass;
  26. public:
  27. virtual bool Connect( CreateInterfaceFn factory )
  28. {
  29. if ( !BaseClass::Connect( factory ) )
  30. return false;
  31. ConnectDataModel( factory );
  32. return true;
  33. }
  34. virtual InitReturnVal_t Init()
  35. {
  36. InitReturnVal_t nRetVal = BaseClass::Init();
  37. if ( nRetVal != INIT_OK )
  38. return nRetVal;
  39. nRetVal = InitDataModel();
  40. if ( nRetVal != INIT_OK )
  41. return nRetVal;
  42. return INIT_OK;
  43. }
  44. virtual void Shutdown()
  45. {
  46. ShutdownDataModel();
  47. BaseClass::Shutdown();
  48. }
  49. virtual void Disconnect()
  50. {
  51. DisconnectDataModel();
  52. BaseClass::Disconnect();
  53. }
  54. };
  55. #endif // TIER2DM_H