summaryrefslogtreecommitdiff
path: root/external/vpc/public/appframework
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /external/vpc/public/appframework
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'external/vpc/public/appframework')
-rw-r--r--external/vpc/public/appframework/iappsystem.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/external/vpc/public/appframework/iappsystem.h b/external/vpc/public/appframework/iappsystem.h
new file mode 100644
index 0000000..5375fb0
--- /dev/null
+++ b/external/vpc/public/appframework/iappsystem.h
@@ -0,0 +1,121 @@
+//===== Copyright � 1996-2005, Valve Corporation, All rights reserved. ======//
+//
+// Purpose: An application framework
+//
+// $Revision: $
+// $NoKeywords: $
+//===========================================================================//
+
+#ifndef IAPPSYSTEM_H
+#define IAPPSYSTEM_H
+
+#ifdef COMPILER_MSVC
+#pragma once
+#endif
+
+#include "tier1/interface.h"
+#include "interfaces/interfaces.h"
+
+
+//-----------------------------------------------------------------------------
+// Specifies a module + interface name for initialization
+//-----------------------------------------------------------------------------
+struct AppSystemInfo_t
+{
+ const char *m_pModuleName;
+ const char *m_pInterfaceName;
+};
+
+
+//-----------------------------------------------------------------------------
+// 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.
+//-----------------------------------------------------------------------------
+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,
+};
+
+
+abstract_class IAppSystem
+{
+public:
+ // Here's where the app systems get to learn about each other
+ virtual bool Connect( CreateInterfaceFn factory ) = 0;
+ 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
+ virtual void *QueryInterface( const char *pInterfaceName ) = 0;
+
+ // Init, shutdown
+ virtual InitReturnVal_t Init() = 0;
+ virtual void Shutdown() = 0;
+
+ // Returns all dependent libraries
+ virtual const AppSystemInfo_t* GetDependencies() = 0;
+
+ // Returns the tier
+ virtual AppSystemTier_t GetTier() = 0;
+
+ // Reconnect to a particular interface
+ virtual void Reconnect( CreateInterfaceFn factory, const char *pInterfaceName ) = 0;
+};
+
+
+//-----------------------------------------------------------------------------
+// Helper empty implementation of an IAppSystem
+//-----------------------------------------------------------------------------
+template< class IInterface >
+class CBaseAppSystem : public IInterface
+{
+public:
+ // Here's where the app systems get to learn about each other
+ virtual bool Connect( CreateInterfaceFn factory ) { return true; }
+ virtual void Disconnect() {}
+
+ // Here's where systems can access other interfaces implemented by this object
+ // Returns NULL if it doesn't implement the requested interface
+ virtual void *QueryInterface( const char *pInterfaceName ) { return NULL; }
+
+ // Init, shutdown
+ virtual InitReturnVal_t Init() { return INIT_OK; }
+ virtual void Shutdown() {}
+
+ virtual const AppSystemInfo_t* GetDependencies() { return NULL; }
+ virtual AppSystemTier_t GetTier() { return APP_SYSTEM_TIER_OTHER; }
+
+ virtual void Reconnect( CreateInterfaceFn factory, const char *pInterfaceName )
+ {
+ ReconnectInterface( factory, pInterfaceName );
+ }
+};
+
+
+//-----------------------------------------------------------------------------
+// Helper implementation of an IAppSystem for tier0
+//-----------------------------------------------------------------------------
+template< class IInterface >
+class CTier0AppSystem : public CBaseAppSystem< IInterface >
+{
+};
+
+
+#endif // IAPPSYSTEM_H
+