KiCad PCB EDA Suite
Loading...
Searching...
No Matches
IDF3_COMPONENT Class Reference

#include <idf_parser.h>

Public Member Functions

 IDF3_COMPONENT (IDF3_BOARD *aParent)
 Set the parent object and initializes other internal parameters to default values.
 
 ~IDF3_COMPONENT ()
 
void SetParent (IDF3_BOARD *aParent)
 Set the parent object.
 
IDF3::CAD_TYPE GetCadType (void)
 
IDF3::IDF_UNIT GetUnit (void)
 
bool SetRefDes (const std::string &aRefDes)
 Set the Reference Designator (RefDes) of this component.
 
const std::string & GetRefDes (void)
 Retrieve the Reference Designator (RefDes) of this component.
 
IDF_DRILL_DATA * AddDrill (double aDia, double aXpos, double aYpos, IDF3::KEY_PLATING aPlating, const std::string &aHoleType, IDF3::KEY_OWNER aOwner)
 Add a drill entry to the component and returns its pointer.
 
IDF_DRILL_DATA * AddDrill (IDF_DRILL_DATA *aDrilledHole)
 Add the given drill entry to the component and returns the pointer to indicate success.
 
bool DelDrill (double aDia, double aXpos, double aYpos)
 Delete a drill entry based on its size and location.
 
bool DelDrill (IDF_DRILL_DATA *aDrill)
 Delete a drill entry based on pointer.
 
const std::list< IDF_DRILL_DATA * > * GetDrills (void)
 Return the internal list of drills.
 
bool AddOutlineData (IDF3_COMP_OUTLINE_DATA *aComponentOutline)
 Add the given component outline data to this component.
 
bool DeleteOutlineData (IDF3_COMP_OUTLINE_DATA *aComponentOutline)
 Remove outline data based on the pointer provided.
 
bool DeleteOutlineData (size_t aIndex)
 Remove outline data based on the provided index.
 
size_t GetOutlinesSize (void)
 
const std::list< IDF3_COMP_OUTLINE_DATA * > * GetOutlinesData (void)
 
bool GetPosition (double &aXpos, double &aYpos, double &aAngle, IDF3::IDF_LAYER &aLayer)
 Retrieve the internal position parameters and returns true if the position was previously set, otherwise false.
 
bool SetPosition (double aXpos, double aYpos, double aAngle, IDF3::IDF_LAYER aLayer)
 Set the internal position parameters and returns true if the position was set, false if the position was previously set.
 
IDF3::IDF_PLACEMENT GetPlacement (void)
 
bool SetPlacement (IDF3::IDF_PLACEMENT aPlacementValue)
 Set the placement value of the component subject to ownership rules.
 
const std::string & GetError (void)
 

Private Member Functions

bool writeDrillData (std::ostream &aBoardFile)
 Write the internal drill data to an IDFv3 .DRILLED_HOLES section.
 
bool writePlaceData (std::ostream &aBoardFile)
 Write the component placement data to an IDFv3 .PLACEMENT section.
 
bool checkOwnership (int aSourceLine, const char *aSourceFunc)
 

Private Attributes

std::list< IDF3_COMP_OUTLINE_DATA * > components
 
std::list< IDF_DRILL_DATA * > drills
 
double xpos
 
double ypos
 
double angle
 
IDF3::IDF_PLACEMENT placement
 
IDF3::IDF_LAYER layer
 
bool hasPosition
 True after SetPosition is called once.
 
std::string refdes
 Reference Description (MUST BE UNIQUE)
 
IDF3_BOARD * parent
 
std::string errormsg
 

Friends

class IDF3_BOARD
 

Detailed Description

Definition at line 197 of file idf_parser.h.

Constructor & Destructor Documentation

◆ IDF3_COMPONENT()

IDF3_COMPONENT::IDF3_COMPONENT ( IDF3_BOARD * aParent)

Set the parent object and initializes other internal parameters to default values.

Parameters
aParentis the owning IDF3_BOARD object.

Definition at line 809 of file idf_parser.cpp.

References angle, hasPosition, IDF3_BOARD, layer, IDF3::LYR_INVALID, parent, placement, IDF3::PS_INVALID, xpos, and ypos.

