2020-09-25 18:26:58 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2022-02-13 11:54:41 +00:00
|
|
|
* Copyright (C) 2004-2022 KiCad Developers.
|
2020-09-25 18:26:58 +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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-02-13 11:54:41 +00:00
|
|
|
#ifndef FROM_TO_CACHE_H
|
|
|
|
#define FROM_TO_CACHE_H
|
2020-09-25 18:26:58 +00:00
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
2020-11-12 22:30:02 +00:00
|
|
|
class PAD;
|
2020-09-25 18:26:58 +00:00
|
|
|
class BOARD_CONNECTED_ITEM;
|
|
|
|
|
|
|
|
class FROM_TO_CACHE
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
struct FT_ENDPOINT
|
|
|
|
{
|
|
|
|
wxString name;
|
2022-02-13 11:54:41 +00:00
|
|
|
PAD* parent;
|
2020-09-25 18:26:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct FT_PATH
|
|
|
|
{
|
2022-02-13 11:54:41 +00:00
|
|
|
int net;
|
2020-11-12 22:30:02 +00:00
|
|
|
PAD* from;
|
|
|
|
PAD* to;
|
2020-09-25 18:26:58 +00:00
|
|
|
wxString fromName, toName;
|
|
|
|
wxString fromWildcard, toWildcard;
|
2020-11-12 22:30:02 +00:00
|
|
|
bool isUnique;
|
2020-09-25 18:26:58 +00:00
|
|
|
std::set<BOARD_CONNECTED_ITEM*> pathItems;
|
|
|
|
};
|
|
|
|
|
|
|
|
FROM_TO_CACHE( BOARD* aBoard = nullptr ) :
|
|
|
|
m_board( aBoard )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~FROM_TO_CACHE()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Rebuild( BOARD* aBoard );
|
|
|
|
bool IsOnFromToPath( BOARD_CONNECTED_ITEM* aItem, const wxString& aFrom, const wxString& aTo );
|
|
|
|
|
2020-09-26 20:41:36 +00:00
|
|
|
FT_PATH* QueryFromToPath( const std::set<BOARD_CONNECTED_ITEM*>& aItems );
|
|
|
|
|
2020-09-25 18:26:58 +00:00
|
|
|
private:
|
|
|
|
int cacheFromToPaths( const wxString& aFrom, const wxString& aTo );
|
|
|
|
void buildEndpointList();
|
|
|
|
|
2022-02-13 11:54:41 +00:00
|
|
|
private:
|
2020-09-25 18:26:58 +00:00
|
|
|
std::vector<FT_ENDPOINT> m_ftEndpoints;
|
2022-02-13 11:54:41 +00:00
|
|
|
std::vector<FT_PATH> m_ftPaths;
|
2020-09-25 18:26:58 +00:00
|
|
|
|
2022-02-13 11:54:41 +00:00
|
|
|
BOARD* m_board;
|
2020-09-25 18:26:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|