KiCad PCB EDA Suite
bus_alias.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) 2018 CERN
5  * @author Jon Evans <jon@craftyjon.com>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef _BUS_ALIAS_H
22 #define _BUS_ALIAS_H
23 
24 #include <memory>
25 #include <vector>
26 #include <wx/string.h>
27 
28 
29 class SCH_SCREEN;
30 
31 
32 class BUS_ALIAS
33 {
34 public:
35  BUS_ALIAS( SCH_SCREEN* aParent = NULL );
36 
37  ~BUS_ALIAS();
38 
39  std::shared_ptr< BUS_ALIAS > Clone() const
40  {
41  return std::make_shared< BUS_ALIAS >( *this );
42  }
43 
44  wxString GetName()
45  {
46  return m_name;
47  }
48 
49  void SetName( const wxString& aName )
50  {
51  m_name = aName;
52  }
53 
54  void ClearMembers()
55  {
56  m_members.clear();
57  }
58 
59  void AddMember( const wxString& aName )
60  {
61  m_members.push_back( aName );
62  }
63 
65  {
66  return m_members.size();
67  }
68 
69  std::vector< wxString >& Members()
70  {
71  return m_members;
72  }
73 
74  bool Contains( const wxString& aName );
75 
77  {
78  return m_parent;
79  }
80 
81  void SetParent( SCH_SCREEN* aParent )
82  {
83  m_parent = aParent;
84  }
85 
86 protected:
87 
88  wxString m_name;
89 
90  std::vector< wxString > m_members;
91 
98 };
99 
100 #endif
std::vector< wxString > m_members
Definition: bus_alias.h:90
void ClearMembers()
Definition: bus_alias.h:54
int GetMemberCount()
Definition: bus_alias.h:64
wxString m_name
Definition: bus_alias.h:88
std::shared_ptr< BUS_ALIAS > Clone() const
Definition: bus_alias.h:39
SCH_SCREEN * m_parent
The bus alias editor dialog can edit aliases from all open sheets.
Definition: bus_alias.h:97
std::vector< wxString > & Members()
Definition: bus_alias.h:69
void SetName(const wxString &aName)
Definition: bus_alias.h:49
void SetParent(SCH_SCREEN *aParent)
Definition: bus_alias.h:81
BUS_ALIAS(SCH_SCREEN *aParent=NULL)
Definition: bus_alias.cpp:26
SCH_SCREEN * GetParent()
Definition: bus_alias.h:76
void AddMember(const wxString &aName)
Definition: bus_alias.h:59
wxString GetName()
Definition: bus_alias.h:44
bool Contains(const wxString &aName)
Definition: bus_alias.cpp:37