KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ipc2581_function_mode.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 *
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
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef IPC2581_FUNCTION_MODE_H
21#define IPC2581_FUNCTION_MODE_H
22
23#include <bitset>
24#include <initializer_list>
25#include <optional>
26#include <vector>
27
29#include <layer_ids.h>
30#include <wx/string.h>
31
32namespace IPC2581
33{
34
35// The function mode table is the vocabulary that ODB++ shares
36using namespace FAB;
37
39enum class REVISION
40{
43};
44
63
65class SUPPRESS_SET : public std::bitset<static_cast<size_t>( SUPPRESS::COUNT )>
66{
67public:
68 bool Contains( SUPPRESS aWhat ) const { return test( static_cast<size_t>( aWhat ) ); }
69
70 SUPPRESS_SET& Set( SUPPRESS aWhat, bool aOn = true )
71 {
72 set( static_cast<size_t>( aWhat ), aOn );
73 return *this;
74 }
75};
76
79{
80 std::optional<SECTION> m_section;
81 std::optional<SECTION> m_requires;
82 wxString m_message;
83};
84
86{
89 std::vector<CONFLICT> m_conflicts;
90
91 bool Ok() const { return m_conflicts.empty(); }
92};
93
99bool ModeSupported( MODE aMode, REVISION aRevision );
100
102std::optional<SECTION> SectionForBoardLayer( PCB_LAYER_ID aLayer );
103
109std::optional<SECTION> SectionForLayerFunction( const wxString& aLayerFunction,
110 const wxString& aSide = wxEmptyString );
111
119RESOLVE_RESULT ResolveSections( REVISION aRevision, MODE aMode, const SECTION_SET& aRequested );
120
121} // namespace IPC2581
122
123#endif // IPC2581_FUNCTION_MODE_H
#define REVISION
Definition 3d_plugin.h:36
Set of schema sections.
Set of removed attributes.
bool Contains(SUPPRESS aWhat) const
SUPPRESS_SET & Set(SUPPRESS aWhat, bool aOn=true)
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
JOB_EXPORT_PCB_FAB::DATA_SET MODE
Columns of Table 4 The job owns the enum so that every layer shares one type.
RESOLVE_RESULT ResolveSections(REVISION aRevision, MODE aMode, const SECTION_SET &aRequested)
Compare aRequested with Table 4 and give the attributes to remove and the conflicts.
REVISION
Schema revision The two revisions declare different identity constraints.
std::optional< SECTION > SectionForLayerFunction(const wxString &aLayerFunction, const wxString &aSide)
Schema section that holds the layers with aLayerFunction.
bool ModeSupported(MODE aMode, REVISION)
True if KiCad can write aMode for aRevision.
SUPPRESS
Optional attributes to remove when their schema section is absent.
@ PINREF_COMPONENTREF
Pad/PinRef@componentRef and LogicalNet/PinRef@componentRef.
@ BOM_HEADER_STEPREF
Bom/BomHeader/StepRef.
@ COMPONENT_REFDES
Component\refDes.
@ PAD_PADSTACKDEFREF
Pad@padstackDefRef, and the PadStackDef elements themselves.
@ COMPONENT_PACKAGEREF
Component@packageRef.
@ BOM_REFDES_PACKAGEREF
Bom/BomItem/RefDes@packageRef.
@ BOM_REFDES
Bom/BomItem/RefDes and all its attributes.
@ BOM_REFDES_LAYERREF
Bom/BomItem/RefDes@layerRef.
std::optional< SECTION > SectionForBoardLayer(PCB_LAYER_ID aLayer)
Schema section that holds the artwork of aLayer.
A requested combination that no legal file can hold.
std::optional< SECTION > m_section
std::optional< SECTION > m_requires
std::vector< CONFLICT > m_conflicts