KiCad PCB EDA Suite
gbr_netlist_metadata.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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
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
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef GBR_NETLIST_METADATA_H
26 #define GBR_NETLIST_METADATA_H
27 
28 
29 // this class handle info which can be added in a gerber file as attribute
30 // of an obtect
31 // the GBR_INFO_TYPE types can be OR'ed to add 2 (or more) attributes
32 // There are only 3 net attributes defined attached to an object by the %TO command
33 // %TO.P
34 // %TO.N
35 // %TO.C
36 // the .P attribute can be used only for flashed pads (using the D03 command)
37 // and only for external copper layers, if the component is on a external copper layer
38 // for other copper layer items (pads on internal layers, tracks ... ), only .N and .C
39 // can be used
41 {
42 public:
43  // This enum enables the different net attributes attache to the object
44  // the values can be ORed for items which can have more than one attribute
45  // (A flashed pad has all allowed attributes)
47  {
52  };
53 
54  // these members are used in the %TO object attributes command.
56  bool m_NotInNet;
58  wxString m_Padname;
61  wxString m_Cmpref;
62  wxString m_Netname;
63 
64  GBR_NETLIST_METADATA(): m_NetAttribType( GBR_NETINFO_UNSPECIFIED ), m_NotInNet( false )
65  {
66  }
67 
73  void ClearAttribute( const wxString* aName )
74  {
75  if( m_NetAttribType == GBR_NETINFO_UNSPECIFIED )
76  {
77  m_Padname.clear();
78  m_Cmpref.clear();
79  m_Netname.clear();
80  return;
81  }
82 
83  if( !aName || aName->IsEmpty() || *aName == ".CN" )
84  {
85  m_NetAttribType = GBR_NETINFO_UNSPECIFIED;
86  m_Padname.clear();
87  m_Cmpref.clear();
88  m_Netname.clear();
89  return;
90  }
91 
92  if( *aName == ".C" )
93  {
94  m_NetAttribType &= ~GBR_NETINFO_CMP;
95  m_Cmpref.clear();
96  return;
97  }
98 
99  if( *aName == ".N" )
100  {
101  m_NetAttribType &= ~GBR_NETINFO_NET;
102  m_Netname.clear();
103  return;
104  }
105 
106  if( *aName == ".P" )
107  {
108  m_NetAttribType &= ~GBR_NETINFO_PAD;
109  m_Cmpref.clear();
110  return;
111  }
112  }
113 };
114 
115 // Flashed pads use the full attribute set: this is a helper for flashed pads
116 #define GBR_NETINFO_ALL (GBR_NETLIST_METADATA::GBR_NETINFO_PAD\
117  | GBR_NETLIST_METADATA::GBR_NETINFO_NET\
118  | GBR_NETLIST_METADATA::GBR_NETINFO_CMP )
119 
120 #endif // GBR_NETLIST_METADATA_H
print info associated to a component (TO.C attribute)
wxString m_Cmpref
the component reference parent of the data
wxString m_Padname
for a flashed pad: the pad name ((TO.P attribute)
wxString m_Netname
for items associated to a net: the netname
print info associated to a flashed pad (TO.P attribute)
void ClearAttribute(const wxString *aName)
remove the net attribute specified by aName If aName == NULL or empty, remove all attributes ...
bool m_NotInNet
true if a pad of a footprint cannot be connected (for instance a mechanical NPTH, ot a not named pad)...
print info associated to a net (TO.N attribute)
int m_NetAttribType
the type of net info (used to define the gerber string to create)