1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "nel/misc/types_nl.h"
24 #include <nel/misc/rgba.h>
25 #include <nel/misc/time_nl.h>
30 #include "time_client.h"
40 * Graph class for network statistics
41 * \author Vianney Lecroart, Olivier Cado
42 * \author Nevrax France
49 float X
, Y
, Width
, Height
;
50 NLMISC::CRGBA BackColor
;
57 std::deque
<float> Values
;
59 NLMISC::TTime Quantum
;
61 NLMISC::TTime CurrentQuantumStart
;
63 /// Init driver and text context
64 static void init (NL3D::UDriver
*driver
)
69 /// Render all available graph
70 static void render (uint page
);
77 for (uint i
= 0; i
< _Graphs
->size(); i
++)
79 if ((*_Graphs
)[i
] == this)
81 _Graphs
->erase (_Graphs
->begin()+i
);
89 /// Constructor (CGraph::init() must have been called before)
90 CGraph (std::string name
,
91 float x
, float y
, float width
, float height
,
92 NLMISC::CRGBA backColor
,
93 NLMISC::TTime quantum
,
94 float maxValue
, uint page
,
95 bool lineMode
= false)
96 : Name(name
), X(x
), Y(y
), Width(width
), Height(height
), BackColor(backColor
), MaxValue(maxValue
),
97 Peak(0.0f
), LineMode(lineMode
), PrevY(y
), Page(page
), Quantum(quantum
), CurrentQuantumStart(ryzomGetLocalTime ())
101 _Graphs
= new std::vector
<CGraph
*>;
104 _Graphs
->push_back (this);
108 void addOneValue (float value
= 0.0f
);
111 void addValue (float value
);
113 static bool DisplayAverageValue
;
118 /// Render a specific graph
121 static NL3D::UDriver
*_Driver
;
123 static std::vector
<CGraph
*> *_Graphs
;
128 * Graph relative to a particular entity
130 class CSlotGraph
: public CGraph
135 CSlotGraph( std::string name
,
136 float x
, float y
, float width
, float height
,
137 NLMISC::CRGBA backColor
,
138 NLMISC::TTime quantum
,
142 : CGraph( name
, x
, y
, width
, height
, backColor
, quantum
, maxValue
, lineMode
), _Slot( slot
)
145 /// Add one value only for the stored slot
146 void addOneValue( uint8 slot
, float value
)
150 CGraph::addOneValue( value
);