27 #ifndef _OPENCOG_ATOM_H
28 #define _OPENCOG_ATOM_H
35 #include <boost/signals2.hpp>
37 #include <opencog/util/exceptions.h>
54 typedef std::shared_ptr<Link>
LinkPtr;
73 :
public std::enable_shared_from_this<Atom>
75 friend class ::AtomUTest;
140 #ifdef INCOMING_SET_SIGNALS
203 if (not subclass)
return t == at;
212 return Handle(shared_from_this());
289 return Handle(shared_from_this());
308 template <
typename OutputIterator> OutputIterator
312 std::lock_guard<std::mutex> lck(
_mtx);
319 if (h) { *result = h; result ++; }
336 if ((data->*cb)(
Handle(lp)))
return true;
352 template <
typename OutputIterator> OutputIterator
354 Type type,
bool subclass =
false)
357 std::lock_guard<std::mutex> lck(
_mtx);
364 if (h and h->isType(type, subclass)) {
382 virtual std::string
toString(std::string indent =
"") = 0;
383 virtual std::string
toShortString(std::string indent =
"") = 0;
403 #endif // _OPENCOG_ATOM_H
AttentionValuePtr getAttentionValue()
OutputIterator getIncomingSet(OutputIterator result)
virtual bool operator==(const Atom &) const =0
Atom(Type t, TruthValuePtr tv=TruthValue::DEFAULT_TV(), AttentionValuePtr av=AttentionValue::DEFAULT_AV())
void setSTI(AttentionValue::sti_t stiValue)
IncomingSet getIncomingSet()
void setLTI(AttentionValue::lti_t ltiValue)
AtomTable * getAtomTable() const
Returns the AtomTable in which this Atom is inserted.
short vlti_t
very long-term importance type
bool foreach_incoming(bool(T::*cb)(const Handle &), T *data)
std::shared_ptr< TruthValue > TruthValuePtr
std::shared_ptr< AttentionValue > AttentionValuePtr
void markForRemoval()
Marks the atom for removal.
virtual std::string toShortString(std::string indent="")=0
void unsetRemovalFlag()
Unsets removal flag.
short lti_t
long-term importance type
virtual std::string toString(std::string indent="")=0
boost::signals2::signal< void(AtomPtr, LinkPtr)> AtomPairSignal
AttentionValue::lti_t getLTI()
std::shared_ptr< Link > LinkPtr
void setTruthValue(TruthValuePtr)
Sets the TruthValue object of the atom.
ClassServer & classserver(ClassServerFactory *=ClassServer::createInstance)
AttentionValue::vlti_t getVLTI()
virtual bool operator!=(const Atom &) const =0
bool isType(Type t, bool subclass) const
bool isMarkedForRemoval() const
void setAttentionValue(AttentionValuePtr)
Sets the AttentionValue object of the atom.
void remove_atom(LinkPtr)
Remove an atom from the incoming set.
std::weak_ptr< Link > WinkPtr
short sti_t
short-term importance type
unsigned long UUID
UUID == Universally Unique Identifier.
friend class SavingLoading
void merge(TruthValuePtr)
static TruthValuePtr DEFAULT_TV()
bool isA(Type sub, Type super)
std::shared_ptr< InSet > InSetPtr
std::vector< LinkPtr > IncomingSet
TruthValuePtr _truthValue
static AttentionValuePtr DEFAULT_AV()
to be used as default attention value
std::set< WinkPtr, std::owner_less< WinkPtr > > WincomingSet
TruthValuePtr getTruthValue()
void insert_atom(LinkPtr)
Add an atom to the incoming set.
AttentionValue::sti_t getSTI()
Handy-dandy convenience getters for attention values.
void setAtomTable(AtomTable *)
Sets the AtomTable in which this Atom is inserted.
unsigned short Type
type of Atoms, represented as short integer (16 bits)
size_t getIncomingSetSize()
Get the size of the incoming set.
OutputIterator getIncomingSetByType(OutputIterator result, Type type, bool subclass=false)
Handle tvmerge(TruthValuePtr tv)
AttentionValuePtr _attentionValue