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

#include <Node.h>

+ Inheritance diagram for opencog::Node:
+ Collaboration diagram for opencog::Node:

Public Member Functions

 Node (Type t, const std::string &s, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
 
 Node (Node &n)
 
const std::string & getName () const
 
std::string toString (std::string indent="")
 
std::string toShortString (std::string indent="")
 
virtual bool operator== (const Atom &) const
 
virtual bool operator!= (const Atom &) 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)
 

Protected Member Functions

void init (const std::string &)
 
 Node (const Node &l)
 
- 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

std::string _name
 
- 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

This is a subclass of Atom. It represents the most basic kind of pattern known to the OpenCog system.

Definition at line 42 of file Node.h.

Constructor & Destructor Documentation

opencog::Node::Node ( const Node l)
inlineprotected

Definition at line 49 of file Node.h.

opencog::Node::Node ( Type  t,
const std::string &  s,
TruthValuePtr  tv = TruthValue::DEFAULT_TV(),
AttentionValuePtr  av = AttentionValue::DEFAULT_AV() 
)
inline

Constructor for this class.

Parameters
Nodetype
Nodename A reference to a std::string with the name of the node. Use empty string for unamed node.
Nodetruthvalue A reference to a TruthValue object.

Definition at line 61 of file Node.h.

References init().

opencog::Node::Node ( Node n)
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 74 of file Node.h.

References _name, and init().

Member Function Documentation

const std::string& opencog::Node::getName ( ) const
inline

Gets the name of the node.

Returns
The name of the node.

Definition at line 87 of file Node.h.

References _name.

+ Here is the caller graph for this function:

void Node::init ( const std::string &  cname)
protected

Definition at line 34 of file Node.cc.

References _name, opencog::Atom::_type, and opencog::classserver().

+ Here is the caller graph for this function:

bool Node::operator!= ( const Atom other) const
virtual

Returns whether a given atom is different from the current node.

Parameters
Atomto be tested.
Returns
true if they are different, false otherwise.

Implements opencog::Atom.

Definition at line 83 of file Node.cc.

bool Node::operator== ( const Atom other) const
virtual

Returns whether a given atom is equal to the current node.

Parameters
Atomto be tested.
Returns
true if they are equal, false otherwise.

Implements opencog::Atom.

Definition at line 77 of file Node.cc.

References getName(), and opencog::Atom::getType().

std::string Node::toShortString ( std::string  indent = "")
virtual
std::string Node::toString ( std::string  indent = "")
virtual

Returns a string representation of the node.

Returns
A string representation of the node.

Implements opencog::Atom.

Definition at line 59 of file Node.cc.

References _name, opencog::Atom::_type, opencog::Atom::_uuid, BUFSZ, opencog::classserver(), opencog::Atom::getAttentionValue(), and opencog::Atom::getTruthValue().

Member Data Documentation

std::string opencog::Node::_name
protected

Definition at line 46 of file Node.h.


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