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

#include <Substitutor.h>

+ Collaboration diagram for opencog::Substitutor:

Public Member Functions

 Substitutor (AtomSpace *as)
 
Handle substitute (const Handle &expr, const std::map< Handle, Handle > &vars)
 

Private Member Functions

Handle walk_tree (const Handle &expr)
 

Private Attributes

AtomSpace_as
 
const std::map< Handle, Handle > * _vmap
 

Detailed Description

Like the Instantiator but does not execute stuff, and also works for non-VariableNode.

Also a bit like VariableList's substitute, but again also works for non-VariableNode.

Won't recurse into the atom substituted; so if the new atom also contains sub-atom to be subsituted, they will be ignored.

Definition at line 44 of file Substitutor.h.

Constructor & Destructor Documentation

opencog::Substitutor::Substitutor ( AtomSpace as)
inline

Definition at line 74 of file Substitutor.h.

Member Function Documentation

Handle opencog::Substitutor::substitute ( const Handle expr,
const std::map< Handle, Handle > &  vars 
)
inline

The main method to call to substitue sub-atoms.

Parameters
exprthe original atom
varsan atom to atom mapping
Returns
a new atom with sub-atoms replaced

Definition at line 83 of file Substitutor.h.

References _as, _vmap, opencog::AtomSpace::add_atom(), opencog::Handle::UNDEFINED, and walk_tree().

+ Here is the caller graph for this function:

Handle opencog::Substitutor::walk_tree ( const Handle expr)
inlineprivate

Definition at line 50 of file Substitutor.h.

References _vmap, createLink, opencog::Atom::getTruthValue(), opencog::Atom::getType(), and opencog::LinkCast().

+ Here is the caller graph for this function:

Member Data Documentation

AtomSpace* opencog::Substitutor::_as
private

Definition at line 47 of file Substitutor.h.

const std::map<Handle, Handle>* opencog::Substitutor::_vmap
private

Definition at line 48 of file Substitutor.h.


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