KiCad PCB EDA Suite
Loading...
Searching...
No Matches
pns_log_player.h
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) 2020-2021 KiCad Developers.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23#ifndef __PNS_LOG_PLAYER_H
24#define __PNS_LOG_PLAYER_H
25
26#include <map>
27#include <pcbnew/board.h>
28
31#include <router/pns_router.h>
32
33
35class PNS_LOG_FILE;
36class PNS_LOG_PLAYER;
37class REPORTER;
38
40{
41public:
42 struct ENTRY
43 {
44 ENTRY() = default;
46
47 ENTRY( ENTRY&& aOther ) :
48 m_isHideOp( aOther.m_isHideOp ),
49 m_item( aOther.m_item ),
50 m_ownedItem( std::move( aOther.m_ownedItem ) )
51 {}
52
53 bool m_isHideOp{ false };
54 const PNS::ITEM* m_item{ nullptr };
55 std::unique_ptr<const PNS::ITEM> m_ownedItem{ nullptr };
56 };
57
58 typedef std::vector<ENTRY> VIEW_ENTRIES;
59
62
63 void SetStage( int aStage );
64 VIEW_ENTRIES& GetEntriesForStage( int aStage ) { return m_vitems[aStage]; }
65
66 void HideItem( PNS::ITEM* aItem );
67 void DisplayItem( const PNS::ITEM* aItem );
68
69
70private:
72 std::map<int, VIEW_ENTRIES> m_vitems;
73};
74
76{
77public:
80
81 void HideItem( PNS::ITEM* aItem ) override;
82 void DisplayItem( const PNS::ITEM* aItem, int aClearance, bool aEdit = false,
83 int aFlags = 0 ) override;
84
85 int GetNetCode( PNS::NET_HANDLE aNet ) const override;
86 wxString GetNetName( PNS::NET_HANDLE aNet ) const override;
87
88private:
90};
91
92
94{
95public:
98
99 void ReplayLog( PNS_LOG_FILE* aLog, int aStartEventIndex = 0, int aFrom = 0, int aTo = -1,
100 bool aUpdateExpectedResult = false );
101
102 void SetReporter( REPORTER* aReporter ) { m_reporter = aReporter; }
103
105 std::shared_ptr<PNS_LOG_VIEW_TRACKER> GetViewTracker() { return m_viewTracker; }
106
107 void SetTimeLimit( uint64_t microseconds ) { m_timeLimitUs = microseconds; }
108
109 bool CompareResults( PNS_LOG_FILE* aLog );
111
112private:
113 void createRouter();
114
115 std::shared_ptr<PNS_LOG_VIEW_TRACKER> m_viewTracker;
116 std::unique_ptr<PNS_LOG_PLAYER_KICAD_IFACE> m_iface; // needs to be deleted after m_router
118 std::shared_ptr<BOARD> m_board;
119 std::unique_ptr<PNS::ROUTER> m_router;
120 std::unique_ptr<PNS::ROUTING_SETTINGS> m_routingSettings;
123};
124
125#endif
Base class for PNS router board items.
Definition: pns_item.h:97
int GetNetCode(PNS::NET_HANDLE aNet) const override
PNS_LOG_VIEW_TRACKER * m_viewTracker
void HideItem(PNS::ITEM *aItem) override
void DisplayItem(const PNS::ITEM *aItem, int aClearance, bool aEdit=false, int aFlags=0) override
wxString GetNetName(PNS::NET_HANDLE aNet) const override
PNS_TEST_DEBUG_DECORATOR * m_debugDecorator
void SetTimeLimit(uint64_t microseconds)
std::shared_ptr< PNS_LOG_VIEW_TRACKER > GetViewTracker()
std::unique_ptr< PNS::ROUTING_SETTINGS > m_routingSettings
std::shared_ptr< BOARD > m_board
const PNS_LOG_FILE::COMMIT_STATE GetRouterUpdatedItems()
REPORTER * m_reporter
uint64_t m_timeLimitUs
PNS_TEST_DEBUG_DECORATOR * GetDebugDecorator()
bool CompareResults(PNS_LOG_FILE *aLog)
std::unique_ptr< PNS::ROUTER > m_router
void ReplayLog(PNS_LOG_FILE *aLog, int aStartEventIndex=0, int aFrom=0, int aTo=-1, bool aUpdateExpectedResult=false)
std::shared_ptr< PNS_LOG_VIEW_TRACKER > m_viewTracker
std::unique_ptr< PNS_LOG_PLAYER_KICAD_IFACE > m_iface
void SetReporter(REPORTER *aReporter)
std::map< int, VIEW_ENTRIES > m_vitems
VIEW_ENTRIES & GetEntriesForStage(int aStage)
void DisplayItem(const PNS::ITEM *aItem)
void HideItem(PNS::ITEM *aItem)
std::vector< ENTRY > VIEW_ENTRIES
void SetStage(int aStage)
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
void * NET_HANDLE
Definition: pns_item.h:54
STL namespace.
std::unique_ptr< const PNS::ITEM > m_ownedItem
const PNS::ITEM * m_item
ENTRY(const PNS_LOG_VIEW_TRACKER::ENTRY &)=delete