KiCad PCB EDA Suite
from_to_cache.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) 2004-2020 KiCad Developers.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef __FROM_TO_CACHE_H
21 #define __FROM_TO_CACHE_H
22 
23 #include <set>
24 
25 class PAD;
27 
29 {
30 public:
31 
32  struct FT_ENDPOINT
33  {
34  wxString name;
36  };
37 
38  struct FT_PATH
39  {
40  int net;
42  PAD* to;
43  wxString fromName, toName;
45  bool isUnique;
46  std::set<BOARD_CONNECTED_ITEM*> pathItems;
47  };
48 
49  FROM_TO_CACHE( BOARD* aBoard = nullptr ) :
50  m_board( aBoard )
51  {
52  }
53 
55  {
56  }
57 
58  void Rebuild( BOARD* aBoard );
59  bool IsOnFromToPath( BOARD_CONNECTED_ITEM* aItem, const wxString& aFrom, const wxString& aTo );
60 
61  FT_PATH* QueryFromToPath( const std::set<BOARD_CONNECTED_ITEM*>& aItems );
62 
63 private:
64 
65  int cacheFromToPaths( const wxString& aFrom, const wxString& aTo );
66  void buildEndpointList();
67 
68  std::vector<FT_ENDPOINT> m_ftEndpoints;
69  std::vector<FT_PATH> m_ftPaths;
70 
72 };
73 
74 #endif
std::vector< FT_ENDPOINT > m_ftEndpoints
Definition: from_to_cache.h:68
BOARD * m_board
Definition: from_to_cache.h:71
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
std::vector< FT_PATH > m_ftPaths
Definition: from_to_cache.h:69
void Rebuild(BOARD *aBoard)
int cacheFromToPaths(const wxString &aFrom, const wxString &aTo)
FROM_TO_CACHE(BOARD *aBoard=nullptr)
Definition: from_to_cache.h:49
bool IsOnFromToPath(BOARD_CONNECTED_ITEM *aItem, const wxString &aFrom, const wxString &aTo)
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
std::set< BOARD_CONNECTED_ITEM * > pathItems
Definition: from_to_cache.h:46
void buildEndpointList()
Definition: pad.h:60
FT_PATH * QueryFromToPath(const std::set< BOARD_CONNECTED_ITEM * > &aItems)