OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <DefineLink.h>
Public Member Functions | |
DefineLink (const HandleSeq &, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
DefineLink (const Handle &varcdecls, const Handle &body, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
DefineLink (Link &l) | |
Handle | get_alias (void) |
Handle | get_definition (void) |
![]() | |
Link (Type t, const HandleSeq &oset, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
Link (Type t, const Handle &h, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
Link (Type t, const Handle &ha, const Handle &hb, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
Link (Type t, const Handle &ha, const Handle &hb, const Handle &hc, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
Link (Type t, const Handle &ha, const Handle &hb, const Handle &hc, const Handle &hd, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV()) | |
Link (Link &l) | |
~Link () | |
Arity | getArity () const |
const HandleSeq & | getOutgoingSet () const |
Handle | getOutgoingAtom (Arity pos) const throw (RuntimeException) |
template<class T > | |
bool | foreach_outgoing (bool(T::*cb)(const Handle &), T *data) |
std::string | toString (std::string indent="") |
std::string | toShortString (std::string indent="") |
bool | isSource (Handle) const throw (InvalidParamException) |
bool | isSource (size_t) const throw (IndexErrorException, InvalidParamException) |
bool | isTarget (Handle) const throw (InvalidParamException) |
bool | isTarget (size_t) const throw (IndexErrorException, InvalidParamException) |
virtual bool | operator== (const Atom &) const |
virtual bool | operator!= (const Atom &) const |
![]() | |
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 | get_definition (const Handle &alias) |
Protected Member Functions | |
void | init (const HandleSeq &) |
![]() | |
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... | |
Protected Attributes | |
Handle | _alias |
Handle | _definition |
![]() | |
HandleSeq | _outgoing |
![]() | |
UUID | _uuid |
AtomTable * | _atomTable |
Type | _type |
char | _flags |
TruthValuePtr | _truthValue |
AttentionValuePtr | _attentionValue |
std::mutex | _mtx |
InSetPtr | _incoming_set |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< InSet > | InSetPtr |
The DefineLink is used to give a name to a hypergraph (schema, pattern, concept, predicate, etc). The DefineLink is unique, in that, if any other atoms exists with this same name, it will throw an error! Thus, only ONE DefineLink with a given name can exist at a time.
This class is intended to be used for anything that needs to be accessed by name: for, if there were two things with the same name, it would be ambiguous as to which to access. (It would not make sense to access both: would the result of access have 'and' semantics? 'or' semantics ??) Thus, this exists to define an atom uniquely.
The only place where I know of, at the moment, for this beast, is for the construction of recursive patterns, as that is the only place where a simple cut-n-paste is insufficient to specify what comes next.
It is intended that the DefineLink be used with the ComposeLink, which provides the values for the variables bound by the DefineLink. That is, the ComposeLink acts like function composition. It does not actually call, invoke or ground the resulting composition.
Currently, the implementation of ComposeLink is half-finished and mostly broken.
Definition at line 66 of file DefineLink.h.
DefineLink::DefineLink | ( | const HandleSeq & | oset, |
TruthValuePtr | tv = TruthValue::DEFAULT_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 55 of file DefineLink.cc.
References init().
DefineLink::DefineLink | ( | const Handle & | varcdecls, |
const Handle & | body, | ||
TruthValuePtr | tv = TruthValue::DEFAULT_TV() , |
||
AttentionValuePtr | av = AttentionValue::DEFAULT_AV() |
||
) |
Definition at line 62 of file DefineLink.cc.
DefineLink::DefineLink | ( | Link & | l | ) |
Definition at line 69 of file DefineLink.cc.
References opencog::classserver(), opencog::Link::getOutgoingSet(), opencog::Atom::getType(), opencog::ClassServer::getTypeName(), and init().
|
inline |
Definition at line 85 of file DefineLink.h.
References _alias.
|
inline |
Definition at line 86 of file DefineLink.h.
References _definition.
Given a Handle pointing to <name> in
DefineLink <name> <body>
return <body>
Definition at line 84 of file DefineLink.cc.
References opencog::DefineLinkCast(), opencog::Atom::getIncomingSetByType(), opencog::Atom::toString(), and opencog::Handle::UNDEFINED.
|
protected |
Definition at line 32 of file DefineLink.cc.
References _alias, _definition, opencog::Atom::getIncomingSetByType(), and opencog::Atom::toString().
|
protected |
Definition at line 70 of file DefineLink.h.
|
protected |
Definition at line 72 of file DefineLink.h.