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  PIN_TYPE {
  PIN_TYPE::UNCOMMITTED, PIN_TYPE::INPUT, PIN_TYPE::OUTPUT_OR, PIN_TYPE::OUTPUT_NOT_OR,
  PIN_TYPE::OUTPUT_NOT_NORM_OR, PIN_TYPE::POWER, PIN_TYPE::GROUND, PIN_TYPE::TRISTATE_BIDIR,
  PIN_TYPE::TRISTATE_INPUT, PIN_TYPE::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... 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 925 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 927 of file cadstar_archive_parser.h.

928  {
929  UNCOMMITTED,
930  INPUT,
931  OUTPUT_OR,
932  OUTPUT_NOT_OR,
933  OUTPUT_NOT_NORM_OR,
934  POWER,
935  GROUND,
936  TRISTATE_BIDIR,
937  TRISTATE_INPUT,
938  TRISTATE_DRIVER
939  };

Member Function Documentation

◆ GetPinType()

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

Definition at line 1658 of file cadstar_archive_parser.cpp.

1659 {
1660  wxASSERT( aNode->GetName() == wxT( "PINTYPE" ) );
1661 
1662  wxString pinTypeStr = GetXmlAttributeIDString( aNode, 0 );
1663 
1664  std::map<wxString, PIN_TYPE> pinTypeMap = { { wxT( "INPUT" ), PIN_TYPE::INPUT },
1665  { wxT( "OUTPUT_OR" ), PIN_TYPE::OUTPUT_OR },
1666  { wxT( "OUTPUT_NOT_OR" ), PIN_TYPE::OUTPUT_NOT_OR },
1667  { wxT( "OUTPUT_NOT_NORM_OR" ), PIN_TYPE::OUTPUT_NOT_NORM_OR },
1668  { wxT( "POWER" ), PIN_TYPE::POWER }, { wxT( "GROUND" ), PIN_TYPE::GROUND },
1669  { wxT( "TRISTATE_BIDIR" ), PIN_TYPE::TRISTATE_BIDIR },
1670  { wxT( "TRISTATE_INPUT" ), PIN_TYPE::TRISTATE_INPUT },
1671  { wxT( "TRISTATE_DRIVER" ), PIN_TYPE::TRISTATE_DRIVER } };
1672 
1673  if( pinTypeMap.find( pinTypeStr ) == pinTypeMap.end() )
1674  THROW_UNKNOWN_PARAMETER_IO_ERROR( pinTypeStr, aNode->GetName() );
1675 
1676  return pinTypeMap[pinTypeStr];
1677 }
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
#define THROW_UNKNOWN_PARAMETER_IO_ERROR(param, location)

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 1891 of file cadstar_archive_parser.cpp.

1892 {
1893  wxASSERT( aNode->GetName() == wxT( "PART" ) );
1894 
1895  ID = GetXmlAttributeIDString( aNode, 0 );
1896  Name = GetXmlAttributeIDString( aNode, 1 );
1897 
1898  XNODE* cNode = aNode->GetChildren();
1899 
1900  for( ; cNode; cNode = cNode->GetNext() )
1901  {
1902  wxString cNodeName = cNode->GetName();
1903 
1904  if( cNodeName == wxT( "VERSION" ) )
1905  {
1906  Version = GetXmlAttributeIDLong( cNode, 0 );
1907  }
1908  else if( cNodeName == wxT( "HIDEPINNAMES" ) )
1909  {
1910  HidePinNames = true;
1911  }
1912  else if( cNodeName == wxT( "PARTDEFINITION" ) )
1913  {
1914  Definition.Parse( cNode, aContext );
1915  }
1916  else if( cNodeName == wxT( "PARTPIN" ) )
1917  {
1918  PART_PIN pin;
1919  pin.Parse( cNode, aContext );
1920  PartPins.insert( std::make_pair( pin.ID, pin ) );
1921  }
1922  else if( cNodeName == wxT( "ATTR" ) )
1923  {
1924  ATTRIBUTE_VALUE attr;
1925  attr.Parse( cNode, aContext );
1926  AttributeValues.insert( std::make_pair( attr.AttributeID, attr ) );
1927  }
1928  else
1929  {
1930  THROW_UNKNOWN_NODE_IO_ERROR( cNodeName, aNode->GetName() );
1931  }
1932  }
1933 }
bool HidePinNames
This seems to be a duplicate of DEFINITION::HidePinNames Possibly only used in older file formats?
std::map< ATTRIBUTE_ID, ATTRIBUTE_VALUE > AttributeValues
Some attributes are defined within the part definition, whilst others are defined in the part itself.
XNODE * GetChildren() const
Definition: xnode.h:62
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...
static long GetXmlAttributeIDLong(XNODE *aNode, unsigned int aID, bool aIsRequired=true)
Hold an XML or S-expression element.
Definition: xnode.h:43
XNODE * GetNext() const
Definition: xnode.h:67
#define THROW_UNKNOWN_NODE_IO_ERROR(nodename, location)
static wxString GetXmlAttributeIDString(XNODE *aNode, unsigned int aID, bool aIsRequired=true)

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 1111 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 1108 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 1102 of file cadstar_archive_parser.h.

◆ Version

long CADSTAR_ARCHIVE_PARSER::PART::Version

Definition at line 1100 of file cadstar_archive_parser.h.


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