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.

62 lines
1.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A higher level link library for general use in the game and tools.
  4. //
  5. //===========================================================================//
  6. #include <tier2/tier2.h>
  7. #include "datamodel/idatamodel.h"
  8. #include "dmserializers/idmserializers.h"
  9. //-----------------------------------------------------------------------------
  10. // Set up methods related to datamodel interfaces
  11. //-----------------------------------------------------------------------------
  12. bool ConnectDataModel( CreateInterfaceFn factory )
  13. {
  14. if ( !g_pDataModel->Connect( factory ) )
  15. return false;
  16. if ( !g_pDmElementFramework->Connect( factory ) )
  17. return false;
  18. if ( !g_pDmSerializers->Connect( factory ) )
  19. return false;
  20. return true;
  21. }
  22. InitReturnVal_t InitDataModel()
  23. {
  24. InitReturnVal_t nRetVal;
  25. nRetVal = g_pDataModel->Init( );
  26. if ( nRetVal != INIT_OK )
  27. return nRetVal;
  28. nRetVal = g_pDmElementFramework->Init();
  29. if ( nRetVal != INIT_OK )
  30. return nRetVal;
  31. nRetVal = g_pDmSerializers->Init();
  32. if ( nRetVal != INIT_OK )
  33. return nRetVal;
  34. return INIT_OK;
  35. }
  36. void ShutdownDataModel()
  37. {
  38. g_pDmSerializers->Shutdown();
  39. g_pDmElementFramework->Shutdown();
  40. g_pDataModel->Shutdown( );
  41. }
  42. void DisconnectDataModel()
  43. {
  44. g_pDmSerializers->Disconnect();
  45. g_pDmElementFramework->Disconnect();
  46. g_pDataModel->Disconnect();
  47. }