25 #ifndef _OPENCOG_ATOMSPACE_H
26 #define _OPENCOG_ATOMSPACE_H
39 #include <opencog/util/exceptions.h>
58 friend class ::AtomTableUTest;
143 return add_link(t, {ha, hb, hc, hd});
149 return add_link(t, {ha, hb, hc, hd, he});
155 return add_link(t, {ha, hb, hc, hd, he, hf});
161 return add_link(t, {ha, hb, hc, hd, he, hf, hg});
168 return add_link(t, {ha, hb, hc, hd, he, hf, hg, hh});
175 return add_link(t, {ha, hb, hc, hd, he, hf, hg, hh, hi});
221 throw RuntimeException(TRACE_INFO,
"No backing store");
322 return get_link(t, {ha, hb, hc, hd});
394 bool subclass =
false)
const
397 size_t initial_size = appendToHandles.size();
405 appendToHandles.reserve(initial_size + size_of_append);
431 template <
typename OutputIterator> OutputIterator
434 bool subclass =
false)
const
449 bool subclass =
false)
454 std::list<Handle> handle_set;
460 std::list<Handle>::iterator i = handle_set.begin();
461 std::list<Handle>::iterator iend = handle_set.end();
462 for (; i != iend; ++i) {
463 bool rc = (data->*cb)(*i);
510 template <
typename OutputIterator> OutputIterator
516 return std::copy(hs.begin(), hs.end(),
result);
525 template <
typename OutputIterator> OutputIterator
529 AttentionValue::AttentionValue::MAXSTI);
596 boost::signals2::connection
addAtomSignal(
const AtomSignal::slot_type&
function)
612 boost::signals2::connection
AddAFSignal(
const AVCHSigl::slot_type&
function)
629 template <
typename OutputIterator> OutputIterator
631 const std::string& name,
633 bool subclass =
true)
635 if (name.c_str()[0] == 0)
638 if (
false == subclass) {
640 if (h) *(result++) = h;
647 if (h) *(result++) = h; }, type);
657 template <
typename OutputIterator> OutputIterator
689 static std::string noname;
691 if (nnn)
return nnn->getName();
738 if (lll)
return lll->getOutgoingSet();
746 if (lll)
return lll->getOutgoingAtom(idx);
754 if (lll)
return lll->getArity();
763 if (l)
return l->isSource(source);
824 #endif // _OPENCOG_ATOMSPACE_H
void set_LTI(Handle h, AttentionValue::lti_t ltiValue) const
AttentionValuePtr getAttentionValue()
TVCHSigl & TVChangedSignal()
UnorderedHandleSet getHandlesByAV(AttentionValue::sti_t lowerBound, AttentionValue::sti_t upperBound=AttentionValue::MAXSTI) const
bool purge_atom(Handle h, bool recursive=false)
boost::signals2::connection addAtomSignal(const AtomSignal::slot_type &function)
boost::signals2::connection removeAtomSignal(const AtomPtrSignal::slot_type &function)
Handle get_handle(Type t, const HandleSeq &outgoing)
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd)
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he)
void update_max_STI(AttentionValue::sti_t m)
AttentionValue::sti_t get_STI(Handle h) const
Handle add_node(Type t, const std::string &name="", bool async=false)
float getNormalisedSTI(AttentionValuePtr, bool average, bool clip) const
AtomSpace(const AtomSpace &)
AttentionValue::sti_t setAttentionalFocusBoundary(AttentionValue::sti_t s)
virtual void loadType(AtomTable &, Type)=0
Handle get_outgoing(Handle h, Arity idx) const
BackingStore * backing_store
void setSTI(AttentionValue::sti_t stiValue)
boost::signals2::connection AddAFSignal(const AVCHSigl::slot_type &function)
IncomingSet getIncomingSet()
void setLTI(AttentionValue::lti_t ltiValue)
std::vector< Handle > HandleSeq
a list of handles
std::shared_ptr< Atom > AtomPtr
void set_TV(Handle h, TruthValuePtr tv) const
int get_num_links() const
AttentionValue::vlti_t get_VLTI(Handle h) const
short vlti_t
very long-term importance type
AttentionValue::sti_t set_attentional_focus_boundary(AttentionValue::sti_t s)
std::shared_ptr< TruthValue > TruthValuePtr
Handle get_handle(Type t, const Handle &ha, const Handle &hb)
OutputIterator get_handles_by_type(OutputIterator result, Type type, bool subclass=false) const
std::shared_ptr< AttentionValue > AttentionValuePtr
void fetch_all_atoms_of_type(Type t)
Arity get_arity(Handle h) const
AtomPtrSignal & removeAtomSignal()
virtual std::string toShortString(std::string indent="")=0
Handle get_link(Type t, Handle ha, Handle hb)
Handle get_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd)
strength_t get_mean(Handle h) const
void registerBackingStore(BackingStore *)
float get_normalised_STI(Handle h, bool average=true, bool clip=false) const
short lti_t
long-term importance type
void update_min_STI(AttentionValue::sti_t m)
virtual std::string toString(std::string indent="")=0
boost::signals2::connection TVChangedSignal(const TVCHSigl::slot_type &function)
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf)
Handle add_link(Type t, Handle ha, Handle hb, Handle hc)
AtomSpace & operator=(const AtomSpace &)
std::shared_ptr< Link > LinkPtr
void setTruthValue(TruthValuePtr)
Sets the TruthValue object of the atom.
AtomPtrSet extract(Handle &handle, bool recursive=true)
void get_handles_by_type(HandleSeq &appendToHandles, Type type, bool subclass=false) const
ClassServer & classserver(ClassServerFactory *=ClassServer::createInstance)
Handle add_link(Type t, Handle h)
OutputIterator get_handles_by_name(OutputIterator result, const std::string &name, Type type=NODE, bool subclass=true)
long get_LTI_funds() const
static NodePtr NodeCast(const Handle &h)
confidence_t get_confidence(Handle h) const
friend class SavingLoading
int get_num_nodes() const
void setAttentionValue(AttentionValuePtr)
Sets the AttentionValue object of the atom.
void unregisterBackingStore(BackingStore *)
AVCHSigl & AVChangedSignal()
void set_STI(Handle h, AttentionValue::sti_t stiValue) const
static const Handle UNDEFINED
AtomTable & get_atomtable(void)
Handle get_link(Type t, Handle ha)
size_t getNumNodes() const
AttentionValue::sti_t getAttentionalFocusBoundary() const
short sti_t
short-term importance type
void update_STI_funds(AttentionValue::sti_t m)
bool foreach_handle_of_type(Type atype, bool(T::*cb)(const Handle &), T *data, bool subclass=false)
long get_STI_funds() const
AFCHSigl & RemoveAFSignal()
int get_num_atoms_of_type(Type type, bool subclass=false) const
AttentionValue::sti_t getMaxSTI(bool average=true) const
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg, Handle hh, Handle hi)
Handle get_node(Type t, const std::string &name="")
float getNormalisedZeroToOneSTI(AttentionValuePtr, bool average, bool clip) const
bool is_source(Handle source, Handle link) const
bool remove_atom(Handle h, bool recursive=false)
AttentionValue::sti_t get_max_STI(bool average=true) const
AttentionValue::sti_t getMinSTI(bool average=true) const
Handle get_handle(Type t, const std::string &str)
size_t getNumAtomsOfType(Type type, bool subclass=true) const
bool is_valid_handle(Handle h) const
size_t getNumLinks() const
void updateMinSTI(AttentionValue::sti_t m)
ostream & operator<<(ostream &out, const opencog::AtomSpace &as)
static LinkPtr LinkCast(const Handle &h)
void inc_VLTI(Handle h) const
long updateLTIFunds(AttentionValue::lti_t diff)
void foreachRecursive(Function func, Type type)
AtomSignal & addAtomSignal()
TruthValuePtr get_TV(Handle h) const
AttentionValue::sti_t get_attentional_focus_boundary() const
AttentionValue::lti_t get_LTI(Handle h) const
OutputIterator get_handles_by_AV(OutputIterator result, AttentionValue::sti_t lowerBound, AttentionValue::sti_t upperBound=AttentionValue::MAXSTI) const
std::shared_ptr< Node > NodePtr
bool is_node(Handle h) const
bool is_link(Handle h) const
HandleSeq get_incoming(Handle h) const
OutputIterator get_incoming_set_by_type(OutputIterator result, Handle handle, Type type, bool subclass) const
Handle get_link(Type t, const HandleSeq &outgoing)
TruthValuePtr getTruthValue()
const std::string & get_name(Handle h) const
AttentionValuePtr get_AV(Handle h) const
void updateMaxSTI(AttentionValue::sti_t m)
float get_normalised_zero_to_one_STI(Handle h, bool average=true, bool clip=false) const
std::string atom_as_string(Handle h, bool terse=true) const
unsigned short Type
type of Atoms, represented as short integer (16 bits)
std::unordered_set< Handle, handle_hash > UnorderedHandleSet
a hash that associates the handle to its unique identificator
void store_atom(Handle h)
void update_LTI_funds(AttentionValue::lti_t m)
OutputIterator get_handle_set_in_attentional_focus(OutputIterator result) const
void set_AV(Handle h, AttentionValuePtr av) const
Handle add_link(Type t, const HandleSeq &outgoing, bool async=false)
Handle add_link(Type t, Handle ha, Handle hb)
OutputIterator getIncomingSetByType(OutputIterator result, Type type, bool subclass=false)
long updateSTIFunds(AttentionValue::sti_t diff)
Handle fetch_atom(Handle h)
void dec_VLTI(Handle h) const
Handle get_link(Type t, Handle ha, Handle hb, Handle hc)
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg, Handle hh)
unsigned short Arity
arity of Links, represented as short integer (16 bits)
AttentionValue::sti_t get_min_STI(bool average=true) const
OutputIterator getHandlesByType(OutputIterator result, Type type, bool subclass=false, bool parent=true) const
boost::signals2::connection AVChangedSignal(const AVCHSigl::slot_type &function)
void clear()
Clear the atomspace, remove all atoms.
Type get_type(Handle h) const
Handle fetch_incoming_set(Handle, bool)
const HandleSeq & get_outgoing(Handle h) const
static const sti_t MAXSTI
Handle add_atom(AtomPtr atom, bool async=false)
Handle get_handle(Type t, const Handle &ha)
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg)
boost::signals2::connection RemoveAFSignal(const AVCHSigl::slot_type &function)