KiCad PCB EDA Suite
OBJECT_2D_STATS Class Reference

#include <object_2d.h>

Public Member Functions

void ResetStats ()
 
unsigned int GetCountOf (OBJECT_2D_TYPE aObjType) const
 
void AddOne (OBJECT_2D_TYPE aObjType)
 

Static Public Member Functions

static OBJECT_2D_STATSInstance ()
 

Private Member Functions

 OBJECT_2D_STATS ()
 
 OBJECT_2D_STATS (const OBJECT_2D_STATS &old)
 
const OBJECT_2D_STATSoperator= (const OBJECT_2D_STATS &old)
 
 ~OBJECT_2D_STATS ()
 

Private Attributes

unsigned int m_counter [static_cast< int >(OBJECT_2D_TYPE::MAX)]
 

Static Private Attributes

static OBJECT_2D_STATSs_instance = nullptr
 

Detailed Description

Definition at line 119 of file object_2d.h.

Constructor & Destructor Documentation

◆ OBJECT_2D_STATS() [1/2]

OBJECT_2D_STATS::OBJECT_2D_STATS ( )
inlineprivate

Definition at line 146 of file object_2d.h.

146 { ResetStats(); }
void ResetStats()
Definition: object_2d.h:122

References ResetStats().

Referenced by Instance().

◆ OBJECT_2D_STATS() [2/2]

OBJECT_2D_STATS::OBJECT_2D_STATS ( const OBJECT_2D_STATS old)
private

◆ ~OBJECT_2D_STATS()

OBJECT_2D_STATS::~OBJECT_2D_STATS ( )
inlineprivate

Definition at line 149 of file object_2d.h.

149 {}

Member Function Documentation

◆ AddOne()

void OBJECT_2D_STATS::AddOne ( OBJECT_2D_TYPE  aObjType)
inline

Definition at line 132 of file object_2d.h.

133  {
134  m_counter[static_cast<int>( aObjType )]++;
135  }
unsigned int m_counter[static_cast< int >(OBJECT_2D_TYPE::MAX)]
Definition: object_2d.h:151

References m_counter.

Referenced by OBJECT_2D::OBJECT_2D().

◆ GetCountOf()

unsigned int OBJECT_2D_STATS::GetCountOf ( OBJECT_2D_TYPE  aObjType) const
inline

Definition at line 127 of file object_2d.h.

128  {
129  return m_counter[static_cast<int>( aObjType )];
130  }
unsigned int m_counter[static_cast< int >(OBJECT_2D_TYPE::MAX)]
Definition: object_2d.h:151

References m_counter.

◆ Instance()

static OBJECT_2D_STATS& OBJECT_2D_STATS::Instance ( )
inlinestatic

Definition at line 137 of file object_2d.h.

138  {
139  if( !s_instance )
141 
142  return *s_instance;
143  }
static OBJECT_2D_STATS * s_instance
Definition: object_2d.h:153

References OBJECT_2D_STATS(), and s_instance.

Referenced by OBJECT_2D::OBJECT_2D(), RENDER_3D_RAYTRACE::Reload(), and RENDER_3D_OPENGL::reload().

◆ operator=()

const OBJECT_2D_STATS& OBJECT_2D_STATS::operator= ( const OBJECT_2D_STATS old)
private

◆ ResetStats()

void OBJECT_2D_STATS::ResetStats ( )
inline

Definition at line 122 of file object_2d.h.

123  {
124  memset( m_counter, 0, sizeof( unsigned int ) * static_cast<int>( OBJECT_2D_TYPE::MAX ) );
125  }
unsigned int m_counter[static_cast< int >(OBJECT_2D_TYPE::MAX)]
Definition: object_2d.h:151

References m_counter, and MAX.

Referenced by OBJECT_2D_STATS(), RENDER_3D_RAYTRACE::Reload(), and RENDER_3D_OPENGL::reload().

Member Data Documentation

◆ m_counter

unsigned int OBJECT_2D_STATS::m_counter[static_cast< int >(OBJECT_2D_TYPE::MAX)]
private

Definition at line 151 of file object_2d.h.

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

◆ s_instance

OBJECT_2D_STATS * OBJECT_2D_STATS::s_instance = nullptr
staticprivate

Definition at line 153 of file object_2d.h.

Referenced by Instance().


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