OpenClonk
C4GraphCollection Class Reference

#include <C4Network2Stats.h>

Inheritance diagram for C4GraphCollection:
[legend]
Collaboration diagram for C4GraphCollection:
[legend]

Public Types

typedef float ValueType
 
typedef int TimeType
 

Public Member Functions

 C4GraphCollection ()=default
 
C4Graph::TimeType GetStartTime () const override
 
C4Graph::TimeType GetEndTime () const override
 
C4Graph::ValueType GetValue (C4Graph::TimeType iAtTime) const override
 
C4Graph::ValueType GetMedianValue (C4Graph::TimeType iStartTime, C4Graph::TimeType iEndTime) const override
 
C4Graph::ValueType GetMinValue () const override
 
C4Graph::ValueType GetMaxValue () const override
 
int GetSeriesCount () const override
 
const C4GraphGetSeries (int iIndex) const override
 
void AddGraph (C4Graph *pAdd)
 
void RemoveGraph (const C4Graph *pRemove)
 
void Update () const override
 
void SetAverageTime (int iToTime) override
 
void SetMultiplier (ValueType fToVal) override
 
void SetTitle (const char *szNewTitle)
 
void SetColorDw (DWORD dwClr)
 
DWORD GetColorDw () const
 
const char * GetTitle () const
 

Detailed Description

Definition at line 126 of file C4Network2Stats.h.

Member Typedef Documentation

◆ TimeType

typedef int C4Graph::TimeType
inherited

Definition at line 28 of file C4Network2Stats.h.

◆ ValueType

typedef float C4Graph::ValueType
inherited

Definition at line 27 of file C4Network2Stats.h.

Constructor & Destructor Documentation

◆ C4GraphCollection()

C4GraphCollection::C4GraphCollection ( )
default

Member Function Documentation

◆ AddGraph()

void C4GraphCollection::AddGraph ( C4Graph pAdd)
inline

Definition at line 151 of file C4Network2Stats.h.

151 { push_back(pAdd); if (iCommonAvgTime) pAdd->SetAverageTime(iCommonAvgTime); if (fMultiplier) pAdd->SetMultiplier(fMultiplier); }
virtual void SetMultiplier(ValueType fToVal)=0
virtual void SetAverageTime(int iToTime)=0

References C4Graph::SetAverageTime(), and C4Graph::SetMultiplier().

Referenced by C4Network2Stats::C4Network2Stats().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetColorDw()

DWORD C4Graph::GetColorDw ( ) const
inlineinherited

Definition at line 55 of file C4Network2Stats.h.

55 { return dwColor; }

Referenced by C4Chart::DrawElement().

Here is the caller graph for this function:

◆ GetEndTime()

C4Graph::TimeType C4GraphCollection::GetEndTime ( ) const
overridevirtual

Implements C4Graph.

Definition at line 237 of file C4Network2Stats.cpp.

238 {
239  const_iterator i = begin(); if (i == end()) return 0;
240  C4Graph::TimeType iTime = (*i)->GetEndTime();
241  while (++i != end()) iTime = std::max(iTime, (*i)->GetEndTime());
242  return iTime;
243 }

◆ GetMaxValue()

C4Graph::ValueType C4GraphCollection::GetMaxValue ( ) const
overridevirtual

Implements C4Graph.

Definition at line 253 of file C4Network2Stats.cpp.

254 {
255  const_iterator i = begin(); if (i == end()) return 0;
256  C4Graph::ValueType iVal = (*i)->GetMaxValue();
257  while (++i != end()) iVal = std::max(iVal, (*i)->GetMaxValue());
258  return iVal;
259 }
float ValueType

◆ GetMedianValue()

C4Graph::ValueType C4GraphCollection::GetMedianValue ( C4Graph::TimeType  iStartTime,
C4Graph::TimeType  iEndTime 
) const
inlineoverridevirtual

Implements C4Graph.

Definition at line 141 of file C4Network2Stats.h.

141 { assert(0); return 0; }

◆ GetMinValue()

C4Graph::ValueType C4GraphCollection::GetMinValue ( ) const
overridevirtual

Implements C4Graph.

Definition at line 245 of file C4Network2Stats.cpp.

246 {
247  const_iterator i = begin(); if (i == end()) return 0;
248  C4Graph::ValueType iVal = (*i)->GetMinValue();
249  while (++i != end()) iVal = std::min(iVal, (*i)->GetMinValue());
250  return iVal;
251 }