◆ ~IDF3_COMPONENT()

IDF3_COMPONENT::~IDF3_COMPONENT ( )

Definition at line 823 of file idf_parser.cpp.

References components, and drills.

Member Function Documentation

◆ AddDrill() [1/2]

IDF_DRILL_DATA * IDF3_COMPONENT::AddDrill ( double aDia,
double aXpos,
double aYpos,
IDF3::KEY_PLATING aPlating,
const std::string & aHoleType,
IDF3::KEY_OWNER aOwner )

Add a drill entry to the component and returns its pointer.

Parameters
aDiadiameter of the drill (mm).
aXposX position of the drill (mm).
aYposY position of the drill (mm).
aPlatingplating type (PTH, NPTH).
aHoleTypehole class (PIN, VIA, MTG, TOOL, etc).
aOwnerowning CAD system (ECAD, MCAD, UNOWNED).
Returns
the newly created drill entry or NULL.

Definition at line 979 of file idf_parser.cpp.

References drills, and refdes.

◆ AddDrill() [2/2]

IDF_DRILL_DATA * IDF3_COMPONENT::AddDrill ( IDF_DRILL_DATA * aDrilledHole)

Add the given drill entry to the component and returns the pointer to indicate success.

A return value of NULL indicates that the item was not added and it is the user's responsibility to delete the object if necessary.

Parameters
aDrilledHolepointer to a drill entry.
Returns
aDrilledHole if the function succeeds, otherwise NULL.

Definition at line 1001 of file idf_parser.cpp.

References IDF3::CompareToken(), drills, ERROR_IDF, IDF_DRILL_DATA::GetDrillRefDes(), and refdes.

◆ AddOutlineData()

bool IDF3_COMPONENT::AddOutlineData ( IDF3_COMP_OUTLINE_DATA * aComponentOutline)

Add the given component outline data to this component.

Parameters
aComponentOutlineis a pointer to the outline data to be added.
Returns
true if the operation succeeds, otherwise false.

Definition at line 1097 of file idf_parser.cpp.

References components, and errormsg.

◆ checkOwnership()

bool IDF3_COMPONENT::checkOwnership ( int aSourceLine,
const char * aSourceFunc )
private

◆ DelDrill() [1/2]

bool IDF3_COMPONENT::DelDrill ( double aDia,
double aXpos,
double aYpos )

Delete a drill entry based on its size and location.

This operation is subject to IDF ownership rules.

Parameters
aDiadiameter (mm) of the drilled hole to be deleted.
aXposX position (mm) of the hole to be deleted.
aYposX position (mm) of the hole to be deleted.
Returns
true if a drill was found and deleted, otherwise false.
Exceptions
ifan ownership violation occurs.

Definition at line 1027 of file idf_parser.cpp.

References checkOwnership(), drills, and errormsg.

◆ DelDrill() [2/2]

bool IDF3_COMPONENT::DelDrill ( IDF_DRILL_DATA * aDrill)

Delete a drill entry based on pointer.

This operation is subject to IDF ownership rules.

Parameters
aDrillthe pointer associated with the drill entry to be deleted.
Returns
true if a drill was found and deleted, otherwise false.
Exceptions
ifan ownership violation occurs.

Definition at line 1061 of file idf_parser.cpp.

References checkOwnership(), drills, and errormsg.

◆ DeleteOutlineData() [1/2]

bool IDF3_COMPONENT::DeleteOutlineData ( IDF3_COMP_OUTLINE_DATA * aComponentOutline)

Remove outline data based on the pointer provided.

Parameters
aComponentOutlineis a pointer to be deleted from the internal list.
Returns
true if the data was found and deleted, otherwise false.

Definition at line 1116 of file idf_parser.cpp.

References checkOwnership(), components, and errormsg.

◆ DeleteOutlineData() [2/2]

bool IDF3_COMPONENT::DeleteOutlineData ( size_t aIndex)

Remove outline data based on the provided index.

Parameters
aIndexis an index to the internal outline list.
Returns
true if the data was deleted, false if the index was out of bounds.

Definition at line 1163 of file idf_parser.cpp.

References checkOwnership(), components, and errormsg.

◆ GetCadType()

IDF3::CAD_TYPE IDF3_COMPONENT::GetCadType ( void )
Returns
the type of CAD (IDF3::CAD_ELEC, IDF3::CAD_MECH) which instantiated this object.

Definition at line 926 of file idf_parser.cpp.

References IDF3::CAD_INVALID, and parent.

◆ GetDrills()

const std::list< IDF_DRILL_DATA * > * IDF3_COMPONENT::GetDrills ( void )

Return the internal list of drills.

To avoid IDF violations, the user should not alter these entries.

Definition at line 1092 of file idf_parser.cpp.

References drills.

◆ GetError()

const std::string & IDF3_COMPONENT::GetError ( void )
inline

Definition at line 376 of file idf_parser.h.

References errormsg.

◆ GetOutlinesData()

const std::list< IDF3_COMP_OUTLINE_DATA * > * IDF3_COMPONENT::GetOutlinesData ( void )
Returns
the internal list of outline data.

Definition at line 1207 of file idf_parser.cpp.

References components.

◆ GetOutlinesSize()

size_t IDF3_COMPONENT::GetOutlinesSize ( void )
Returns
the number of outlines in the internal list.

Definition at line 1201 of file idf_parser.cpp.

References components.

◆ GetPlacement()

IDF3::IDF_PLACEMENT IDF3_COMPONENT::GetPlacement ( void )
Returns
the IDF placement value of this component (UNPLACED, PLACED, ECAD, MCAD).

Definition at line 1278 of file idf_parser.cpp.

References placement.

Referenced by IDF3_BOARD::checkComponentOwnership().

◆ GetPosition()

bool IDF3_COMPONENT::GetPosition ( double & aXpos,
double & aYpos,
double & aAngle,
IDF3::IDF_LAYER & aLayer )

Retrieve the internal position parameters and returns true if the position was previously set, otherwise false.

Definition at line 1213 of file idf_parser.cpp.

References angle, errormsg, hasPosition, layer, IDF3::LYR_INVALID, xpos, and ypos.

◆ GetRefDes()

const std::string & IDF3_COMPONENT::GetRefDes ( void )

Retrieve the Reference Designator (RefDes) of this component.

Returns
the Reference Designator.

Definition at line 973 of file idf_parser.cpp.

References refdes.

Referenced by IDF3_BOARD::AddComponent(), and IDF3_BOARD::DelComponent().

◆ GetUnit()

IDF3::IDF_UNIT IDF3_COMPONENT::GetUnit ( void )
Returns
the IDF UNIT type of the parent object or IDF3::UNIT_INVALID if the parent was not set.

Definition at line 934 of file idf_parser.cpp.

References parent, and IDF3::UNIT_INVALID.

Referenced by writeDrillData().

◆ SetParent()

void IDF3_COMPONENT::SetParent ( IDF3_BOARD * aParent)

Set the parent object.

Parameters
aParentis the owning IDF3_BOARD object.

Definition at line 920 of file idf_parser.cpp.

References IDF3_BOARD, and parent.

◆ SetPlacement()

bool IDF3_COMPONENT::SetPlacement ( IDF3::IDF_PLACEMENT aPlacementValue)

Set the placement value of the component subject to ownership rules.

An exception is thrown if aPlacementValue is invalid or an ownership violation occurs.

Returns
true if the operation succeeded, otherwise false and the error message is set.

Definition at line 1284 of file idf_parser.cpp.

References checkOwnership(), errormsg, placement, and IDF3::PS_INVALID.

Referenced by IDF3_COMP_OUTLINE_DATA::readPlaceData().

◆ SetPosition()

bool IDF3_COMPONENT::SetPosition ( double aXpos,
double aYpos,
double aAngle,
IDF3::IDF_LAYER aLayer )

Set the internal position parameters and returns true if the position was set, false if the position was previously set.

This object does not allow modification of the position once it is set since this may adversely affect the relationship with its internal objects.

Parameters
aXposis the X position (mm) of the component.
aYposis the Y position (mm) of the component.
aAngleis the rotation of the component (degrees).
aLayeris the layer on which the component is places (TOP, BOTTOM).
Returns
true if the position was set, otherwise false.

