OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <Link.h>
Public Member Functions | |
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) |
Protected Attributes | |
HandleSeq | _outgoing |
![]() | |
UUID | _uuid |
AtomTable * | _atomTable |
Type | _type |
char | _flags |
TruthValuePtr | _truthValue |
AttentionValuePtr | _attentionValue |
std::mutex | _mtx |
InSetPtr | _incoming_set |
Private Member Functions | |
void | init (const HandleSeq &) throw (InvalidParamException) |
void | resort (void) |
Link (const Link &l) | |
Friends | |
class | AtomTable |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< InSet > | InSetPtr |
![]() | |
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... | |
Nodes in OpenCog are connected to each other by links. Each link embodies one of the basic inter-node relationships. Links do not necessarily describe a binary relationship between two entities. Links may describe relationships between more than two entities at once. Finally, links describe relationships not only between nodes, but also higher-order relationships between links, and between nodes and links.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Copy constructor, does NOT copy atom table membership! Cannot be const, because the get() functions can't be, because thread-safe locking required in the gets.
Definition at line 135 of file Link.h.
References getOutgoingSet(), and init().
Link::~Link | ( | ) |
Destructor for this class.
Definition at line 68 of file Link.cc.
References DPRINTF, and toString().
|
inline |
Invoke the callback on each atom in the outgoing set of handle h, until till one of them returns true, in which case, the loop stops and returns true. Otherwise the callback is called on all outgoings and false is returned.
Definition at line 183 of file Link.h.
References getOutgoingSet().
|
inline |
Returns a specific Handle in the outgoing set.
The | position of the handle in the array. |
Definition at line 168 of file Link.h.
References _outgoing, and getArity().
|
inline |
|
private |
Definition at line 51 of file Link.cc.
References opencog::classserver().
bool Link::isSource | ( | Handle | handle | ) | const |
throw | ( | InvalidParamException | |||
) |
Returns whether a given handle is a source (the first outgoing if the link is ordered) of this link.
Handle | to be checked for being a link source. |
Definition at line 122 of file Link.cc.
References opencog::classserver().
bool Link::isSource | ( | size_t | i | ) | const |
throw | ( | IndexErrorException, | |||
InvalidParamException | |||||
) |
Returns whether the element in a given position in the outgoing set of this link is a source (the first outgoing if the link is ordered).
Position | in the outgoing set. |
Definition at line 145 of file Link.cc.
References opencog::classserver().
bool Link::isTarget | ( | Handle | handle | ) | const |
throw | ( | InvalidParamException | |||
) |
Returns whether a given handle is a target (any but the first if the link is ordered) of this link.
Handle | to be checked for being a link target. |
Definition at line 165 of file Link.cc.
References opencog::classserver().
bool Link::isTarget | ( | size_t | i | ) | const |
throw | ( | IndexErrorException, | |||
InvalidParamException | |||||
) |
Returns whether the element in a given position in the outgoing set of this link is a target (any but the first if the link is ordered).
Position | in the outgoing set. |
Definition at line 193 of file Link.cc.
References opencog::classserver().
|
virtual |
Returns whether a given atom is different from the current link.
Atom | to be tested. |
Implements opencog::Atom.
|
virtual |
Returns whether a given atom is equal to the current link.
Atom | to be tested. |
Implements opencog::Atom.
Definition at line 214 of file Link.cc.
References _outgoing, getArity(), and opencog::Atom::getType().
|
virtual |
Returns a short string representation of the link. Note that the TV is only represented by its mean and count so if it is a compositeTV only the primaryTV is printed.
Implements opencog::Atom.
Definition at line 73 of file Link.cc.
References _outgoing, opencog::Atom::_type, opencog::Atom::_uuid, opencog::classserver(), opencog::Atom::getTruthValue(), and opencog::ClassServer::getTypeName().
|
virtual |
Returns a string representation of the link.
Implements opencog::Atom.
Definition at line 94 of file Link.cc.
References _outgoing, opencog::Atom::_type, opencog::Atom::_uuid, BUFSZ, opencog::classserver(), opencog::Atom::getAttentionValue(), opencog::Atom::getLTI(), opencog::Atom::getSTI(), opencog::Atom::getTruthValue(), and opencog::Atom::getVLTI().
|
protected |