KiCad PCB EDA Suite
Loading...
Searching...
No Matches
odb_component.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 The KiCad Developers, see AUTHORS.txt for contributors.
5 * Author: SYSUEric <[email protected]>.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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, see <https://www.gnu.org/licenses/>.
19 */
20
21
22#ifndef _ODB_COMPONENT_H_
23#define _ODB_COMPONENT_H_
24
25#include "odb_util.h"
26#include <list>
27#include <set>
28#include <wx/string.h>
29#include "odb_attribute.h"
30#include "odb_eda_data.h"
31
32class ODB_COMPONENT;
33class PCB_IO_ODBPP;
34
36{
37public:
38 explicit COMPONENTS_MANAGER( PCB_IO_ODBPP* aPlugin = nullptr ) : m_plugin( aPlugin ) {}
39
40 virtual ~COMPONENTS_MANAGER() { m_compList.clear(); }
41
42 ODB_COMPONENT& AddComponent( const FOOTPRINT* aFp, const EDA_DATA::PACKAGE& aPkg );
43
44 void Write( std::ostream& ost ) const;
45
46private:
49 std::list<ODB_COMPONENT> m_compList;
50 std::set<wxString> m_usedCompNames;
51};
52
53
55{
56public:
57 ODB_COMPONENT( size_t aIndex, size_t r ) : m_index( aIndex ), m_pkg_ref( r ) {}
58
59 const size_t m_index;
60 size_t m_pkg_ref;
61 std::pair<wxString, wxString> m_center;
62 wxString m_rot = wxT( "0" );
63 wxString m_mirror = wxT( "N" );
64
65 wxString m_comp_name;
66
67 wxString
69
70 std::map<wxString, wxString> m_prp; // !< Component Property Record
71
72 struct TOEPRINT
73 {
74 public:
77 {
78 }
79
80 const size_t m_pin_num;
81
82 std::pair<wxString, wxString> m_center;
83
84 wxString m_rot;
86
87 wxString m_mirror;
88
89 size_t m_net_num = 0;
90
91 size_t m_subnet_num = 0;
92
93 wxString m_toeprint_name;
94
95 void Write( std::ostream& ost ) const;
96 };
97
98
99 std::list<TOEPRINT> m_toeprints;
100
101 void Write( std::ostream& ost ) const;
102};
103
104
105#endif // _ODB_COMPONENT_H_
ATTR_MANAGER()=default
ATTR_RECORD_WRITER()=default
PCB_IO_ODBPP * m_plugin
Plugin the export runs under, used to report designator changes; may be nullptr.
COMPONENTS_MANAGER(PCB_IO_ODBPP *aPlugin=nullptr)
std::list< ODB_COMPONENT > m_compList
ODB_COMPONENT & AddComponent(const FOOTPRINT *aFp, const EDA_DATA::PACKAGE &aPkg)
void Write(std::ostream &ost) const
std::set< wxString > m_usedCompNames
virtual ~COMPONENTS_MANAGER()
wxString m_mirror
const size_t m_index
! CMP index number on board to be used in SNT(TOP), 0~n-1
std::list< TOEPRINT > m_toeprints
ODB_COMPONENT(size_t aIndex, size_t r)
std::pair< wxString, wxString > m_center
size_t m_pkg_ref
! package ref number from PKG in eda/data file, 0~n-1
wxString m_part_name
! Part identification is a single string of ASCII characters without spaces
void Write(std::ostream &ost) const
wxString m_comp_name
! Unique reference designator (component name)
std::map< wxString, wxString > m_prp
size_t m_subnet_num
! Number of subnet (SNT record TOP) in the referenced net
std::pair< wxString, wxString > m_center
! Board location of the pin.
TOEPRINT(const EDA_DATA::PIN &pin)
void Write(std::ostream &ost) const
size_t m_net_num
! Number of NET record in the eda/data file.
wxString m_mirror
! equal to CMP m_mirror.
const size_t m_pin_num
! index of PIN record in the eda/data file, 0~n-1.
wxString m_toeprint_name
! Name of the pad in PIN record
KIBIS_PIN * pin