KiCad PCB EDA Suite
cobject2d.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
5  * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
30 #include "cobject2d.h"
31 #include <stdio.h>
32 
33 
35 
36 
37 COBJECT2D::COBJECT2D( OBJECT2D_TYPE aObjType, const BOARD_ITEM &aBoardItem )
38  : m_boardItem(aBoardItem)
39 {
40  m_obj_type = aObjType;
41  COBJECT2D_STATS::Instance().AddOne( aObjType );
42 }
43 
44 
45 static const char *OBJECT2D_STR[OBJ2D_MAX] =
46 {
47  "OBJ2D_FILLED_CIRCLE",
48  "OBJ2D_CSG",
49  "OBJ2D_POLYGON",
50  "OBJ2D_DUMMYBLOCK",
51  "OBJ2D_POLYGON4PT",
52  "OBJ2D_RING",
53  "OBJ2D_ROUNDSEG",
54  "OBJ2D_TRIANGLE",
55  "OBJ2D_CONTAINER",
56  "OBJ2D_BVHCONTAINER"
57 };
58 
59 
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 }
void PrintStats()
Definition: cobject2d.cpp:60
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
unsigned int m_counter[OBJ2D_MAX]
Definition: cobject2d.h:161
void AddOne(OBJECT2D_TYPE aObjType)
Definition: cobject2d.h:142
COBJECT2D(OBJECT2D_TYPE aObjType, const BOARD_ITEM &aBoardItem)
Definition: cobject2d.cpp:37
static COBJECT2D_STATS & Instance()
Definition: cobject2d.h:146
OBJECT2D_TYPE m_obj_type
Definition: cobject2d.h:67
OBJECT2D_TYPE
Definition: cobject2d.h:46
static COBJECT2D_STATS * s_instance
Definition: cobject2d.h:163
Implements a class for object statistics using Singleton pattern.
Definition: cobject2d.h:132
static const char * OBJECT2D_STR[OBJ2D_MAX]
Definition: cobject2d.cpp:45