KiCad PCB EDA Suite
COBJECT2D_STATS Class Reference

Implements a class for object statistics using Singleton pattern. More...

#include <cobject2d.h>

Public Member Functions

void ResetStats ()
 
unsigned int GetCountOf (OBJECT2D_TYPE aObjType) const
 
void AddOne (OBJECT2D_TYPE aObjType)
 
void PrintStats ()
 

Static Public Member Functions

static COBJECT2D_STATSInstance ()
 

Private Member Functions

 COBJECT2D_STATS ()
 
 COBJECT2D_STATS (const COBJECT2D_STATS &old)
 
const COBJECT2D_STATSoperator= (const COBJECT2D_STATS &old)
 
 ~COBJECT2D_STATS ()
 

Private Attributes

unsigned int m_counter [OBJ2D_MAX]
 

Static Private Attributes

static COBJECT2D_STATSs_instance = 0
 

Detailed Description

Implements a class for object statistics using Singleton pattern.

Definition at line 132 of file cobject2d.h.

Constructor & Destructor Documentation

COBJECT2D_STATS::COBJECT2D_STATS ( )
inlineprivate

Definition at line 155 of file cobject2d.h.

References ResetStats().

Referenced by Instance().

155 { ResetStats(); }
void ResetStats()
Definition: cobject2d.h:135
COBJECT2D_STATS::COBJECT2D_STATS ( const COBJECT2D_STATS old)
private
COBJECT2D_STATS::~COBJECT2D_STATS ( )
inlineprivate

Definition at line 158 of file cobject2d.h.

158 {}

Member Function Documentation

void COBJECT2D_STATS::AddOne ( OBJECT2D_TYPE  aObjType)
inline

Definition at line 142 of file cobject2d.h.

References m_counter.

Referenced by COBJECT2D::COBJECT2D().

142 { m_counter[aObjType]++; }
unsigned int m_counter[OBJ2D_MAX]
Definition: cobject2d.h:161
unsigned int COBJECT2D_STATS::GetCountOf ( OBJECT2D_TYPE  aObjType) const
inline

Definition at line 137 of file cobject2d.h.

References m_counter.

138  {
139  return m_counter[aObjType];
140  }
unsigned int m_counter[OBJ2D_MAX]
Definition: cobject2d.h:161
static COBJECT2D_STATS& COBJECT2D_STATS::Instance ( )
inlinestatic

Definition at line 146 of file cobject2d.h.

References COBJECT2D_STATS(), and s_instance.

Referenced by COBJECT2D::COBJECT2D(), C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

147  {
148  if( !s_instance )
150 
151  return *s_instance;
152  }
static COBJECT2D_STATS * s_instance
Definition: cobject2d.h:163
const COBJECT2D_STATS& COBJECT2D_STATS::operator= ( const COBJECT2D_STATS old)
private
void COBJECT2D_STATS::PrintStats ( )

Definition at line 60 of file cobject2d.cpp.

References m_counter, OBJ2D_MAX, and OBJECT2D_STR.

Referenced by C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

61 {
62  printf( "OBJ2D Statistics:\n" );
63 
64  for( unsigned int i = 0; i < OBJ2D_MAX; ++i )
65  {
66  printf( " %20s %u\n", OBJECT2D_STR[i], m_counter[i] );
67  }
68 }
unsigned int m_counter[OBJ2D_MAX]
Definition: cobject2d.h:161
static const char * OBJECT2D_STR[OBJ2D_MAX]
Definition: cobject2d.cpp:45
void COBJECT2D_STATS::ResetStats ( )
inline

Definition at line 135 of file cobject2d.h.

References m_counter, and OBJ2D_MAX.

Referenced by COBJECT2D_STATS(), C3D_RENDER_OGL_LEGACY::reload(), and C3D_RENDER_RAYTRACING::reload().

135 { memset( m_counter, 0, sizeof( unsigned int ) * OBJ2D_MAX ); }
unsigned int m_counter[OBJ2D_MAX]
Definition: cobject2d.h:161

Member Data Documentation

unsigned int COBJECT2D_STATS::m_counter[OBJ2D_MAX]
private

Definition at line 161 of file cobject2d.h.

Referenced by AddOne(), GetCountOf(), PrintStats(), and ResetStats().

COBJECT2D_STATS * COBJECT2D_STATS::s_instance = 0
staticprivate

Definition at line 163 of file cobject2d.h.

Referenced by Instance().


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