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 (C) 2024 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 along
18 * with this program. If not, see <http://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 <wx/string.h>
28#include "odb_attribute.h"
29#include "odb_eda_data.h"
30
31class ODB_COMPONENT;
33{
34public:
35 COMPONENTS_MANAGER() = default;
36
37 virtual ~COMPONENTS_MANAGER() { m_compList.clear(); }
38
39 ODB_COMPONENT& AddComponent( const FOOTPRINT* aFp, const EDA_DATA::PACKAGE& aPkg );
40
41 void Write( std::ostream& ost ) const;
42
43private:
44 std::list<ODB_COMPONENT> m_compList;
45};
46
47
49{
50public:
51 ODB_COMPONENT( size_t aIndex, size_t r ) : m_index( aIndex ), m_pkg_ref( r ) {}
52
53 const size_t m_index;
54 size_t m_pkg_ref;
55 std::pair<wxString, wxString> m_center;
56 wxString m_rot = wxT( "0" );
57 wxString m_mirror = wxT( "N" );
58
59 wxString m_comp_name;
60
61 wxString
63
64 std::vector<std::pair<wxString, wxString>> m_prp; // !< Component Property Record
65
66 struct TOEPRINT
67 {
68 public:
71 {
72 }
73
74 const size_t m_pin_num;
75
76 std::pair<wxString, wxString> m_center;
77
78 wxString m_rot;
80
81 wxString m_mirror;
82
83 size_t m_net_num = 0;
84
85 size_t m_subnet_num = 0;
86
87 wxString m_toeprint_name;
88
89 void Write( std::ostream& ost ) const;
90 };
91
92
93 std::list<TOEPRINT> m_toeprints;
94
95 void Write( std::ostream& ost ) const;
96};
97
98
99#endif // _ODB_COMPONENT_H_
COMPONENTS_MANAGER()=default
std::list< ODB_COMPONENT > m_compList
Definition: odb_component.h:44
ODB_COMPONENT & AddComponent(const FOOTPRINT *aFp, const EDA_DATA::PACKAGE &aPkg)
void Write(std::ostream &ost) const
virtual ~COMPONENTS_MANAGER()
Definition: odb_component.h:37
wxString m_mirror
Definition: odb_component.h:57
const size_t m_index
! CMP index number on board to be used in SNT(TOP), 0~n-1
Definition: odb_component.h:53
wxString m_rot
Definition: odb_component.h:56
std::list< TOEPRINT > m_toeprints
Definition: odb_component.h:93
std::vector< std::pair< wxString, wxString > > m_prp
Definition: odb_component.h:64
ODB_COMPONENT(size_t aIndex, size_t r)
Definition: odb_component.h:51
std::pair< wxString, wxString > m_center
Definition: odb_component.h:55
size_t m_pkg_ref
! package ref number from PKG in eda/data file, 0~n-1
Definition: odb_component.h:54
wxString m_part_name
! Part identification is a single string of ASCII characters without spaces
Definition: odb_component.h:62
void Write(std::ostream &ost) const
wxString m_comp_name
! Unique reference designator (component name)
Definition: odb_component.h:59
size_t m_subnet_num
! Number of subnet (SNT record TOP) in the referenced net
Definition: odb_component.h:85
std::pair< wxString, wxString > m_center
! Board location of the pin.
Definition: odb_component.h:76
TOEPRINT(const EDA_DATA::PIN &pin)
Definition: odb_component.h:69
void Write(std::ostream &ost) const
size_t m_net_num
! Number of NET record in the eda/data file.
Definition: odb_component.h:83
wxString m_mirror
! equal to CMP m_mirror.
Definition: odb_component.h:81
const size_t m_pin_num
! index of PIN record in the eda/data file, 0~n-1.
Definition: odb_component.h:74
wxString m_toeprint_name
! Name of the pad in PIN record
Definition: odb_component.h:87
wxString m_rot
! Rotation, clockwise, it equals to the actual PAD rotation, ! not CMP m_rot.
Definition: odb_component.h:78