FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
TF2-Source-Code/tf2_src/public/appframework/IAppSystem.h at master · sr2echa/TF2-Source-Code · GitHub
sr2echa
/
TF2-Source-Code
Public
Notifications
You must be signed in to change notification settings
Fork
22
Star
81
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
TF2-Source-Code
/
tf2_src
/
public
/
appframework
/
IAppSystem.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
122 lines (96 loc) · 3.71 KB
Breadcrumbs
TF2-Source-Code
/
tf2_src
/
public
/
appframework
/
IAppSystem.h
Copy path
File metadata and controls
122 lines (96 loc) · 3.71 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//
========= Copyright Valve Corporation, All rights reserved. ============//
//
//
Purpose: An application framework
//
//
$Revision: $
//
$NoKeywords: $
//
=============================================================================//
#
ifndef
IAPPSYSTEM_H
#
define
IAPPSYSTEM_H
#
ifdef
_WIN32
#
pragma
once
#
endif
#
include
"
tier1/interface.h
"
//
-----------------------------------------------------------------------------
//
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
,
};
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
;
};
//
-----------------------------------------------------------------------------
//
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
() {}
};
//
-----------------------------------------------------------------------------
//
Helper implementation of an IAppSystem for tier0
//
-----------------------------------------------------------------------------
template
<
class
IInterface
>
class
CTier0AppSystem
:
public
CBaseAppSystem
< IInterface >
{
public:
CTier0AppSystem
(
bool
bIsPrimaryAppSystem =
true
)
{
m_bIsPrimaryAppSystem = bIsPrimaryAppSystem;
}
protected:
//
NOTE: a single DLL may have multiple AppSystems it's trying to
//
expose. If this is true, you must return true from only
//
one of those AppSystems; not doing so will cause all static
//
libraries connected to it to connect/disconnect multiple times
//
NOTE: We don't do this as a virtual function to avoid
//
having to up the version on all interfaces
bool
IsPrimaryAppSystem
() {
return
m_bIsPrimaryAppSystem; }
private:
bool
m_bIsPrimaryAppSystem;
};
//
-----------------------------------------------------------------------------
//
This is the version of IAppSystem shipped 10/15/04
//
NOTE: Never change this!!!
//
-----------------------------------------------------------------------------
abstract_class IAppSystemV0
{
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
;
};
#
endif
//
IAPPSYSTEM_H
Back
|
FazBrowse Home
|
New Git URL