KiCad PCB EDA Suite
|
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_ITEM > | m_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). | |
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.
AM_PARAM::AM_PARAM | ( | ) |
Definition at line 47 of file am_param.cpp.
References m_index.
|
inline |
Definition at line 309 of file am_param.h.
References m_index.
Referenced by APERTURE_MACRO::EvalLocalParams().
double AM_PARAM::GetValueFromMacro | ( | APERTURE_MACRO * | aApertureMacro | ) | const |
Definition at line 73 of file am_param.cpp.
References ADD, CLOSE_PAR, DIV, Evaluate(), AM_PARAM_ITEM::GetIndex(), APERTURE_MACRO::GetLocalParamValue(), AM_PARAM_ITEM::GetType(), AM_PARAM_ITEM::GetValue(), m_paramStack, MUL, OPEN_PAR, PUSHPARM, PUSHVALUE, and SUB.
Referenced by APERTURE_MACRO::EvalLocalParams().
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.
Definition at line 57 of file am_param.cpp.
References m_paramStack.
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.
aType | is the type of item (NOP, PUSHVALUE, PUSHPARM, ADD, SUB, MUL, DIV, EQUATE) |
aValue | is 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().
void AM_PARAM::PushOperator | ( | parm_item_type | aType, |
int | aValue = 0 |
||
) |
Definition at line 149 of file am_param.cpp.
References m_paramStack.
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 *)
aText | = pointer to the parameter to read. Will be modified to point to the next field |
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 *)
aText | = pointer to the parameter to read. Will be modified to point to the next field |
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().
|
inline |
|
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().
|
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().