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 
26 namespace PNS {
27 
29 {
30 }
31 
32 
34 {
35 }
36 
37 
39 {
40  m_events.clear();
41 }
42 
43 
44 void LOGGER::Save( const std::string& aFilename )
45 {
46  FILE* f = fopen( aFilename.c_str(), "wb" );
47 
48  wxLogTrace( "PNS", "Saving to '%s' [%p]", aFilename.c_str(), f );
49 
50  for( const EVENT_ENTRY& evt : m_events )
51  {
52  uint64_t id = 0;
53 
54  if( evt.item && evt.item->Parent() )
55  {
56  const char* idString = evt.item->Parent()->m_Uuid.AsString().c_str();
57  fprintf( f, "event %d %d %d %s\n", evt.type, evt.p.x, evt.p.y, idString );
58  }
59  }
60 
61  fclose( f );
62 }
63 
64 
65 void LOGGER::Log( LOGGER::EVENT_TYPE evt, VECTOR2I pos, const ITEM* item )
66 {
68 
69  ent.type = evt;
70  ent.p = pos;
71  ent.item = item;
72 
73  m_events.push_back( ent );
74 
75 }
76 
77 }
Base class for PNS router board items.
Definition: pns_item.h:55
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:38
void Save(const std::string &aFilename)
Definition: pns_logger.cpp:44
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:65