◆ GetSeries()

const C4Graph * C4GraphCollection::GetSeries ( int  iIndex) const
overridevirtual

Implements C4Graph.

Definition at line 268 of file C4Network2Stats.cpp.

269 {
270  for (auto i : *this)
271  {
272  int iCnt = i->GetSeriesCount();
273  if (iIndex < iCnt) return i->GetSeries(iIndex);
274  iIndex -= iCnt;
275  }
276  return nullptr;
277 }
int iCnt
Definition: TstC4NetIO.cpp:32

References iCnt.

◆ GetSeriesCount()

int C4GraphCollection::GetSeriesCount ( ) const
overridevirtual

Implements C4Graph.

Definition at line 261 of file C4Network2Stats.cpp.

262 {
263  int iCount = 0;
264  for (auto i : *this) iCount += i->GetSeriesCount();
265  return iCount;
266 }

◆ GetStartTime()

C4Graph::TimeType C4GraphCollection::GetStartTime ( ) const
overridevirtual

Implements C4Graph.

Definition at line 229 of file C4Network2Stats.cpp.

230 {
231  const_iterator i = begin(); if (i == end()) return 0;
232  C4Graph::TimeType iTime = (*i)->GetStartTime();
233  while (++i != end()) iTime = std::min(iTime, (*i)->GetStartTime());
234  return iTime;
235 }

◆ GetTitle()

const char* C4Graph::GetTitle ( ) const
inlineinherited

Definition at line 56 of file C4Network2Stats.h.

56 { return szTitle.getData(); }
const char * getData() const
Definition: StdBuf.h:442

References StdStrBuf::getData().

Referenced by C4Chart::DrawElement().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetValue()

C4Graph::ValueType C4GraphCollection::GetValue ( C4Graph::TimeType  iAtTime) const
inlineoverridevirtual

Implements C4Graph.

Definition at line 140 of file C4Network2Stats.h.

140 { assert(0); return 0; }

◆ RemoveGraph()

void C4GraphCollection::RemoveGraph ( const C4Graph pRemove)
inline

Definition at line 152 of file C4Network2Stats.h.

152 { iterator i=std::find(begin(), end(), pRemove); if (i!=end()) erase(i); }

◆ SetAverageTime()

void C4GraphCollection::SetAverageTime ( int  iToTime)
overridevirtual

Implements C4Graph.

Definition at line 285 of file C4Network2Stats.cpp.

286 {
287  if ((iCommonAvgTime = iToTime))
288  for (auto & i : *this) i->SetAverageTime(iToTime);
289 }

Referenced by C4Network2Stats::C4Network2Stats().

Here is the caller graph for this function:

◆ SetColorDw()

void C4Graph::SetColorDw ( DWORD  dwClr)
inlineinherited

Definition at line 39 of file C4Network2Stats.h.

39 { dwColor = dwClr; }

Referenced by C4Network2Stats::C4Network2Stats(), C4Network2Client::CreateGraphs(), and C4Player::CreateGraphs().

Here is the caller graph for this function:

◆ SetMultiplier()

void C4GraphCollection::SetMultiplier ( ValueType  fToVal)
overridevirtual

Implements C4Graph.

Definition at line 291 of file C4Network2Stats.cpp.

292 {
293  if ((fMultiplier = fToVal))
294  for (auto & i : *this) i->SetMultiplier(fToVal);
295 }

Referenced by C4Network2Stats::ExecuteControlFrame().

Here is the caller graph for this function:

◆ SetTitle()

void C4Graph::SetTitle ( const char *  szNewTitle)
inlineinherited

Definition at line 38 of file C4Network2Stats.h.

38 { szTitle.Copy(szNewTitle); }
void Copy()
Definition: StdBuf.h:467

References StdStrBuf::Copy().

Referenced by C4Network2Stats::C4Network2Stats(), C4Network2Client::CreateGraphs(), and C4Player::CreateGraphs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Update()

void C4GraphCollection::Update ( ) const
overridevirtual

Reimplemented from C4Graph.

Definition at line 279 of file C4Network2Stats.cpp.

280 {
281  // update all child graphs
282  for (auto i : *this) i->Update();
283 }

The documentation for this class was generated from the following files: