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

#include <FunctionLink.h>

+ Inheritance diagram for opencog::FunctionLink:
+ Collaboration diagram for opencog::FunctionLink:

Public Member Functions

 FunctionLink (Type, const HandleSeq &oset, TruthValuePtr tv=TruthValue::NULL_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
 
 FunctionLink (Link &l)
 
virtual ~FunctionLink ()
 
virtual Handle execute (AtomSpace *=NULL) const
 
- Public Member Functions inherited from opencog::Atom
virtual ~Atom ()
 
Type getType () const
 
bool isType (Type t, bool subclass) const
 
Handle getHandle ()
 
AttentionValuePtr getAttentionValue ()
 
void setAttentionValue (AttentionValuePtr)
 Sets the AttentionValue object of the atom. More...
 
AttentionValue::sti_t getSTI ()
 Handy-dandy convenience getters for attention values. More...
 
AttentionValue::lti_t getLTI ()
 
AttentionValue::vlti_t getVLTI ()
 
void setSTI (AttentionValue::sti_t stiValue)
 
void setLTI (AttentionValue::lti_t ltiValue)
 
void incVLTI ()
 
void decVLTI ()
 
TruthValuePtr getTruthValue ()
 
void setTruthValue (TruthValuePtr)
 Sets the TruthValue object of the atom. More...
 
void merge (TruthValuePtr)
 
Handle tvmerge (TruthValuePtr tv)
 
size_t getIncomingSetSize ()
 Get the size of the incoming set. More...
 
IncomingSet getIncomingSet ()
 
template<typename OutputIterator >
OutputIterator getIncomingSet (OutputIterator result)
 
template<class T >
bool foreach_incoming (bool(T::*cb)(const Handle &), T *data)
 
template<typename OutputIterator >
OutputIterator getIncomingSetByType (OutputIterator result, Type type, bool subclass=false)
 
IncomingSet getIncomingSetByType (Type type, bool subclass=false)
 

Static Public Member Functions

static Handle do_execute (AtomSpace *, const Handle &)
 
static LinkPtr factory (LinkPtr)
 
static Handle factory (Type, const HandleSeq &)
 

Protected Member Functions

 FunctionLink (Type, const Handle &a, TruthValuePtr tv=TruthValue::NULL_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
 
 FunctionLink (Type, const Handle &a, const Handle &b, TruthValuePtr tv=TruthValue::NULL_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
 
- Protected Member Functions inherited from opencog::Atom
 Atom (Type t, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
 
void keep_incoming_set ()
 
void drop_incoming_set ()
 
void insert_atom (LinkPtr)
 Add an atom to the incoming set. More...
 
void remove_atom (LinkPtr)
 Remove an atom from the incoming set. More...
 

Additional Inherited Members

- Protected Types inherited from opencog::Atom
typedef std::shared_ptr< InSetInSetPtr
 
- Protected Attributes inherited from opencog::Atom
UUID _uuid
 
AtomTable_atomTable
 
Type _type
 
char _flags
 
TruthValuePtr _truthValue
 
AttentionValuePtr _attentionValue
 
std::mutex _mtx
 
InSetPtr _incoming_set
 

Detailed Description

The FunctionLink provides a base class with an important method: execute().

The execute() method executes the given expression, and returns a Handle resulting from the execution.

The difference between execution and reduction is this: an expression that contains free variables will contain the same free variables (or a subset of them) after reduction. By contrast, it is (usually) not valid to execute an expression that contains free variables; usually, an error will be thrown. Thus, reduction is for open sentences, execution is for closed sentences.

Note also: EvaluationLinks can be reduced, but they can never be executed (they can only be evaluated).

Definition at line 52 of file FunctionLink.h.

Constructor & Destructor Documentation

FunctionLink::FunctionLink ( Type  t,
const Handle a,
TruthValuePtr  tv = TruthValue::NULL_TV(),
AttentionValuePtr  av = AttentionValue::DEFAULT_AV() 
)
protected

Definition at line 44 of file FunctionLink.cc.

References opencog::classserver(), and opencog::FreeLink::init().

FunctionLink::FunctionLink ( Type  t,
const Handle a,
const Handle b,
TruthValuePtr  tv = TruthValue::NULL_TV(),
AttentionValuePtr  av = AttentionValue::DEFAULT_AV() 
)
protected

Definition at line 54 of file FunctionLink.cc.

References opencog::classserver(), and opencog::FreeLink::init().

FunctionLink::FunctionLink ( Type  t,
const HandleSeq oset,
TruthValuePtr  tv = TruthValue::NULL_TV(),
AttentionValuePtr  av = AttentionValue::DEFAULT_AV() 
)

Definition at line 34 of file FunctionLink.cc.

References opencog::classserver(), and opencog::FreeLink::init().

FunctionLink::FunctionLink ( Link l)
virtual opencog::FunctionLink::~FunctionLink ( )
inlinevirtual

Definition at line 69 of file FunctionLink.h.

Member Function Documentation

Handle FunctionLink::do_execute ( AtomSpace as,
const Handle h 
)
static

Definition at line 79 of file FunctionLink.cc.

References factory(), opencog::FunctionLinkCast(), and opencog::LinkCast().

+ Here is the caller graph for this function:

Handle FunctionLink::execute ( AtomSpace as = NULL) const
virtual
LinkPtr FunctionLink::factory ( LinkPtr  lp)
static

Definition at line 90 of file FunctionLink.cc.

References opencog::FunctionLinkCast(), and opencog::LinkCast().

+ Here is the caller graph for this function:

Handle FunctionLink::factory ( Type  t,
const HandleSeq seq 
)
static

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