AERA
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
r_exec::BindingMap Class Reference
Inheritance diagram for r_exec::BindingMap:
core::_Object r_exec::HLPBindingMap

Public Member Functions

 BindingMap (const BindingMap *source)
 
 BindingMap (const BindingMap &source)
 
BindingMapoperator= (const BindingMap &source)
 
void load (const BindingMap *source)
 
virtual void clear ()
 
void init (const r_code::Code *object, uint16 index)
 
_Factabstract_fact (_Fact *fact, const _Fact *original, bool force_sync, int timing_vars_first_search_index=0)
 
r_code::Codeabstract_object (r_code::Code *object, bool force_sync, int timing_vars_first_search_index=0)
 
void reset_fwd_timings (_Fact *reference_fact)
 
bool match_fwd_timings (Timestamp after, Timestamp before)
 
MatchResult match_fwd_lenient (const _Fact *f_object, const _Fact *f_pattern)
 
bool match_fwd_strict (const _Fact *f_object, const _Fact *f_pattern)
 
bool is_timestamp (uint16 i) const
 
bool has_fwd_after () const
 
bool has_fwd_before () const
 
Timestamp get_fwd_after () const
 
Timestamp get_fwd_before () const
 
bool match_object (const r_code::Code *object, const r_code::Code *pattern)
 
bool match_structure (const r_code::Code *object, uint16 o_base_index, uint16 o_index, const r_code::Code *pattern, uint16 p_index)
 
bool match_atom (Atom o_atom, Atom p_atom)
 
void bind_variable (BoundValue *value, uint8 id)
 
void bind_variable (Atom *code, uint8 id, uint16 value_index, Atom *intermediate_results)
 
Atomget_value_code (uint16 id) const
 
uint16 get_value_code_size (uint16 id) const
 
uint16 get_first_index () const
 
bool intersect (const BindingMap *bm) const
 
bool is_fully_specified () const
 
Atomget_code (uint16 i) const
 
r_code::Codeget_object (uint16 i) const
 
int16 get_fwd_after_index () const
 
int16 get_fwd_before_index () const
 
bool scan_variable (uint16 id) const
 
bool match_timings (Timestamp after, Timestamp before, uint32 after_index, uint32 before_index)
 
std::string trace_string (uint16 i) const
 
- Public Member Functions inherited from core::_Object
void incRef ()
 
virtual void decRef ()
 

Static Public Member Functions

static _Factabstract_f_ihlp (const _Fact *fact)
 
static uint16 get_abstracted_ihlp_exposed_args_index (const r_code::Code *ihlp)
 

Protected Member Functions

void add_unbound_value (uint8 id)
 
bool match_fwd_timings (const _Fact *f_object)
 
bool match (const r_code::Code *object, uint16 o_base_index, uint16 o_index, const r_code::Code *pattern, uint16 p_index, uint16 o_arity)
 
void abstract_member (const r_code::Code *object, uint16 index, r_code::Code *abstracted_object, uint16 write_index, uint16 &extent_index, int first_search_index=0)
 
Atom get_atom_variable (Atom a)
 
Atom get_structure_variable (const r_code::Code *object, uint16 index, int first_search_index=0)
 
Atom get_object_variable (r_code::Code *object)
 

Protected Attributes

std::vector< P< Value > > map_
 
uint32 unbound_values_
 
uint16 first_index_
 
int16 fwd_after_index_
 
int16 fwd_before_index_
 
- Protected Attributes inherited from core::_Object
std::atomic_int32_t refCount_
 

Friends

class UnboundValue
 

Detailed Description

Definition at line 247 of file binding_map.h.

Member Function Documentation

◆ abstract_fact()

_Fact * r_exec::BindingMap::abstract_fact ( _Fact fact,
const _Fact original,
bool  force_sync,
int  timing_vars_first_search_index = 0 
)

Fill in the fresh fact object as an abstract copy of the original fact, creating new bindings as needed.

