2022-08-13 11:24:55 +02:00
|
|
|
|
//===== Copyright <20> 1996-2005, Valve Corporation, All rights reserved. ======//
|
|
|
|
|
//
|
|
|
|
|
// Purpose: An application framework
|
|
|
|
|
//
|
|
|
|
|
// $Revision: $
|
|
|
|
|
// $NoKeywords: $
|
|
|
|
|
//===========================================================================//
|
|
|
|
|
|
|
|
|
|
#ifndef IAPPSYSTEM_H
|
|
|
|
|
#define IAPPSYSTEM_H
|
|
|
|
|
|
|
|
|
|
#include <vpc/interfaces.h>
|
|
|
|
|
|
2022-02-22 02:45:40 +01:00
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Specifies a module + interface name for initialization
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
struct AppSystemInfo_t
|
|
|
|
|
{
|
|
|
|
|
const char* m_pModuleName;
|
|
|
|
|
const char* m_pInterfaceName;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2022-08-13 11:24:55 +02:00
|
|
|
|
// Client systems are singleton objects in the client codebase responsible for
|
|
|
|
|
// various tasks
|
|
|
|
|
// The order in which the client systems appear in this list are the
|
|
|
|
|
// order in which they are initialized and updated. They are shut down in
|
|
|
|
|
// reverse order from which they are initialized.
|
2022-02-22 02:45:40 +01:00
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
enum InitReturnVal_t
|
|
|
|
|
{
|
|
|
|
|
INIT_FAILED = 0,
|
|
|
|
|
INIT_OK,
|
|
|
|
|
|
|
|
|
|
INIT_LAST_VAL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
enum AppSystemTier_t
|
|
|
|
|
{
|
|
|
|
|
APP_SYSTEM_TIER0 = 0,
|
|
|
|
|
APP_SYSTEM_TIER1,
|
|
|
|
|
APP_SYSTEM_TIER2,
|
|
|
|
|
APP_SYSTEM_TIER3,
|
|
|
|
|
|
|
|
|
|
APP_SYSTEM_TIER_OTHER,
|
|
|
|
|
};
|
2022-08-13 11:24:55 +02:00
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
abstract_class IAppSystem
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-01-12 01:19:49 +01:00
|
|
|
|
virtual ~IAppSystem() {}; // Prepended on each class derived class in assembly.
|
2023-02-06 02:15:01 +01:00
|
|
|
|
|
2022-08-13 11:24:55 +02:00
|
|
|
|
// Here's where the app systems get to learn about each other
|
2024-04-05 16:53:51 +02:00
|
|
|
|
virtual bool Connect(const CreateInterfaceFn factory) = 0;
|
2022-08-13 11:24:55 +02:00
|
|
|
|
virtual void Disconnect() = 0;
|
|
|
|
|
|
|
|
|
|
// Here's where systems can access other interfaces implemented by this object
|
|
|
|
|
// Returns NULL if it doesn't implement the requested interface
|
2024-04-05 16:53:51 +02:00
|
|
|
|
virtual void* QueryInterface(const char* const pInterfaceName) = 0;
|
2022-08-13 11:24:55 +02:00
|
|
|
|
|
|
|
|
|
// Init, shutdown
|
|
|
|
|
virtual InitReturnVal_t Init() = 0;
|
|
|
|
|
virtual void Shutdown() = 0;
|
|
|
|
|
|
|
|
|
|
// Returns all dependent libraries
|
|
|
|
|
//virtual const AppSystemInfo_t* GetDependencies() { return NULL; }
|
|
|
|
|
|
|
|
|
|
// Returns the tier
|
|
|
|
|
virtual AppSystemTier_t GetTier() = 0;
|
|
|
|
|
|
|
|
|
|
// Reconnect to a particular interface
|
2024-04-05 16:53:51 +02:00
|
|
|
|
virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0;
|
2022-08-13 11:24:55 +02:00
|
|
|
|
};
|
|
|
|
|
|
2023-02-05 11:01:27 +01:00
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Helper empty implementation of an IAppSystem
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
template< class IInterface >
|
|
|
|
|
class CBaseAppSystem : public IInterface
|
|
|
|
|
{
|
|
|
|
|
public:
|
2024-01-12 01:19:49 +01:00
|
|
|
|
virtual ~CBaseAppSystem() {}; // Prepended on each class derived class in assembly.
|
2023-02-06 02:15:01 +01:00
|
|
|
|
|
2023-02-05 11:01:27 +01:00
|
|
|
|
// Here's where the app systems get to learn about each other
|
2024-04-05 16:53:51 +02:00
|
|
|
|
virtual bool Connect(const CreateInterfaceFn factory) = 0;
|
2023-02-05 11:01:27 +01:00
|
|
|
|
virtual void Disconnect() = 0;
|
|
|
|
|
|
|
|
|
|
// Here's where systems can access other interfaces implemented by this object
|
|
|
|
|
// Returns NULL if it doesn't implement the requested interface
|
2024-04-05 16:53:51 +02:00
|
|
|
|
virtual void* QueryInterface(const char* const pInterfaceName) = 0;
|
2023-02-05 11:01:27 +01:00
|
|
|
|
|
|
|
|
|
// Init, shutdown
|
|
|
|
|
virtual InitReturnVal_t Init() = 0;
|
|
|
|
|
virtual void Shutdown() = 0;
|
|
|
|
|
|
|
|
|
|
// Returns all dependent libraries
|
|
|
|
|
//virtual const AppSystemInfo_t* GetDependencies() { return NULL; }
|
|
|
|
|
|
|
|
|
|
// Returns the tier
|
|
|
|
|
virtual AppSystemTier_t GetTier() = 0;
|
|
|
|
|
|
|
|
|
|
// Reconnect to a particular interface
|
2024-04-05 16:53:51 +02:00
|
|
|
|
virtual void Reconnect(const CreateInterfaceFn factory, const char* const pInterfaceName) = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
// Helper implementation of an IAppSystem for tier0
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
template< class IInterface >
|
|
|
|
|
class CTier0AppSystem : public CBaseAppSystem< IInterface >
|
|
|
|
|
{
|
2023-02-05 11:01:27 +01:00
|
|
|
|
};
|
|
|
|
|
|
2022-08-13 11:24:55 +02:00
|
|
|
|
#endif // IAPPSYSTEM_H
|