KiCad PCB EDA Suite
PCB_EXPR_CONTEXT Class Reference

#include <pcb_expr_evaluator.h>

Inheritance diagram for PCB_EXPR_CONTEXT:
LIBEVAL::CONTEXT

Public Member Functions

 PCB_EXPR_CONTEXT (int aConstraint, PCB_LAYER_ID aLayer)
 
void SetItems (BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
 
BOARDGetBoard () const
 
int GetConstraint () const
 
BOARD_ITEMGetItem (int index) const
 
PCB_LAYER_ID GetLayer () const
 
VALUE * AllocValue ()
 
VALUE * StoreValue (VALUE *aValue)
 
void Push (VALUE *v)
 
VALUE * Pop ()
 
int SP () const
 
void SetErrorCallback (std::function< void(const wxString &aMessage, int aOffset)> aCallback)
 
bool HasErrorCallback ()
 
void ReportError (const wxString &aErrorMsg)
 

Private Attributes

int m_constraint
 
BOARD_ITEMm_items [2]
 
PCB_LAYER_ID m_layer
 
std::vector< VALUE * > m_ownedValues
 
VALUE * m_stack [100]
 
int m_stackPtr
 
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback
 

Detailed Description

Definition at line 52 of file pcb_expr_evaluator.h.

Constructor & Destructor Documentation

◆ PCB_EXPR_CONTEXT()

PCB_EXPR_CONTEXT::PCB_EXPR_CONTEXT ( int  aConstraint,
PCB_LAYER_ID  aLayer 
)
inline

Definition at line 55 of file pcb_expr_evaluator.h.

55 :
56 m_constraint( aConstraint ),
57 m_layer( aLayer )
58 {
59 m_items[0] = nullptr;
60 m_items[1] = nullptr;
61 }
BOARD_ITEM * m_items[2]
PCB_LAYER_ID m_layer

References m_items.

Member Function Documentation

◆ AllocValue()

◆ GetBoard()

BOARD * PCB_EXPR_CONTEXT::GetBoard ( ) const

Definition at line 279 of file pcb_expr_evaluator.cpp.

280{
281 if( m_items[0] )
282 return m_items[0]->GetBoard();
283
284 return nullptr;
285}
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:43

References BOARD_ITEM::GetBoard(), and m_items.

Referenced by PCB_EXPR_VAR_REF::GetValue().

◆ GetConstraint()

int PCB_EXPR_CONTEXT::GetConstraint ( ) const
inline

Definition at line 71 of file pcb_expr_evaluator.h.

71{ return m_constraint; }

References m_constraint.

Referenced by isCoupledDiffPairFunc().

◆ GetItem()

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

Definition at line 72 of file pcb_expr_evaluator.h.

72{ return m_items[index]; }

References m_items.

Referenced by PCB_EXPR_VAR_REF::GetObject(), isCoupledDiffPairFunc(), searchAreas(), and searchFootprints().

◆ GetLayer()

PCB_LAYER_ID PCB_EXPR_CONTEXT::GetLayer ( ) const
inline

◆ HasErrorCallback()

bool LIBEVAL::CONTEXT::HasErrorCallback ( )
inlineinherited

◆ Pop()

◆ Push()

◆ ReportError()

◆ SetErrorCallback()

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

Definition at line 354 of file libeval_compiler.h.

355 {
356 m_errorCallback = std::move( aCallback );
357 }

References LIBEVAL::CONTEXT::m_errorCallback.

Referenced by DRC_RULE_CONDITION::EvaluateFor(), and LIBEVAL::COMPILER::generateUCode().

◆ SetItems()

void PCB_EXPR_CONTEXT::SetItems ( BOARD_ITEM a,
BOARD_ITEM b = nullptr 
)
inline

Definition at line 63 of file pcb_expr_evaluator.h.

64 {
65 m_items[0] = a;
66 m_items[1] = b;
67 }

References m_items.

Referenced by DRC_RULE_CONDITION::EvaluateFor(), and testEvalExpr().

◆ SP()

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

Definition at line 349 of file libeval_compiler.h.

350 {
351 return m_stackPtr;
352 };

References LIBEVAL::CONTEXT::m_stackPtr.

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

◆ StoreValue()

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

Definition at line 327 of file libeval_compiler.h.

328 {
329 m_ownedValues.emplace_back( aValue );
330 return m_ownedValues.back();
331 }

References LIBEVAL::CONTEXT::m_ownedValues.

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

Member Data Documentation

◆ m_constraint

int PCB_EXPR_CONTEXT::m_constraint
private

Definition at line 76 of file pcb_expr_evaluator.h.

Referenced by GetConstraint().

◆ m_errorCallback

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

◆ m_items

BOARD_ITEM* PCB_EXPR_CONTEXT::m_items[2]
private

Definition at line 77 of file pcb_expr_evaluator.h.

Referenced by GetBoard(), GetItem(), PCB_EXPR_CONTEXT(), and SetItems().

◆ m_layer

PCB_LAYER_ID PCB_EXPR_CONTEXT::m_layer
private

Definition at line 78 of file pcb_expr_evaluator.h.

Referenced by GetLayer().

◆ m_ownedValues

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

◆ m_stack

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

Definition at line 365 of file libeval_compiler.h.

Referenced by LIBEVAL::CONTEXT::Pop(), and LIBEVAL::CONTEXT::Push().

◆ m_stackPtr

int LIBEVAL::CONTEXT::m_stackPtr
privateinherited

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