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 (PCB_LAYER_ID aLayer=UNDEFINED_LAYER)
 
void SetItems (BOARD_ITEM *a, BOARD_ITEM *b=nullptr)
 
BOARDGetBoard () 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

BOARD_ITEMm_items [2]
 
PCB_LAYER_ID m_layer
 

Detailed Description

Definition at line 52 of file pcb_expr_evaluator.h.

Constructor & Destructor Documentation

◆ PCB_EXPR_CONTEXT()

PCB_EXPR_CONTEXT::PCB_EXPR_CONTEXT ( PCB_LAYER_ID  aLayer = UNDEFINED_LAYER)
inline

Definition at line 55 of file pcb_expr_evaluator.h.

55  :
56  m_layer( aLayer )
57  {
58  m_items[0] = nullptr;
59  m_items[1] = nullptr;
60  }
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 1126 of file pcb_expr_evaluator.cpp.

1127 {
1128  if( m_items[0] )
1129  return m_items[0]->GetBoard();
1130 
1131  return nullptr;
1132 }
BOARD_ITEM * m_items[2]
virtual const BOARD * GetBoard() const
Return the BOARD in which this BOARD_ITEM resides, or NULL if none.
Definition: board_item.cpp:36

References BOARD_ITEM::GetBoard(), and m_items.

◆ GetItem()

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

Definition at line 70 of file pcb_expr_evaluator.h.

71  {
72  return m_items[index];
73  }
BOARD_ITEM * m_items[2]

References m_items.

Referenced by PCB_EXPR_VAR_REF::GetObject(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), and isCoupledDiffPair().

◆ GetLayer()

PCB_LAYER_ID PCB_EXPR_CONTEXT::GetLayer ( ) const
inline

Definition at line 75 of file pcb_expr_evaluator.h.

76  {
77  return m_layer;
78  }
PCB_LAYER_ID m_layer

References m_layer.

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

◆ HasErrorCallback()

bool LIBEVAL::CONTEXT::HasErrorCallback ( )
inlineinherited

Definition at line 330 of file libeval_compiler.h.

330 { 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(), inDiffPair(), insideArea(), insideBackCourtyard(), insideCourtyard(), insideFrontCourtyard(), and memberOf().

◆ Pop()

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

◆ Push()

◆ ReportError()

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

Definition at line 659 of file libeval_compiler.cpp.

660 {
661  if( m_errorCallback )
662  m_errorCallback( aErrorMsg, -1 );
663 }
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback

References LIBEVAL::CONTEXT::m_errorCallback.

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

◆ SetErrorCallback()

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

Definition at line 325 of file libeval_compiler.h.

326  {
327  m_errorCallback = std::move( aCallback );
328  }
std::function< void(const wxString &aMessage, int aOffset)> m_errorCallback

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 62 of file pcb_expr_evaluator.h.

63  {
64  m_items[0] = a;
65  m_items[1] = b;
66  }
BOARD_ITEM * m_items[2]

References m_items.

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

◆ SP()

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

Definition at line 320 of file libeval_compiler.h.

321  {
322  return m_stackPtr;
323  };

References LIBEVAL::CONTEXT::m_stackPtr.

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

Member Data Documentation

◆ m_items

BOARD_ITEM* PCB_EXPR_CONTEXT::m_items[2]
private

Definition at line 81 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 82 of file pcb_expr_evaluator.h.

Referenced by GetLayer().


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