Definition at line 1235 of file idf_parser.cpp.

References angle, checkOwnership(), errormsg, IDF3::GetLayerString(), hasPosition, layer, IDF3::LYR_BOTTOM, IDF3::LYR_TOP, xpos, and ypos.

Referenced by IDF3_COMP_OUTLINE_DATA::readPlaceData().

◆ SetRefDes()

bool IDF3_COMPONENT::SetRefDes ( const std::string & aRefDes)

Set the Reference Designator (RefDes) of this component.

The RefDes is shared by all outlines associated with this component.

Returns
true if the RefDes was accepted, otherwise false. Prohibited values include empty strings and the word PANEL.

Definition at line 942 of file idf_parser.cpp.

References checkOwnership(), IDF3::CompareToken(), errormsg, and refdes.

Referenced by IDF3_COMP_OUTLINE_DATA::readPlaceData().

◆ writeDrillData()

bool IDF3_COMPONENT::writeDrillData ( std::ostream & aBoardFile)
private

Write the internal drill data to an IDFv3 .DRILLED_HOLES section.

Parameters
aBoardFileis an IDFv3 file opened for writing.
Returns
true if the operation succeeded, otherwise false.

Definition at line 1307 of file idf_parser.cpp.

References drills, and GetUnit().

◆ writePlaceData()

bool IDF3_COMPONENT::writePlaceData ( std::ostream & aBoardFile)
private

Write the component placement data to an IDFv3 .PLACEMENT section.

Parameters
aBoardFileis an IDFv3 file opened for writing.
Returns
true if the operation succeeded, otherwise false.

Definition at line 1325 of file idf_parser.cpp.

References angle, components, layer, placement, refdes, xpos, and ypos.

Friends And Related Symbol Documentation

◆ IDF3_BOARD

friend class IDF3_BOARD
friend

Definition at line 382 of file idf_parser.h.

References IDF3_BOARD.

Referenced by IDF3_BOARD, IDF3_COMPONENT(), and SetParent().

Member Data Documentation

◆ angle

double IDF3_COMPONENT::angle
private

Definition at line 409 of file idf_parser.h.

Referenced by GetPosition(), IDF3_COMPONENT(), SetPosition(), and writePlaceData().

◆ components

std::list< IDF3_COMP_OUTLINE_DATA* > IDF3_COMPONENT::components
private

◆ drills

std::list< IDF_DRILL_DATA* > IDF3_COMPONENT::drills
private

◆ errormsg

std::string IDF3_COMPONENT::errormsg
private

◆ hasPosition

bool IDF3_COMPONENT::hasPosition
private

True after SetPosition is called once.

Definition at line 412 of file idf_parser.h.

Referenced by GetPosition(), IDF3_COMPONENT(), and SetPosition().

◆ layer

IDF3::IDF_LAYER IDF3_COMPONENT::layer
private

Definition at line 411 of file idf_parser.h.

Referenced by GetPosition(), IDF3_COMPONENT(), SetPosition(), and writePlaceData().

◆ parent

IDF3_BOARD* IDF3_COMPONENT::parent
private

Definition at line 414 of file idf_parser.h.

Referenced by checkOwnership(), GetCadType(), GetUnit(), IDF3_COMPONENT(), and SetParent().

◆ placement

IDF3::IDF_PLACEMENT IDF3_COMPONENT::placement
private

◆ refdes

std::string IDF3_COMPONENT::refdes
private

Reference Description (MUST BE UNIQUE)

Definition at line 413 of file idf_parser.h.

Referenced by AddDrill(), AddDrill(), GetRefDes(), SetRefDes(), and writePlaceData().

◆ xpos

double IDF3_COMPONENT::xpos
private

Definition at line 407 of file idf_parser.h.

Referenced by GetPosition(), IDF3_COMPONENT(), SetPosition(), and writePlaceData().

◆ ypos

double IDF3_COMPONENT::ypos
private

Definition at line 408 of file idf_parser.h.

Referenced by GetPosition(), IDF3_COMPONENT(), SetPosition(), and writePlaceData().


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