KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_logger.h
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-2023 KiCad Developers, see AUTHORS.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
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#ifndef __PNS_LOGGER_H
23#define __PNS_LOGGER_H
24
25#include <cstdio>
26#include <vector>
27#include <string>
28#include <sstream>
29
30#include <math/vector2d.h>
31#include <kiid.h>
32
33#include "pns_sizes_settings.h"
34
36class SHAPE;
37
38namespace PNS {
39
40class ITEM;
41
42class LOGGER
43{
44public:
45
55 };
56
57 struct EVENT_ENTRY {
60 std::vector<KIID> uuids;
62 int layer;
63
65
66 EVENT_ENTRY( const EVENT_ENTRY& aE ) :
67 p( aE.p ), type( aE.type ), uuids( aE.uuids ), sizes( aE.sizes ), layer( aE.layer )
68 {
69 }
70 };
71
72 LOGGER();
73 ~LOGGER();
74
75 void Clear();
76
77 void LogM( EVENT_TYPE evt, const VECTOR2I& pos = VECTOR2I(), std::vector<ITEM*> items = {},
78 const SIZES_SETTINGS* sizes = nullptr, int aLayer = 0 );
79
80 void Log( EVENT_TYPE evt, const VECTOR2I& pos = VECTOR2I(), const ITEM* item = nullptr,
81 const SIZES_SETTINGS* sizes = nullptr, int aLayer = 0 );
82
83 const std::vector<EVENT_ENTRY>& GetEvents()
84 {
85 return m_events;
86 }
87
88 static wxString FormatLogFileAsString( int aMode,
89 const std::vector<ITEM*>& aAddedItems,
90 const std::set<KIID>& aRemovedItems,
91 const std::vector<ITEM*>& aHeads,
92 const std::vector<EVENT_ENTRY>& aEvents );
93
94 static wxString FormatEvent( const EVENT_ENTRY& aEvent );
95
96 static EVENT_ENTRY ParseEvent( const wxString& aLine );
97
98private:
99 std::vector<EVENT_ENTRY> m_events;
100};
101
102}
103
104#endif
void Log(EVENT_TYPE evt, const VECTOR2I &pos=VECTOR2I(), const ITEM *item=nullptr, const SIZES_SETTINGS *sizes=nullptr, int aLayer=0)
Definition: pns_logger.cpp:70
static wxString FormatLogFileAsString(int aMode, const std::vector< ITEM * > &aAddedItems, const std::set< KIID > &aRemovedItems, const std::vector< ITEM * > &aHeads, const std::vector< EVENT_ENTRY > &aEvents)
Definition: pns_logger.cpp:79
const std::vector< EVENT_ENTRY > & GetEvents()
Definition: pns_logger.h:83
void LogM(EVENT_TYPE evt, const VECTOR2I &pos=VECTOR2I(), std::vector< ITEM * > items={}, const SIZES_SETTINGS *sizes=nullptr, int aLayer=0)
Definition: pns_logger.cpp:46
void Clear()
Definition: pns_logger.cpp:40
static wxString FormatEvent(const EVENT_ENTRY &aEvent)
Definition: pns_logger.cpp:103
@ EVT_START_ROUTE
Definition: pns_logger.h:47
@ EVT_START_MULTIDRAG
Definition: pns_logger.h:54
@ EVT_START_DRAG
Definition: pns_logger.h:48
@ EVT_TOGGLE_VIA
Definition: pns_logger.h:52
std::vector< EVENT_ENTRY > m_events
Definition: pns_logger.h:99
static EVENT_ENTRY ParseEvent(const wxString &aLine)
Definition: pns_logger.cpp:128
Represent a polyline containing arcs as well as line segments: A chain of connected line and/or arc s...
An abstract shape on 2D plane.
Definition: shape.h:126
Push and Shove diff pair dimensions (gap) settings dialog.
Definition: pns_logger.h:57
int layer
Definition: pns_logger.h:62
SIZES_SETTINGS sizes
Definition: pns_logger.h:61
EVENT_ENTRY(const EVENT_ENTRY &aE)
Definition: pns_logger.h:66
EVENT_ENTRY()
Definition: pns_logger.h:64
std::vector< KIID > uuids
Definition: pns_logger.h:60
EVENT_TYPE type
Definition: pns_logger.h:59
VECTOR2I p
Definition: pns_logger.h:58
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:691