Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
internal_highlevel.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
20// $File: //depot/GeneralsMD/Staging/code/Libraries/Source/profile/internal_highlevel.h $
21// $Author: mhoffe $
22// $Revision: #2 $
23// $DateTime: 2003/08/14 13:43:29 $
24//
25// ©2003 Electronic Arts
26//
27// High level profiling (internal header)
29#ifdef _MSC_VER
30# pragma once
31#endif
32#ifndef INTERNAL_HIGHLEVEL_H // Include guard
33#define INTERNAL_HIGHLEVEL_H
34
36class ProfileId
37{
38 ProfileId(const ProfileId&);
39 ProfileId& operator=(const ProfileId&);
40
41public:
51 ProfileId(const char *name, const char *descr, const char *unit, int precision, int exp10);
52
58 static ProfileId *GetFirst(void) { return first; }
59
65 ProfileId *GetNext(void) const { return m_next; }
66
72 const char *GetName(void) const { return m_name; }
73
79 const char *GetUnit(void) const { return m_unit?m_unit:""; }
80
86 const char *GetDescr(void) const { return m_descr?m_descr:""; }
87
93 void Increment(double add);
94
100 void Maximum(double max);
101
107 double GetCurrentValue(void)
108 {
109 double help=m_curVal;
110 m_curVal=0.;
111 return help;
112 }
113
119 double GetTotalValue(void) const
120 {
121 return m_totalVal;
122 }
123
131 bool GetFrameValue(unsigned frame, double &value) const
132 {
133 if (frame<(unsigned)m_firstFrame||
134 frame>=(unsigned)curFrame)
135 return false;
136 value=m_recFrameVal[frame-m_firstFrame];
137 return true;
138 }
139
146 const char *AsString(double v) const;
147
151 static void Shutdown(void);
152
156 static int FrameStart(void);
157
161 static void FrameEnd(int which, int mixIndex);
162
166 static void ClearTotals(void)
167 {
168 for (ProfileId *cur=first;cur;cur=cur->m_next)
169 cur->m_totalVal=0.;
170 }
171
172private:
176 ~ProfileId() {}
177
178 enum
179 {
181 MAX_FRAME_RECORDS = 4,
182
184 STRING_BUFFER_SIZE = 1024
185 };
186
188 enum ValueMode
189 {
190 Unknown,
191 ModeIncrement,
192 ModeMaximum
193 };
194
196 static ProfileId *first;
197
199 ProfileId *m_next;
200
202 char *m_name;
203
205 char *m_descr;
206
208 char *m_unit;
209
211 int m_precision;
212
214 int m_exp10;
215
217 double m_curVal;
218
220 double m_totalVal;
221
223 double m_frameVal[MAX_FRAME_RECORDS];
224
226 double *m_recFrameVal;
227
229 int m_firstFrame;
230
232 ValueMode m_valueMode;
233
235 static int curFrame;
236
238 static unsigned frameRecordMask;
239
241 static char stringBuf[STRING_BUFFER_SIZE];
242
244 static unsigned stringBufUnused;
245};
246
247#endif // INTERNAL_HIGHLEVEL_H
#define max(x, y)
Definition BaseType.h:105
void const char * value
void add(float *sum, float *addend)
an internal high level profile ID
static int FrameStart(void)
static void ClearTotals(void)
const char * GetName(void) const
double GetTotalValue(void) const
void Increment(double add)
void Maximum(double max)
const char * GetDescr(void) const
ProfileId * GetNext(void) const
bool GetFrameValue(unsigned frame, double &value) const
const char * GetUnit(void) const
static ProfileId * GetFirst(void)
static void Shutdown(void)
const char * AsString(double v) const
static void FrameEnd(int which, int mixIndex)
double GetCurrentValue(void)