Parameters
factA fresh Fact or AntiFact object.
originalThe original object to copy.
timing_vars_first_search_index(optional) Use this for first_search_index when calling abstract_member() for the fact's timing values. If omitted, use 0.

Definition at line 414 of file binding_map.cpp.

◆ get_abstracted_ihlp_exposed_args_index()

uint16 r_exec::BindingMap::get_abstracted_ihlp_exposed_args_index ( const r_code::Code ihlp)
static

Get the code index where the exposed args will start after calling abstract_object on the ihlp. This is Necessary because the ihlp may have structured values before the exposed args which will be removed by abstract_object (which only has variables and no structured values).

Parameters
ihlpThe imdl or icst.
Returns
The exposed args index.

Definition at line 483 of file binding_map.cpp.

◆ get_structure_variable()

Atom r_exec::BindingMap::get_structure_variable ( const r_code::Code object,
uint16  index,
int  first_search_index = 0 
)
protected

Get a VLPointer for the structre at object->code(index), adding a new binding if needed.

Parameters
objectThe code with the structure.
indexThe index in the object code of the structure.
first_search_index(optional) If >= 0, use this as the start index in the binding map to check if it already contains the structure and return a VLPointer to the binding index if found. (This starts at the index and wraps around to search the entire binding map.) If -1, then always add the structure as a new binding. If omitted, then use 0 to search the whole map from the beginning.
Returns
A VLPointer to the index in the bindings of the structure (possible of a new binding).

Definition at line 570 of file binding_map.cpp.

◆ intersect()

bool r_exec::BindingMap::intersect ( const BindingMap bm) const

Check if any value in bm matches any value in this BindingMap

Parameters
bmThe other BindingMap with values to check.
Returns
True if any two values match.

Definition at line 905 of file binding_map.cpp.

◆ is_timestamp()

bool r_exec::BindingMap::is_timestamp ( uint16  i) const
inline

Check if the map entry at i is bound to a timestamp.

Returns
True if it is a timestamp.

Definition at line 327 of file binding_map.h.

◆ match_fwd_timings()

bool r_exec::BindingMap::match_fwd_timings ( Timestamp  after,
Timestamp  before 
)
inline

Match the given time interval to the time interval at this binding map's fwd_after_index_ and fwd_before_index_, updating this binding map's values to "narrow" them to the given time interval if needed. This assumes you have already called has_fwd_after() and has_fwd_before() to make sure that there are valid Timestamp bindings at fwd_after_index_ and fwd_before_index_.

Parameters
afterThe beginning of the time interval to compare with this binding map's fwd time interval.
beforeThe end of the time interval to compare with this binding map's fwd time interval.
Returns
True if the time intervals match, in which case this binding maps' values may have been updated to "narrow" the time interval.

Definition at line 316 of file binding_map.h.

◆ match_timings()

bool r_exec::BindingMap::match_timings ( Timestamp  after,
Timestamp  before,
uint32  after_index,
uint32  before_index 
)

Match the given time interval to the time interval at this binding map's after_index and before_index, updating the binding map's values to "narrow" them to the given time interval if needed. This assumes you have already checked to make sure that there are valid Timestamp bindings at after_index and before_index.

Parameters
afterThe beginning of the time interval to compare with this binding map's time interval.
beforeThe end of the time interval to compare with this binding map's time interval.
after_indexThe index in the binding map of the time interval after Timestamp.
before_indexThe index in the binding map of the time interval before Timestamp.
Returns
True if the time intervals match, in which case this binding map's values may have been updated to "narrow" the time interval.

Definition at line 771 of file binding_map.cpp.

◆ trace_string()

std::string r_exec::BindingMap::trace_string ( uint16  i) const
inline

Return the trace of the value at index i as a string by creating a temporary Code object and calling valuate(). For debugging purposes only (can be inefficient).

Definition at line 389 of file binding_map.h.


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