OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
opencog::Target Class Reference

#include <Target.h>

+ Collaboration diagram for opencog::Target:

Public Member Functions

 ~Target ()
 
bool operator== (const Target &t) const
 
bool operator< (const Target &t) const
 
void store_step (const Rule &r, const HandleSeq &premises)
 
void store_varmap (VarMultimap &vm)
 
void store_varmap (VarMap &vm)
 
unsigned int rule_count (const Rule &r)
 
void increment_selection_count ()
 
Handle get_handle () const
 
HandleSeq get_varseq () const
 
std::set< Handleget_varset () const
 
Handle get_vardecl () const
 
const VarMultimapget_varmap () const
 
unsigned int get_selection_count () const
 
float get_weight ()
 

Private Member Functions

 Target (AtomSpace &as, const Handle &h, const Handle &hvardecl)
 

Private Attributes

Handle _htarget_external
 
Handle _htarget_internal
 
unsigned int _selection_count
 
Handle _vardecl
 
VarMultimap _varmap
 
AtomSpace_as
 

Friends

class TargetSet
 

Detailed Description

Definition at line 35 of file Target.h.

Constructor & Destructor Documentation

opencog::Target::~Target ( )
inline

Definition at line 41 of file Target.h.

Target::Target ( AtomSpace as,
const Handle h,
const Handle hvardecl 
)
private

Constructor of Target.

Only the TargetSet class can create a Target object.

Parameters
asthe AtomSpace in which to store temporary information
hthe original external Handle of the Target

Definition at line 40 of file Target.cc.

References _as, _htarget_external, _htarget_internal, _selection_count, _vardecl, _varmap, opencog::AtomSpace::add_atom(), and opencog::VariableListCast().

Member Function Documentation

Handle opencog::Target::get_handle ( ) const
inline

Get the external Handle referred to be Target.

Returns
the handle

Definition at line 70 of file Target.h.

References _htarget_external.

+ Here is the caller graph for this function:

unsigned int opencog::Target::get_selection_count ( ) const
inline

Definition at line 101 of file Target.h.

References _selection_count.

+ Here is the caller graph for this function:

Handle opencog::Target::get_vardecl ( ) const
inline

Definition at line 92 of file Target.h.

References _vardecl.

+ Here is the caller graph for this function:

const VarMultimap& opencog::Target::get_varmap ( ) const
inline

Get the stored free variable mappings.

Returns
a VarMultimap object of the mappings

Definition at line 99 of file Target.h.

References _varmap.

+ Here is the caller graph for this function:

HandleSeq opencog::Target::get_varseq ( ) const
inline

Get the "free" variables list in HandleSeq.

Returns
the HandleSeq

Definition at line 77 of file Target.h.

References _vardecl, and opencog::VariableListCast().

+ Here is the caller graph for this function:

std::set<Handle> opencog::Target::get_varset ( ) const
inline

Get the "free" variables list in set<Handle>

Returns
the std::set<Handle>

Definition at line 87 of file Target.h.

References _vardecl, and opencog::VariableListCast().

+ Here is the caller graph for this function:

float opencog::Target::get_weight ( )
inline

Get the weight associated with this Target.

Useful for perhaps target selection. XXX TODO actually calculate something here

Returns
the weight in float

Definition at line 111 of file Target.h.

void opencog::Target::increment_selection_count ( )
inline

Increment the internal counter.

Useful for storing how many times a Target is selected.

Definition at line 63 of file Target.h.

References _selection_count.

+ Here is the caller graph for this function:

bool opencog::Target::operator< ( const Target t) const
inline

Definition at line 48 of file Target.h.

References _htarget_internal.

bool opencog::Target::operator== ( const Target t) const
inline

Definition at line 44 of file Target.h.

References _htarget_internal.

unsigned int Target::rule_count ( const Rule r)

Count how many times a Rule was selected for the Target.

This method follow the inference tree atom structure to find all usage.

Parameters
rthe Rule to search
Returns
the number of times applied

Definition at line 107 of file Target.cc.

References _as, _htarget_internal, opencog::AtomSpace::add_node(), opencog::Rule::get_name(), and opencog::get_neighbors().

+ Here is the caller graph for this function:

void Target::store_step ( const Rule r,
const HandleSeq premises 
)

Store a specific inference step for the Target into the AtomSpace.

Parameters
rthe rule applied
premisesthe premises selected to be the rule's input

Definition at line 61 of file Target.cc.

References _as, _htarget_internal, opencog::AtomSpace::add_link(), opencog::AtomSpace::add_node(), and opencog::Rule::get_name().

+ Here is the caller graph for this function:

void Target::store_varmap ( VarMultimap vm)

Store new variable mappings.

Parameters
vma VarMultimap object containing additional mappings

Definition at line 76 of file Target.cc.

References _varmap.

+ Here is the caller graph for this function:

void Target::store_varmap ( VarMap vm)

Store new variable mapping.

Parameters
vma VarMap object containing additional mapping

Definition at line 90 of file Target.cc.

References _varmap.

Friends And Related Function Documentation

friend class TargetSet
friend

Definition at line 37 of file Target.h.

Member Data Documentation

AtomSpace& opencog::Target::_as
private

Definition at line 123 of file Target.h.

Handle opencog::Target::_htarget_external
private

Definition at line 116 of file Target.h.

Handle opencog::Target::_htarget_internal
private

Definition at line 117 of file Target.h.

unsigned int opencog::Target::_selection_count
private

Definition at line 118 of file Target.h.

Handle opencog::Target::_vardecl
private

Definition at line 120 of file Target.h.

VarMultimap opencog::Target::_varmap
private

Definition at line 121 of file Target.h.


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