KiCad PCB EDA Suite
pns_logger.cpp
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013-2014 CERN
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "pns_logger.h"
23 #include "pns_item.h"
24 #include "pns_via.h"
25 #include "pns_line.h"
26 #include "pns_segment.h"
27 #include "pns_solid.h"
28 
29 #include <geometry/shape.h>
31 #include <geometry/shape_rect.h>
32 #include <geometry/shape_circle.h>
33 #include <geometry/shape_simple.h>
34 
35 namespace PNS {
36 
38 {
39 }
40 
41 
43 {
44 }
45 
46 
48 {
49  m_events.clear();
50 }
51 
52 
53 void LOGGER::Save( const std::string& aFilename )
54 {
55  FILE* f = fopen( aFilename.c_str(), "wb" );
56 
57  wxLogTrace( "PNS", "Saving to '%s' [%p]", aFilename.c_str(), f );
58 
59  for( const auto evt : m_events )
60  {
61  uint64_t id = 0;
62  if( evt.item && evt.item->Parent() )
63  {
64  const char* idString = evt.item->Parent()->m_Uuid.AsString().c_str();
65  fprintf( f, "event %d %d %d %s\n", evt.type, evt.p.x, evt.p.y, idString );
66  }
67  }
68 
69  fclose( f );
70 }
71 
72 
73 void LOGGER::Log( LOGGER::EVENT_TYPE evt, VECTOR2I pos, const ITEM* item )
74 {
76 
77  ent.type = evt;
78  ent.p = pos;
79  ent.item = item;
80 
81  m_events.push_back( ent );
82 
83 }
84 
85 }
ITEM.
Definition: pns_item.h:53
std::vector< EVENT_ENTRY > m_events
Definition: pns_logger.h:70
Definition: pns_logger.h:51
const ITEM * item
Definition: pns_logger.h:54
EVENT_TYPE type
Definition: pns_logger.h:53
void Clear()
Definition: pns_logger.cpp:47
void Save(const std::string &aFilename)
Definition: pns_logger.cpp:53
VECTOR2I p
Definition: pns_logger.h:52
Push and Shove diff pair dimensions (gap) settings dialog.
void Log(EVENT_TYPE evt, VECTOR2I pos, const ITEM *item=nullptr)
Definition: pns_logger.cpp:73