KiCad PCB EDA Suite
CADSTAR_ARCHIVE_PARSER::PART Struct Reference

#include <cadstar_archive_parser.h>

Inheritance diagram for CADSTAR_ARCHIVE_PARSER::PART:
CADSTAR_ARCHIVE_PARSER::PARSER

Classes

struct  DEFINITION
 < "PARTDEFINITION" node name More...
 
struct  PART_PIN
 < "PARTPIN" node name More...
 

Public Types

enum class  PIN_TYPE {
  UNCOMMITTED , INPUT , OUTPUT_OR , OUTPUT_NOT_OR ,
  OUTPUT_NOT_NORM_OR , POWER , GROUND , TRISTATE_BIDIR ,
  TRISTATE_INPUT , TRISTATE_DRIVER
}
 

Public Member Functions

void Parse (XNODE *aNode, PARSER_CONTEXT *aContext) override
 

Static Public Member Functions

static PIN_TYPE GetPinType (XNODE *aNode)
 

Public Attributes

PART_ID ID
 
wxString Name
 
long Version
 
DEFINITION Definition
 
std::map< PART_PIN_ID, PART_PINPartPins
 It is unclear why there are two "Pin" structures in CPA files... PART_PIN seems to be a reduced version of PART::DEFINITION::PIN Therefore, PART_PIN is only included for completeness of the parser, but won't be used. More...
 
bool HidePinNames = false
 This seems to be a duplicate of DEFINITION::HidePinNames Possibly only used in older file formats? More...
 
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUEAttributeValues
 Some attributes are defined within the part definition, whilst others are defined in the part itself. More...
 

Detailed Description

Definition at line 969 of file cadstar_archive_parser.h.

Member Enumeration Documentation

◆ PIN_TYPE

Enumerator
UNCOMMITTED 

Uncommitted pin (default)

INPUT 

Input pin.

OUTPUT_OR 

Output pin OR tieable.

OUTPUT_NOT_OR 

Output pin not OR tieable.

OUTPUT_NOT_NORM_OR 

Output pin not normally OR tieable.

POWER 

Power pin.

GROUND 

Ground pin.

TRISTATE_BIDIR 

Tristate bi-directional driver pin.

TRISTATE_INPUT 

Tristate input pin.

TRISTATE_DRIVER 

Tristate output pin.

Definition at line 971 of file cadstar_archive_parser.h.

972 {
973 UNCOMMITTED,
974 INPUT,
975 OUTPUT_OR,
976 OUTPUT_NOT_OR,
977 OUTPUT_NOT_NORM_OR,
978 POWER,
979 GROUND,
980 TRISTATE_BIDIR,
981 TRISTATE_INPUT,
982 TRISTATE_DRIVER
983 };

Member Function Documentation

◆ GetPinType()

CADSTAR_ARCHIVE_PARSER::PART::PIN_TYPE CADSTAR_ARCHIVE_PARSER::PART::GetPinType ( XNODE aNode)
static

Definition at line 1771 of file cadstar_archive_parser.cpp.

1772{
1773 wxASSERT( aNode->GetName() == wxT( "PINTYPE" ) );
1774
1775 wxString pinTypeStr = GetXmlAttributeIDString( aNode, 0 );
1776
1777 std::map<wxString, PIN_TYPE> pinTypeMap = { { wxT( "INPUT" ), PIN_TYPE::INPUT },
1778 { wxT( "OUTPUT_OR" ), PIN_TYPE::OUTPUT_OR },
1779 { wxT( "OUTPUT_NOT_OR" ), PIN_TYPE::OUTPUT_NOT_OR },
1780 { wxT( "OUTPUT_NOT_NORM_OR" ), PIN_TYPE::OUTPUT_NOT_NORM_OR },
1781 { wxT( "POWER" ), PIN_TYPE::POWER }, { wxT( "GROUND" ), PIN_TYPE::GROUND },
1782 { wxT( "TRISTATE_BIDIR" ), PIN_TYPE::TRISTATE_BIDIR },
1783 { wxT( "TRISTATE_INPUT" ), PIN_TYPE::TRISTATE_INPUT },
1784 { wxT( "TRISTATE_DRIVER" ), PIN_TYPE::TRISTATE_DRIVER } };
1785
1786 if( pinTypeMap.find( pinTypeStr ) == pinTypeMap.end() )
1787 THROW_UNKNOWN_PARAMETER_IO_ERROR( pinTypeStr, aNode->GetName() );
1788
1789 return pinTypeMap[pinTypeStr];
1790}
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
@ OUTPUT_NOT_OR
Output pin not OR tieable.
@ TRISTATE_DRIVER
Tristate output pin.
@ OUTPUT_OR
Output pin OR tieable.
@ TRISTATE_BIDIR
Tristate bi-directional driver pin.
@ OUTPUT_NOT_NORM_OR
Output pin not normally OR tieable.

References CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), and THROW_UNKNOWN_PARAMETER_IO_ERROR.

◆ Parse()

void CADSTAR_ARCHIVE_PARSER::PART::Parse ( XNODE aNode,
PARSER_CONTEXT aContext 
)
overridevirtual

Implements CADSTAR_ARCHIVE_PARSER::PARSER.

Definition at line 2007 of file cadstar_archive_parser.cpp.

2008{
2009 wxASSERT( aNode->GetName() == wxT( "PART" ) );
2010
2011 ID = GetXmlAttributeIDString( aNode, 0 );
2012 Name = GetXmlAttributeIDString( aNode, 1 );
2013
2014 XNODE* cNode = aNode->GetChildren();
2015
2016 for( ; cNode; cNode = cNode->GetNext() )
2017 {
2018 wxString cNodeName = cNode->GetName();
2019
2020 if( cNodeName == wxT( "VERSION" ) )
2021 {
2022 Version = GetXmlAttributeIDLong( cNode, 0 );
2023 }
2024 else if( cNodeName == wxT( "HIDEPINNAMES" ) )
2025 {
2026 HidePinNames = true;
2027 }
2028 else if( cNodeName == wxT( "PARTDEFINITION" ) )
2029 {
2030 Definition.Parse( cNode, aContext );
2031 }
2032 else if( cNodeName == wxT( "PARTPIN" ) )
2033 {
2034 PART_PIN pin;
2035 pin.Parse( cNode, aContext );
2036 PartPins.insert( std::make_pair( pin.ID, pin ) );
2037 }
2038 else if( cNodeName == wxT( "ATTR" ) )
2039 {
2040 ATTRIBUTE_VALUE attr;
2041 attr.Parse( cNode, aContext );
2042 AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
2043 }
2044 else
2045 {
2046 THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
2047 }
2048 }
2049}
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:44
XNODE * GetChildren() const
Definition: xnode.h:62
XNODE * GetNext() const
Definition: xnode.h:67
void Parse(XNODE *aNode, PARSER_CONTEXT *aContext) override
std::map< PART_PIN_ID, PART_PIN > PartPins
It is unclear why there are two "Pin" structures in CPA files... PART_PIN seems to be a reduced versi...
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part itself.
bool HidePinNames
This seems to be a duplicate of DEFINITION::HidePinNames Possibly only used in older file formats?

References CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_VALUE::AttributeID, XNODE::GetChildren(), XNODE::GetNext(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDLong(), CADSTAR_ARCHIVE_PARSER::GetXmlAttributeIDString(), CADSTAR_ARCHIVE_PARSER::ATTRIBUTE_VALUE::Parse(), pin, and THROW_UNKNOWN_NODE_IO_ERROR.

Referenced by CADSTAR_ARCHIVE_PARSER::PARTS::Parse().

Member Data Documentation

◆ AttributeValues

std::map<ATTRIBUTE_ID, ATTRIBUTE_VALUE> CADSTAR_ARCHIVE_PARSER::PART::AttributeValues

Some attributes are defined within the part definition, whilst others are defined in the part itself.

Definition at line 1155 of file cadstar_archive_parser.h.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::loadSymDefIntoLibrary().

◆ Definition

◆ HidePinNames

bool CADSTAR_ARCHIVE_PARSER::PART::HidePinNames = false

This seems to be a duplicate of DEFINITION::HidePinNames Possibly only used in older file formats?

Definition at line 1152 of file cadstar_archive_parser.h.

◆ ID

PART_ID CADSTAR_ARCHIVE_PARSER::PART::ID

◆ Name

◆ PartPins

std::map<PART_PIN_ID, PART_PIN> CADSTAR_ARCHIVE_PARSER::PART::PartPins

It is unclear why there are two "Pin" structures in CPA files... PART_PIN seems to be a reduced version of PART::DEFINITION::PIN Therefore, PART_PIN is only included for completeness of the parser, but won't be used.

Definition at line 1146 of file cadstar_archive_parser.h.

◆ Version

long CADSTAR_ARCHIVE_PARSER::PART::Version

Definition at line 1144 of file cadstar_archive_parser.h.


The documentation for this struct was generated from the following files: