2022-02-26 01:47:14 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-08-29 16:28:37 +00:00
|
|
|
* Copyright (C) 2020-2023 KiCad Developers.
|
2022-02-26 01:47:14 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// WARNING - this Tom's crappy PNS hack tool code. Please don't complain about its quality
|
|
|
|
// (unless you want to improve it).
|
|
|
|
|
|
|
|
#ifndef __PNS_LOG_FILE_H
|
|
|
|
#define __PNS_LOG_FILE_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
2022-10-23 22:15:32 +00:00
|
|
|
#include <set>
|
2022-02-26 01:47:14 +00:00
|
|
|
|
2022-06-03 21:24:59 +00:00
|
|
|
#include <wx/filename.h>
|
|
|
|
|
2022-02-26 01:47:14 +00:00
|
|
|
#include <kiid.h>
|
|
|
|
#include <math/vector2d.h>
|
2022-10-23 22:15:32 +00:00
|
|
|
|
2022-02-26 01:47:14 +00:00
|
|
|
#include <router/pns_logger.h>
|
2022-10-23 22:15:32 +00:00
|
|
|
#include <router/pns_router.h>
|
2022-02-26 01:47:14 +00:00
|
|
|
#include <router/pns_item.h>
|
|
|
|
#include <router/pns_routing_settings.h>
|
|
|
|
|
|
|
|
#include <pcbnew/board.h>
|
|
|
|
#include <pcbnew/board_connected_item.h>
|
|
|
|
|
2022-06-03 21:24:59 +00:00
|
|
|
#include <settings/settings_manager.h>
|
|
|
|
|
2022-02-26 01:47:14 +00:00
|
|
|
class PNS_LOG_FILE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PNS_LOG_FILE();
|
|
|
|
~PNS_LOG_FILE() {}
|
|
|
|
|
2023-08-08 21:33:26 +00:00
|
|
|
struct COMMIT_STATE
|
2022-10-23 22:15:32 +00:00
|
|
|
{
|
|
|
|
COMMIT_STATE() {};
|
|
|
|
COMMIT_STATE( const COMMIT_STATE& aOther ) :
|
|
|
|
m_removedIds( aOther.m_removedIds ),
|
|
|
|
m_addedItems( aOther.m_addedItems )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
std::set<KIID> m_removedIds;
|
2023-08-08 21:33:26 +00:00
|
|
|
std::vector<PNS::ITEM*> m_addedItems;
|
2022-10-23 22:15:32 +00:00
|
|
|
|
|
|
|
bool Compare( const COMMIT_STATE& aOther );
|
|
|
|
};
|
|
|
|
|
2023-08-08 18:43:42 +00:00
|
|
|
// Saves a P&S event log only (e.g. after fixing a bug and wanting a new "golden" commit state)
|
|
|
|
bool SaveLog( const wxFileName& logFileName, REPORTER* aRpt );
|
|
|
|
|
2022-02-26 01:47:14 +00:00
|
|
|
// Loads a P&S event log and the associated board file. These two always go together.
|
2022-10-23 22:15:32 +00:00
|
|
|
bool Load( const wxFileName& logFileName, REPORTER* aRpt );
|
2022-02-26 01:47:14 +00:00
|
|
|
|
2023-08-08 21:33:26 +00:00
|
|
|
BOARD_CONNECTED_ITEM* ItemById( const PNS::LOGGER::EVENT_ENTRY& evt );
|
2022-02-26 01:47:14 +00:00
|
|
|
|
2023-08-08 21:33:26 +00:00
|
|
|
std::vector<PNS::LOGGER::EVENT_ENTRY>& Events() { return m_events; }
|
2022-02-26 01:47:14 +00:00
|
|
|
|
|
|
|
void SetBoard( std::shared_ptr<BOARD> brd ) { m_board = brd; }
|
|
|
|
std::shared_ptr<BOARD> GetBoard() const { return m_board; }
|
|
|
|
|
|
|
|
PNS::ROUTING_SETTINGS* GetRoutingSettings() const { return m_routerSettings.get(); }
|
|
|
|
|
2022-10-23 22:15:32 +00:00
|
|
|
const COMMIT_STATE& GetExpectedResult() const { return m_commitState; }
|
|
|
|
|
|
|
|
PNS::ROUTER_MODE GetMode() const { return m_mode; }
|
|
|
|
|
2023-08-29 16:28:37 +00:00
|
|
|
private:
|
|
|
|
bool parseCommonPnsProps( PNS::ITEM* aItem, const wxString& cmd, wxStringTokenizer& aTokens );
|
|
|
|
|
2023-08-31 14:03:03 +00:00
|
|
|
PNS::SEGMENT* parsePnsSegmentFromString( wxStringTokenizer& aTokens );
|
2023-08-29 16:28:37 +00:00
|
|
|
|
2023-08-31 14:03:03 +00:00
|
|
|
PNS::VIA* parsePnsViaFromString( wxStringTokenizer& aTokens );
|
2023-08-29 16:28:37 +00:00
|
|
|
|
|
|
|
PNS::ITEM* parseItemFromString( wxStringTokenizer& aTokens );
|
|
|
|
|
2022-02-26 01:47:14 +00:00
|
|
|
private:
|
2022-06-03 21:24:59 +00:00
|
|
|
std::shared_ptr<SETTINGS_MANAGER> m_settingsMgr;
|
2022-02-26 01:47:14 +00:00
|
|
|
std::unique_ptr<PNS::ROUTING_SETTINGS> m_routerSettings;
|
2023-08-08 21:33:26 +00:00
|
|
|
std::vector<PNS::LOGGER::EVENT_ENTRY> m_events;
|
2022-02-26 01:47:14 +00:00
|
|
|
std::shared_ptr<BOARD> m_board;
|
2022-10-23 22:15:32 +00:00
|
|
|
COMMIT_STATE m_commitState;
|
|
|
|
PNS::ROUTER_MODE m_mode;
|
2022-02-26 01:47:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|