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

Hold a parameter value for an "aperture macro" as defined within standard RS274X. More...

#include <am_param.h>

Public Member Functions

 AM_PARAM ()
 
void PushOperator (parm_item_type aType, double aValue)
 Add an operator/operand to the current stack.
 
void PushOperator (parm_item_type aType, int aValue=0)
 
double GetValueFromMacro (APERTURE_MACRO *aApertureMacro) const
 
bool IsImmediate () const
 Test if this AM_PARAM holds an immediate parameter or is a pointer into a parameter held by an owning D_CODE.
 
unsigned GetIndex () const
 
void SetIndex (int aIndex)
 
bool ReadParamFromAmDef (char *&aText)
 Read one aperture macro parameter.
 

Private Attributes

int m_index
 has meaning to define parameter local to an aperture macro this is the id of a parameter defined like $n = ....
 
std::vector< AM_PARAM_ITEMm_paramStack
 List of operands/operators to evaluate the actual value if a par def is $3/2, there are 3 items in stack: 3 (type PUSHPARM) , / (type DIV), 2 (type PUSHVALUE).
 

Detailed Description

Hold a parameter value for an "aperture macro" as defined within standard RS274X.

The parameter can be a constant, i.e. "immediate" parameter, or depend on some deferred values, defined in a D_CODE, by the ADD command. Note the actual value could need an evaluation from an arithmetical expression items in the expression are stored in. A simple definition is just a value stored in one item in m_paramStack.

Definition at line 284 of file am_param.h.

Constructor & Destructor Documentation

◆ AM_PARAM()

AM_PARAM::AM_PARAM ( )

Definition at line 47 of file am_param.cpp.

References m_index.

Member Function Documentation

◆ GetIndex()

unsigned AM_PARAM::GetIndex ( ) const
inline

Definition at line 309 of file am_param.h.

References m_index.

Referenced by APERTURE_MACRO::EvalLocalParams().

◆ GetValueFromMacro()

◆ IsImmediate()

bool AM_PARAM::IsImmediate ( ) const

Test if this AM_PARAM holds an immediate parameter or is a pointer into a parameter held by an owning D_CODE.

Function IsImmediate tests if this AM_PARAM holds an immediate parameter or has parameter held by an owning D_CODE.

Returns
true if the value is immediate, i.e. no deferred value in operands used in its definition.

Definition at line 57 of file am_param.cpp.

References m_paramStack.

◆ PushOperator() [1/2]

void AM_PARAM::PushOperator ( parm_item_type  aType,
double  aValue 
)

Add an operator/operand to the current stack.

add an operator/operand to the current stack aType = NOP, PUSHVALUE, PUSHPARM, ADD, SUB, MUL, DIV, EQUATE aValue required only for PUSHVALUE (double) or PUSHPARM (int) aType.

Parameters
aTypeis the type of item (NOP, PUSHVALUE, PUSHPARM, ADD, SUB, MUL, DIV, EQUATE)
aValueis the item value, double for PUSHVALUE or int for PUSHPARM type.

Definition at line 143 of file am_param.cpp.

References m_paramStack.

Referenced by ReadParamFromAmDef().

◆ PushOperator() [2/2]

void AM_PARAM::PushOperator ( parm_item_type  aType,
int  aValue = 0 
)

Definition at line 149 of file am_param.cpp.

References m_paramStack.

◆ ReadParamFromAmDef()

bool AM_PARAM::ReadParamFromAmDef ( char *&  aText)

Read one aperture macro parameter.

Function ReadParam Read one aperture macro parameter a parameter can be: a number a reference to an aperture definition parameter value: $1 ot $3 ... a parameter definition can be complex and have operators between numbers and/or other parameter like $1+3 or $2x2.

a parameter can be: a number a reference to an aperture definition parameter value: $1 to $3 ... a parameter definition can be complex and have operators between numbers and/or other parameter like $1+3 or $2x2.. Parameters are separated by a comma ( of finish by *)

Parameters
aText= pointer to the parameter to read. Will be modified to point to the next field
Returns
true if a param is read, or false

Note minus sign is not always an operator. It can be the sign of a value. Parameters are separated by a comma ( of finish by *)

Parameters
aText= pointer to the parameter to read. Will be modified to point to the next field
Returns
true if a param is read, or false

Definition at line 168 of file am_param.cpp.

References ADD, CLOSE_PAR, DIV, KI_FALLTHROUGH, m_index, m_paramStack, MUL, OPEN_PAR, PushOperator(), PUSHPARM, PUSHVALUE, ReadDouble(), ReadInt(), SetIndex(), and SUB.

Referenced by GERBER_FILE_IMAGE::ReadApertureMacro().

◆ SetIndex()

void AM_PARAM::SetIndex ( int  aIndex)
inline

Definition at line 314 of file am_param.h.

References m_index.

Referenced by ReadParamFromAmDef().

Member Data Documentation

◆ m_index

int AM_PARAM::m_index
private

has meaning to define parameter local to an aperture macro this is the id of a parameter defined like $n = ....

n is the index

Definition at line 341 of file am_param.h.

Referenced by AM_PARAM(), GetIndex(), ReadParamFromAmDef(), and SetIndex().

◆ m_paramStack

std::vector<AM_PARAM_ITEM> AM_PARAM::m_paramStack
private

List of operands/operators to evaluate the actual value if a par def is $3/2, there are 3 items in stack: 3 (type PUSHPARM) , / (type DIV), 2 (type PUSHVALUE).

Definition at line 347 of file am_param.h.

Referenced by GetValueFromMacro(), IsImmediate(), PushOperator(), and ReadParamFromAmDef().


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