TexGen
ShinyZone.h
Go to the documentation of this file.
1/*
2The zlib/libpng License
3
4Copyright (c) 2007 Aidin Abedi (www.*)
5
6This software is provided 'as-is', without any express or implied warranty. In no event will
7the authors be held liable for any damages arising from the use of this software.
8
9Permission is granted to anyone to use this software for any purpose, including commercial
10applications, and to alter it and redistribute it freely, subject to the following
11restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not claim that
14 you wrote the original software. If you use this software in a product,
15 an acknowledgment in the product documentation would be appreciated but is
16 not required.
17
18 2. Altered source versions must be plainly marked as such, and must not be
19 misrepresented as being the original software.
20
21 3. This notice may not be removed or altered from any source distribution.
22*/
23
24#ifndef SHINY_ZONE_H
25#define SHINY_ZONE_H
26
27#include "ShinyData.h"
28
29#if SHINY_PROFILER == TRUE
30namespace Shiny {
31
32
33//-----------------------------------------------------------------------------
34
35 struct ProfileZone {
36
37 enum STATE {
41 };
42
43 //NOTE: data-members are intentionally public because the
44 // class needs to fulfil the definition of an aggregate
45
47
49
50 mutable const char* name;
51
53
54 //
55
56 bool isInited(void) const { return _state != 0; }
57
58 void init(ProfileZone* a_prev) {
60
61 a_prev->next = this;
62 }
63
64 void uninit(void) {
66 }
67
68 void preUpdateChain(void) {
70 if (next) next->preUpdateChain();
71 }
72
73 void updateChain(float a_damping) {
74 data.computeAverage(a_damping);
75 if (next) next->updateChain(a_damping);
76 }
77
78 bool isUpdating(void) const { return _state == STATE_UPDATING; }
79
82 };
83
84} // namespace Shiny
85#endif // if SHINY_PROFILER == TRUE
86
87#endif // ifndef SHINY_*_H
void computeAverage(float a_damping)
Definition: ShinyData.h:62
void clearCurrent(void)
Definition: ShinyData.h:74
void enableUpdating(void)
Definition: ShinyZone.h:80
const char * name
Definition: ShinyZone.h:50
bool isUpdating(void) const
Definition: ShinyZone.h:78
void disableUpdating(void)
Definition: ShinyZone.h:81
bool isInited(void) const
Definition: ShinyZone.h:56
void init(ProfileZone *a_prev)
Definition: ShinyZone.h:58
void updateChain(float a_damping)
Definition: ShinyZone.h:73
ProfileZone * next
Definition: ShinyZone.h:46
void uninit(void)
Definition: ShinyZone.h:64
ProfileData data
Definition: ShinyZone.h:52
void preUpdateChain(void)
Definition: ShinyZone.h:68