AERA
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
r_exec::CSTOverlay Class Reference
Inheritance diagram for r_exec::CSTOverlay:
r_exec::HLPOverlay r_exec::Overlay core::_Object

Public Member Functions

 CSTOverlay (Controller *c, HLPBindingMap *bindings)
 
bool reduce (View *input, CSTOverlay *&offspring)
 
void load_patterns ()
 
bool can_match (Timestamp now) const
 
bool is_simulated ()
 
_Factbind_pattern (_Fact *input, HLPBindingMap *map, Sim *predictionSimulation, bool &is_axiom)
 
- Public Member Functions inherited from r_exec::HLPOverlay
 HLPOverlay (Controller *c, const HLPBindingMap *bindings, bool load_code)
 
HLPBindingMapget_bindings () const
 
Atomget_value_code (uint16 id) const
 
uint16 get_value_code_size (uint16 id) const
 
r_code::Codeget_unpacked_object () const
 
bool evaluate_bwd_guards ()
 
- Public Member Functions inherited from r_exec::Overlay
 Overlay (size_t values_size)
 
virtual void reset ()
 
virtual Overlayreduce (r_exec::View *input)
 
void invalidate ()
 
virtual bool is_invalidated ()
 
r_code::Codeget_object () const
 
r_exec::Viewget_view () const
 
r_code::Codebuild_object (r_code::Atom head) const
 
const r_code::Atomvalues () const
 
- Public Member Functions inherited from core::_Object
void incRef ()
 
virtual void decRef ()
 

Protected Member Functions

_Factinject_production (View *input)
 
void update (HLPBindingMap *map, _Fact *input, bool is_axiom)
 
CSTOverlayget_offspring (HLPBindingMap *map, _Fact *input, bool is_axiom, _Fact *bound_pattern=NULL)
 
Simget_simulation (Controller *root) const
 
 CSTOverlay (const CSTOverlay *original)
 
- Protected Member Functions inherited from r_exec::HLPOverlay
bool evaluate_guards (uint16 guard_set_iptr_index)
 
bool evaluate_fwd_guards ()
 
bool evaluate (uint16 index)
 
bool evaluate_fwd_timings ()
 
bool scan_bwd_guards () const
 
bool scan_location (uint16 index, uint16 parent_guard_index) const
 
bool scan_variable (uint16 index, uint16 parent_guard_index) const
 
void store_evidence (_Fact *evidence, bool prediction, bool is_simulation)
 
 HLPOverlay (Controller *c, HLPBindingMap *bindings)
 
- Protected Member Functions inherited from r_exec::Overlay
void load_code ()
 
void patch_code (uint16 index, r_code::Atom value)
 
uint16 get_last_patch_index ()
 
void unpatch_code (uint16 patch_index)
 
void rollback ()
 
void commit ()
 
r_code::Codeget_core_object () const
 
 Overlay (Controller *c, bool load_code=true)
 

Protected Attributes

Timestamp match_deadline_
 
float32 lowest_cfd_
 
std::set< P< DefeasibleValidity > > defeasible_validities_
 
std::unordered_set< P< _Fact >, r_code::PHash< _Fact > > predictions_
 
std::unordered_set< P< Sim >, r_code::PHash< Sim > > simulations_
 
std::vector< Sim * > promoted_in_sim_
 
r_code::list< P< _Fact > > axiom_patterns_
 
r_code::list< P< _Fact > > non_axiom_patterns_
 
std::vector< P< _Fact > > axiom_inputs_
 
std::vector< P< _Fact > > non_axiom_inputs_
 
- Protected Attributes inherited from r_exec::HLPOverlay
P< HLPBindingMapbindings_
 
- Protected Attributes inherited from r_exec::Overlay
volatile uint32 invalidated_
 
Controllercontroller_
 
r_code::resized_vector< r_code::Atomvalues_
 
r_code::Atomcode_
 
uint16 code_size_
 
std::vector< uint16 > patch_indices_
 
uint16 value_commit_index_
 
- Protected Attributes inherited from core::_Object
std::atomic_int32_t refCount_
 

Additional Inherited Members

- Static Public Member Functions inherited from r_exec::HLPOverlay
static bool EvaluateBWDGuards (Controller *c, HLPBindingMap *bindings)
 
static bool EvaluateFWDTimings (Controller *c, HLPBindingMap *bindings)
 
static bool ScanBWDGuards (Controller *c, HLPBindingMap *bindings)
 

Detailed Description

Definition at line 106 of file cst_controller.h.

Member Function Documentation

◆ bind_pattern()

_Fact * r_exec::CSTOverlay::bind_pattern ( _Fact input,
HLPBindingMap map,
Sim predictionSimulation,
bool &  is_axiom 
)

Find the first Fact in axiom_patterns or non_axiom_patterns_ which matches the input, and update the binding map.

Parameters
inputThe input _Fact to match against a pattern.
mapThe binding map for calling match_fwd_strict and has the bindings if this returns a pattern.
predictionSimulationIf not NULL, then ensure that its simulation root matches the root of the simulation in this object's simulations_. Also if this overlay does not yet have non-axiom saved inputs, then use the timings from input to update the timing variables of this CSTOverlay.
is_axiomTrue if the matching pattern came from axiom_patterns_ .
Returns
The matching pattern from axiom_patterns_ or non_axiom_patterns_, or NULL if not found.

Definition at line 448 of file cst_controller.cpp.

◆ get_offspring()

CSTOverlay * r_exec::CSTOverlay::get_offspring ( HLPBindingMap map,
_Fact input,
bool  is_axiom,
_Fact bound_pattern = NULL 
)
protected

Make a copy of this CSTOverlay, then call update() to update the inputs_ and bindings_.

Parameters
mapThe HLPBindingMap to copy to bindings_. This also updates match_deadline_ from map->get_fwd_before() if needed.
inputThe Fact to add to inputs.
is_axiomTrue if input (and bound_pattern) is matched from axiom_patterns_.
bound_pattern(optional) The pattern to remove from axiom_patterns_ or non_axiom_patterns_ (according to is_axiom). If omitted or NULL, then don't use it.
Returns
The copy of this CSTOverlay before making changes.

Definition at line 200 of file cst_controller.cpp.

◆ get_simulation()

Sim * r_exec::CSTOverlay::get_simulation ( Controller root) const
protected

Similar to Pred::get_simulation, find the first Sim in simulations_ whose root_ is root.

Parameters
rootThe root to match with the Sim root_.
Returns
The first matching Sim, or NULL if no match.

Definition at line 502 of file cst_controller.cpp.

◆ inject_production()

_Fact * r_exec::CSTOverlay::inject_production ( View input)
protected

Use bindings_ to make the f_icst, putting it in a (fact (pred ...)) if needed.

Parameters
inputThe input which triggered the production.
Returns
The injected object, or NULL if not injected.

Definition at line 137 of file cst_controller.cpp.


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