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 ()
 
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 1174 of file pcb_expr_evaluator.cpp.

1175{
1176 if( m_items[0] )
1177 return m_items[0]->GetBoard();
1178
1179 return nullptr;
1180}
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:37

References BOARD_ITEM::GetBoard(), and m_items.

◆ 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 isCoupledDiffPair().

◆ GetItem()

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

◆ GetLayer()

PCB_LAYER_ID PCB_EXPR_CONTEXT::GetLayer ( ) const
inline

Definition at line 73 of file pcb_expr_evaluator.h.

73{ return m_layer; }

References m_layer.

Referenced by calcIsInsideArea(), calcIsInsideCourtyard(), PCB_EXPR_VAR_REF::GetValue(), and isInsideArea().

◆ HasErrorCallback()

bool LIBEVAL::CONTEXT::HasErrorCallback ( )
inlineinherited

Definition at line 353 of file libeval_compiler.h.

353{ return m_errorCallback != nullptr; }
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback

References LIBEVAL::CONTEXT::m_errorCallback.

Referenced by calcIsInsideArea(), LIBEVAL::UOP::Exec(), existsOnLayer(), getField(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), and memberOf().

◆ Pop()

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

◆ Push()

◆ ReportError()

void LIBEVAL::CONTEXT::ReportError ( const wxString &  aErrorMsg)
inherited

◆ SetErrorCallback()

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

Definition at line 348 of file libeval_compiler.h.

349 {
350 m_errorCallback = std::move( aCallback );
351 }

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 343 of file libeval_compiler.h.

344 {
345 return m_stackPtr;
346 };

References LIBEVAL::CONTEXT::m_stackPtr.

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

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 359 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: