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

#include <DefineLink.h>

+ Inheritance diagram for opencog::DefineLink:
+ Collaboration diagram for opencog::DefineLink:

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)
 
- 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 get_definition (const Handle &alias)
 

Protected Member Functions

void init (const HandleSeq &)
 
- 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...
 

Protected Attributes

Handle _alias
 
Handle _definition
 
- Protected Attributes inherited from opencog::Atom
UUID _uuid
 
AtomTable_atomTable
 
Type _type
 
char _flags
 
TruthValuePtr _truthValue
 
AttentionValuePtr _attentionValue
 
std::mutex _mtx
 
InSetPtr _incoming_set
 

Additional Inherited Members

- Protected Types inherited from opencog::Atom
typedef std::shared_ptr< InSetInSetPtr
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Member Function Documentation

Handle opencog::DefineLink::get_alias ( void  )
inline

Definition at line 85 of file DefineLink.h.

References _alias.

Handle opencog::DefineLink::get_definition ( void  )
inline

Definition at line 86 of file DefineLink.h.

References _definition.

+ Here is the caller graph for this function:

Handle DefineLink::get_definition ( const Handle alias)
static

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.

void DefineLink::init ( const HandleSeq oset)
protected

Definition at line 32 of file DefineLink.cc.

References _alias, _definition, opencog::Atom::getIncomingSetByType(), and opencog::Atom::toString().

+ Here is the caller graph for this function:

Member Data Documentation

Handle opencog::DefineLink::_alias
protected

Definition at line 70 of file DefineLink.h.

Handle opencog::DefineLink::_definition
protected

Definition at line 72 of file DefineLink.h.


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