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

#include <pcbexpr_evaluator.h>

Inheritance diagram for PCBEXPR_CONTEXT:
LIBEVAL::CONTEXT

Public Member Functions

 PCBEXPR_CONTEXT (int aConstraint=0, PCB_LAYER_ID aLayer=F_Cu)
 
void SetItems (BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
 
void SetConstraint (int aConstraint)
 
void SetLayer (PCB_LAYER_ID aLayer)
 
void Reset () override
 Rewind for reuse on the next evaluation (see LIBEVAL::CONTEXT::Reset()).
 
void SetTypeOverride (const BOARD_ITEM *aItem, KICAD_T aType)
 
KICAD_T GetEffectiveType (const BOARD_ITEM *aItem) const
 
BOARDGetBoard () const
 
int GetConstraint () const
 
BOARD_ITEMGetItem (int index) const
 
PCB_LAYER_ID GetLayer () const
 
VALUEAllocValue ()
 
VALUEStoreValue (VALUE *aValue)
 
void Push (VALUE *v)
 
VALUEPop ()
 
VALUETop ()
 Peek the top of the stack without popping (used by the short-circuit jumps).
 
int SP () const
 
void SetErrorCallback (std::function< void(const wxString &aMessage, int aOffset)> aCallback)
 
bool HasErrorCallback ()
 
void ReportError (const wxString &aErrorMsg)
 

Private Member Functions

VALUEinlineValue (std::size_t aIndex)
 

Private Attributes

int m_constraint
 
BOARD_ITEMm_items [2]
 
PCB_LAYER_ID m_layer
 
std::map< const BOARD_ITEM *, KICAD_Tm_typeOverrides
 
std::vector< VALUE * > m_ownedValues
 
VALUEm_stack [100]
 
int m_stackPtr
 
unsigned char m_inlineStorage [INLINE_VALUE_COUNT *sizeof(VALUE)]
 
std::size_t m_inlineUsed
 
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback
 

Static Private Attributes

static constexpr std::size_t INLINE_VALUE_COUNT = 32
 

Detailed Description

Definition at line 66 of file pcbexpr_evaluator.h.

Constructor & Destructor Documentation

◆ PCBEXPR_CONTEXT()

PCBEXPR_CONTEXT::PCBEXPR_CONTEXT ( int aConstraint = 0,
PCB_LAYER_ID aLayer = F_Cu )
inline

Definition at line 69 of file pcbexpr_evaluator.h.

References F_Cu, m_constraint, m_items, and m_layer.

Member Function Documentation

◆ AllocValue()

◆ GetBoard()

BOARD * PCBEXPR_CONTEXT::GetBoard ( ) const

Definition at line 752 of file pcbexpr_evaluator.cpp.

References m_items.

Referenced by PCBEXPR_VAR_REF::GetValue().

◆ GetConstraint()

int PCBEXPR_CONTEXT::GetConstraint ( ) const
inline

◆ GetEffectiveType()

KICAD_T PCBEXPR_CONTEXT::GetEffectiveType ( const BOARD_ITEM * aItem) const

Definition at line 397 of file pcbexpr_evaluator.cpp.

References m_typeOverrides, and EDA_ITEM::Type().

Referenced by PCBEXPR_TYPE_REF::GetValue().

◆ GetItem()

BOARD_ITEM * PCBEXPR_CONTEXT::GetItem ( int index) const
inline

◆ GetLayer()

◆ HasErrorCallback()

◆ inlineValue()

VALUE * LIBEVAL::CONTEXT::inlineValue ( std::size_t aIndex)
inlineprivateinherited

Definition at line 454 of file libeval_compiler.h.

References m_inlineStorage.

Referenced by AllocValue(), and Reset().

◆ Pop()

◆ Push()

◆ ReportError()

◆ Reset()

void PCBEXPR_CONTEXT::Reset ( )
inlineoverridevirtual

Rewind for reuse on the next evaluation (see LIBEVAL::CONTEXT::Reset()).

Reimplemented from LIBEVAL::CONTEXT.

Definition at line 87 of file pcbexpr_evaluator.h.

References F_Cu, m_constraint, m_items, m_layer, m_typeOverrides, and LIBEVAL::CONTEXT::Reset().

Referenced by DRC_RULE_CONDITION::EvaluateFor().

◆ SetConstraint()

void PCBEXPR_CONTEXT::SetConstraint ( int aConstraint)
inline

Definition at line 83 of file pcbexpr_evaluator.h.

References m_constraint.

Referenced by DRC_RULE_CONDITION::EvaluateFor().

◆ SetErrorCallback()

void LIBEVAL::CONTEXT::SetErrorCallback ( std::function< void(const wxString &aMessage, int aOffset)> aCallback)
inlineinherited

◆ SetItems()

◆ SetLayer()

void PCBEXPR_CONTEXT::SetLayer ( PCB_LAYER_ID aLayer)
inline

Definition at line 84 of file pcbexpr_evaluator.h.

References m_layer.

Referenced by DRC_RULE_CONDITION::EvaluateFor().

◆ SetTypeOverride()

void PCBEXPR_CONTEXT::SetTypeOverride ( const BOARD_ITEM * aItem,
KICAD_T aType )
inline

Definition at line 97 of file pcbexpr_evaluator.h.

References m_typeOverrides.

Referenced by DRC_RULE_CONDITION::EvaluateFor().

◆ SP()

int LIBEVAL::CONTEXT::SP ( ) const
inlineinherited

Definition at line 437 of file libeval_compiler.h.

References m_stackPtr.

Referenced by LIBEVAL::UCODE::Run().

◆ StoreValue()

VALUE * LIBEVAL::CONTEXT::StoreValue ( VALUE * aValue)
inlineinherited

Definition at line 403 of file libeval_compiler.h.

References m_ownedValues.

Referenced by LIBEVAL::UOP::Exec(), and LIBEVAL::UCODE::Run().

◆ Top()

VALUE * LIBEVAL::CONTEXT::Top ( )
inlineinherited

Peek the top of the stack without popping (used by the short-circuit jumps).

Definition at line 426 of file libeval_compiler.h.

References _, AllocValue(), m_stack, m_stackPtr, and ReportError().

Referenced by LIBEVAL::UOP::Exec().

Member Data Documentation

◆ INLINE_VALUE_COUNT

std::size_t LIBEVAL::CONTEXT::INLINE_VALUE_COUNT = 32
staticconstexprprivateinherited

Definition at line 452 of file libeval_compiler.h.

Referenced by AllocValue().

◆ m_constraint

int PCBEXPR_CONTEXT::m_constraint
private

Definition at line 108 of file pcbexpr_evaluator.h.

Referenced by GetConstraint(), PCBEXPR_CONTEXT(), Reset(), and SetConstraint().

◆ m_errorCallback

std::function<void( const wxString& aMessage, int aOffset )> LIBEVAL::CONTEXT::m_errorCallback
privateinherited

Definition at line 466 of file libeval_compiler.h.

Referenced by HasErrorCallback(), ReportError(), Reset(), and SetErrorCallback().

◆ m_inlineStorage

unsigned char LIBEVAL::CONTEXT::m_inlineStorage[INLINE_VALUE_COUNT *sizeof(VALUE)]
privateinherited

Definition at line 463 of file libeval_compiler.h.

Referenced by inlineValue().

◆ m_inlineUsed

std::size_t LIBEVAL::CONTEXT::m_inlineUsed
privateinherited

Definition at line 464 of file libeval_compiler.h.

Referenced by AllocValue(), CONTEXT(), and Reset().

◆ m_items

BOARD_ITEM* PCBEXPR_CONTEXT::m_items[2]
private

Definition at line 109 of file pcbexpr_evaluator.h.

Referenced by GetBoard(), GetItem(), PCBEXPR_CONTEXT(), Reset(), and SetItems().

◆ m_layer

PCB_LAYER_ID PCBEXPR_CONTEXT::m_layer
private

Definition at line 110 of file pcbexpr_evaluator.h.

Referenced by GetLayer(), PCBEXPR_CONTEXT(), Reset(), and SetLayer().

◆ m_ownedValues

std::vector<VALUE*> LIBEVAL::CONTEXT::m_ownedValues
privateinherited

Definition at line 459 of file libeval_compiler.h.

Referenced by AllocValue(), CONTEXT(), Reset(), and StoreValue().

◆ m_stack

VALUE* LIBEVAL::CONTEXT::m_stack[100]
privateinherited

Definition at line 460 of file libeval_compiler.h.

Referenced by CONTEXT(), Pop(), Push(), and Top().

◆ m_stackPtr

int LIBEVAL::CONTEXT::m_stackPtr
privateinherited

Definition at line 461 of file libeval_compiler.h.

Referenced by CONTEXT(), Pop(), Push(), Reset(), SP(), and Top().

◆ m_typeOverrides

std::map<const BOARD_ITEM*, KICAD_T> PCBEXPR_CONTEXT::m_typeOverrides
private

Definition at line 111 of file pcbexpr_evaluator.h.

Referenced by GetEffectiveType(), Reset(), and SetTypeOverride().


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