KiCad PCB EDA Suite
OBJECT_3D_STATS Class Reference

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

#include <object_3d.h>

Public Member Functions

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

Static Public Member Functions

static OBJECT_3D_STATSInstance ()
 

Private Member Functions

 OBJECT_3D_STATS ()
 
 OBJECT_3D_STATS (const OBJECT_3D_STATS &old)
 
const OBJECT_3D_STATSoperator= (const OBJECT_3D_STATS &old)
 
 ~OBJECT_3D_STATS ()
 

Private Attributes

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

Static Private Attributes

static OBJECT_3D_STATSs_instance = 0
 

Detailed Description

Implements a class for object statistics using Singleton pattern.

Definition at line 112 of file object_3d.h.

Constructor & Destructor Documentation

◆ OBJECT_3D_STATS() [1/2]

OBJECT_3D_STATS::OBJECT_3D_STATS ( )
inlineprivate

Definition at line 141 of file object_3d.h.

141 { ResetStats(); }
void ResetStats()
Definition: object_3d.h:115

References ResetStats().

Referenced by Instance().

◆ OBJECT_3D_STATS() [2/2]

OBJECT_3D_STATS::OBJECT_3D_STATS ( const OBJECT_3D_STATS old)
private

◆ ~OBJECT_3D_STATS()

OBJECT_3D_STATS::~OBJECT_3D_STATS ( )
inlineprivate

Definition at line 144 of file object_3d.h.

144 {}

Member Function Documentation

◆ AddOne()

void OBJECT_3D_STATS::AddOne ( OBJECT_3D_TYPE  aObjType)
inline

Definition at line 125 of file object_3d.h.

126  {
127  m_counter[static_cast<int>( aObjType )]++;
128  }
unsigned int m_counter[static_cast< int >(OBJECT_3D_TYPE::MAX)]
Definition: object_3d.h:146

References m_counter.

Referenced by OBJECT_3D::OBJECT_3D().

◆ GetCountOf()

unsigned int OBJECT_3D_STATS::GetCountOf ( OBJECT_3D_TYPE  aObjType) const
inline

Definition at line 120 of file object_3d.h.

121  {
122  return m_counter[static_cast<int>( aObjType )];
123  }
unsigned int m_counter[static_cast< int >(OBJECT_3D_TYPE::MAX)]
Definition: object_3d.h:146

References m_counter.

◆ Instance()

static OBJECT_3D_STATS& OBJECT_3D_STATS::Instance ( )
inlinestatic

Definition at line 132 of file object_3d.h.

133  {
134  if( !s_instance )
136 
137  return *s_instance;
138  }
static OBJECT_3D_STATS * s_instance
Definition: object_3d.h:148

References OBJECT_3D_STATS(), and s_instance.

Referenced by OBJECT_3D::OBJECT_3D(), and RENDER_3D_RAYTRACE::Reload().

◆ operator=()

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

◆ PrintStats()

void OBJECT_3D_STATS::PrintStats ( )

Definition at line 67 of file object_3d.cpp.

68 {
69  wxLogDebug( "OBJECT_3D_STATS:\n" );
70 
71  for( auto& objectType : objectTypeNames )
72  {
73  wxLogDebug( " %20s %u\n", objectType.second,
74  m_counter[static_cast<int>( objectType.first )] );
75  }
76 }
unsigned int m_counter[static_cast< int >(OBJECT_3D_TYPE::MAX)]
Definition: object_3d.h:146
const std::map< OBJECT_3D_TYPE, const char * > objectTypeNames
Definition: object_3d.cpp:56

References m_counter, and objectTypeNames.

◆ ResetStats()

void OBJECT_3D_STATS::ResetStats ( )
inline

Definition at line 115 of file object_3d.h.

116  {
117  memset( m_counter, 0, sizeof( unsigned int ) * static_cast<int>( OBJECT_3D_TYPE::MAX ) );
118  }
unsigned int m_counter[static_cast< int >(OBJECT_3D_TYPE::MAX)]
Definition: object_3d.h:146

References m_counter, and MAX.

Referenced by OBJECT_3D_STATS(), and RENDER_3D_RAYTRACE::Reload().

Member Data Documentation

◆ m_counter

unsigned int OBJECT_3D_STATS::m_counter[static_cast< int >(OBJECT_3D_TYPE::MAX)]
private

Definition at line 146 of file object_3d.h.

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

◆ s_instance

OBJECT_3D_STATS * OBJECT_3D_STATS::s_instance = 0
staticprivate

Definition at line 148 of file object_3d.h.

Referenced by Instance().


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