OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AtomSpace.h
Go to the documentation of this file.
1 /*
2  * opencog/atomspace/AtomSpace.h
3  *
4  * Copyright (C) 2008-2011 OpenCog Foundation
5  * Copyright (C) 2002-2007 Novamente LLC
6  * Copyright (C) 2015 Linas Vepstas
7  * All Rights Reserved
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Affero General Public License v3 as
11  * published by the Free Software Foundation and including the exceptions
12  * at http://opencog.org/wiki/Licenses
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU Affero General Public License
20  * along with this program; if not, write to:
21  * Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  */
24 
25 #ifndef _OPENCOG_ATOMSPACE_H
26 #define _OPENCOG_ATOMSPACE_H
27 
28 #include <algorithm>
29 #include <list>
30 #include <set>
31 #include <vector>
32 
39 #include <opencog/util/exceptions.h>
40 
41 namespace opencog
42 {
54 class AtomSpace
55 {
56  friend class SavingLoading;
57  friend class SQLPersistSCM;
58  friend class ::AtomTableUTest;
59 
64  AtomSpace& operator=(const AtomSpace&);
65  AtomSpace(const AtomSpace&);
66 
73 
74  AtomTable& get_atomtable(void) { return atomTable; }
75 protected:
76 
82 
83 public:
84  AtomSpace(AtomSpace* parent = NULL);
85  ~AtomSpace();
86 
90  inline int get_size() const { return atomTable.getSize(); }
91  inline int get_num_nodes() const { return atomTable.getNumNodes(); }
92  inline int get_num_links() const { return atomTable.getNumLinks(); }
93  inline int get_num_atoms_of_type(Type type, bool subclass = false) const
94  { return atomTable.getNumAtomsOfType(type, subclass); }
95 
97  void clear();
98 
104  Handle add_atom(AtomPtr atom, bool async=false);
105 
113  Handle add_node(Type t, const std::string& name = "",
114  bool async = false);
115 
124  Handle add_link(Type t, const HandleSeq& outgoing, bool async = false);
125 
127  {
128  return add_link(t, HandleSeq({h}));
129  }
130 
131  inline Handle add_link(Type t, Handle ha, Handle hb)
132  {
133  return add_link(t, {ha, hb});
134  }
135 
136  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc)
137  {
138  return add_link(t, {ha, hb, hc});
139  }
140 
141  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd)
142  {
143  return add_link(t, {ha, hb, hc, hd});
144  }
145 
146  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc,
147  Handle hd, Handle he)
148  {
149  return add_link(t, {ha, hb, hc, hd, he});
150  }
151 
152  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc,
153  Handle hd, Handle he, Handle hf)
154  {
155  return add_link(t, {ha, hb, hc, hd, he, hf});
156  }
157 
158  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc,
159  Handle hd, Handle he, Handle hf, Handle hg)
160  {
161  return add_link(t, {ha, hb, hc, hd, he, hf, hg});
162  }
163 
164  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc,
165  Handle hd, Handle he, Handle hf, Handle hg,
166  Handle hh)
167  {
168  return add_link(t, {ha, hb, hc, hd, he, hf, hg, hh});
169  }
170 
171  inline Handle add_link(Type t, Handle ha, Handle hb, Handle hc,
172  Handle hd, Handle he, Handle hf, Handle hg,
173  Handle hh, Handle hi)
174  {
175  return add_link(t, {ha, hb, hc, hd, he, hf, hg, hh, hi});
176  }
177 
186  void barrier(void) {
187  atomTable.barrier();
189  }
190 
207 
214 
220  if (NULL == backing_store)
221  throw RuntimeException(TRACE_INFO, "No backing store");
223  }
224 
225 
235 
241  void store_atom(Handle h);
242 
261  bool purge_atom(Handle h, bool recursive = false) {
262  return 0 < atomTable.extract(h, recursive).size();
263  }
264 
281  bool remove_atom(Handle h, bool recursive = false);
282 
293  Handle get_node(Type t, const std::string& name = "");
294  inline Handle get_handle(Type t, const std::string& str) {
295  return get_node(t, str);
296  }
297 
311  Handle get_link(Type t, const HandleSeq& outgoing);
313  return get_link(t, HandleSeq({ha}));
314  }
316  return get_link(t, {ha, hb});
317  }
319  return get_link(t, {ha, hb, hc});
320  }
322  return get_link(t, {ha, hb, hc, hd});
323  }
324  Handle get_handle(Type t, const HandleSeq& outgoing) {
325  return get_link(t, outgoing);
326  }
327  Handle get_handle(Type t, const Handle& ha) {
328  return get_handle(t, HandleSeq({ha}));
329  }
330  Handle get_handle(Type t, const Handle& ha, const Handle& hb) {
331  return get_handle(t, HandleSeq({ha, hb}));
332  }
333 
355  bool is_valid_handle(Handle h) const {
356  // The h->get_handle() maneuver below is a trick to get at the
357  // UUID of the actual atom, rather than the cached UUID in the
358  // handle. Technically, this is not quite right, since, in
359  // principle, a handle could have a valid UUID, but the atom
360  // pointer is null, because the atom is on disk, in a database,
361  // is on a remote server, or has been purged from RAM. But we
362  // have no way of knowing that the situation really is, so it
363  // seems like the only thing that can be done here is to resolve
364  // the pointer (i.e. make it point to an acutal atom, in RAM,
365  // and then check the actual UUID in the atom.
366  //
367  // The actual resolution is done with the (NULL != h) check,
368  // which causes h.operator!=() to run, which fixes up the atom
369  // pointer, as needed.
370  //
371  return (NULL != h) and (h->getHandle() != Handle::UNDEFINED);
372  }
373 
392  void get_handles_by_type(HandleSeq& appendToHandles,
393  Type type,
394  bool subclass = false) const
395  {
396  // Get the initial size of the handles vector.
397  size_t initial_size = appendToHandles.size();
398 
399  // Determine the number of atoms we'll be adding.
400  size_t size_of_append = atomTable.getNumAtomsOfType(type, subclass);
401 
402  // Now reserve size for the addition. This is faster for large
403  // append iterations since appends to the list won't require new
404  // allocations and copies whenever the allocated size is exceeded.
405  appendToHandles.reserve(initial_size + size_of_append);
406 
407  // Now defer to the output iterator call, eating the return.
408  get_handles_by_type(back_inserter(appendToHandles), type, subclass);
409  }
410 
431  template <typename OutputIterator> OutputIterator
432  get_handles_by_type(OutputIterator result,
433  Type type,
434  bool subclass = false) const
435  {
436  return atomTable.getHandlesByType(result, type, subclass);
437  }
438 
439  /* ----------------------------------------------------------- */
440  /* The foreach routines offer an alternative interface
441  * to the getHandleSet API.
442  */
446  template<class T>
447  inline bool foreach_handle_of_type(Type atype,
448  bool (T::*cb)(const Handle&), T *data,
449  bool subclass = false)
450  {
451  // First we extract, then we loop. This is to avoid holding
452  // the lock for too long. (because we don't know how long
453  // the callback will take.)
454  std::list<Handle> handle_set;
455  // The intended signatue is
456  // getHandleSet(OutputIterator result, Type type, bool subclass)
457  get_handles_by_type(back_inserter(handle_set), atype, subclass);
458 
459  // Loop over all handles in the 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);
464  if (rc) return rc;
465  }
466  return false;
467  }
468 
469  /* ----------------------------------------------------------- */
470  /* Attentional Focus stuff */
471 
483  float get_normalised_STI(Handle h, bool average=true, bool clip=false) const {
484  return bank.getNormalisedSTI(h->getAttentionValue(), average, clip);
485  }
486 
497  float get_normalised_zero_to_one_STI(Handle h, bool average=true, bool clip=false) const {
498  return bank.getNormalisedZeroToOneSTI(h->getAttentionValue(), average, clip);
499  }
500 
510  template <typename OutputIterator> OutputIterator
511  get_handles_by_AV(OutputIterator result,
512  AttentionValue::sti_t lowerBound,
514  {
515  UnorderedHandleSet hs = atomTable.getHandlesByAV(lowerBound, upperBound);
516  return std::copy(hs.begin(), hs.end(), result);
517  }
518 
525  template <typename OutputIterator> OutputIterator
527  {
529  AttentionValue::AttentionValue::MAXSTI);
530  }
531 
540  }
541 
551  }
552 
558  AttentionValue::sti_t get_max_STI(bool average=true) const
559  { return bank.getMaxSTI(average); }
560 
567  AttentionValue::sti_t get_min_STI(bool average=true) const
568  { return bank.getMinSTI(average); }
569 
578 
590  long get_STI_funds() const { return bank.getSTIFunds(); }
591  long get_LTI_funds() const { return bank.getLTIFunds(); }
592 
593  /* ----------------------------------------------------------- */
594  // ---- Signals
595 
596  boost::signals2::connection addAtomSignal(const AtomSignal::slot_type& function)
597  {
598  return atomTable.addAtomSignal().connect(function);
599  }
600  boost::signals2::connection removeAtomSignal(const AtomPtrSignal::slot_type& function)
601  {
602  return atomTable.removeAtomSignal().connect(function);
603  }
604  boost::signals2::connection AVChangedSignal(const AVCHSigl::slot_type& function)
605  {
606  return atomTable.AVChangedSignal().connect(function);
607  }
608  boost::signals2::connection TVChangedSignal(const TVCHSigl::slot_type& function)
609  {
610  return atomTable.TVChangedSignal().connect(function);
611  }
612  boost::signals2::connection AddAFSignal(const AVCHSigl::slot_type& function)
613  {
614  return bank.AddAFSignal().connect(function);
615  }
616  boost::signals2::connection RemoveAFSignal(const AVCHSigl::slot_type& function)
617  {
618  return bank.RemoveAFSignal().connect(function);
619  }
620 
621  /* ----------------------------------------------------------- */
622  /* Deprecated and obsolete code */
623 
629  template <typename OutputIterator> OutputIterator
630  get_handles_by_name(OutputIterator result,
631  const std::string& name,
632  Type type = NODE,
633  bool subclass = true)
634  {
635  if (name.c_str()[0] == 0)
636  return get_handles_by_type(result, type, subclass);
637 
638  if (false == subclass) {
639  Handle h(get_handle(type, name));
640  if (h) *(result++) = h;
641  return result;
642  }
643 
645  [&](Type t)->void {
646  Handle h(get_handle(t, name));
647  if (h) *(result++) = h; }, type);
648 
649  return result;
650  }
651 
657  template <typename OutputIterator> OutputIterator
659  Handle handle,
660  Type type,
661  bool subclass) const
662  {
663  return handle->getIncomingSetByType(result, type, subclass);
664  }
665 
669  HandleSeq hs;
670  h->getIncomingSet(back_inserter(hs));
671  return hs;
672  }
673 
676  bool is_node(Handle h) const { return NodeCast(h) != NULL; }
677  bool is_link(Handle h) const { return LinkCast(h) != NULL; }
678 
681  std::string atom_as_string(Handle h, bool terse = true) const {
682  if (terse) return h->toShortString();
683  return h->toString();
684  }
685 
688  const std::string& get_name(Handle h) const {
689  static std::string noname;
690  NodePtr nnn(NodeCast(h));
691  if (nnn) return nnn->getName();
692  return noname;
693  }
694 
697  void set_STI(Handle h, AttentionValue::sti_t stiValue) const {
698  h->setSTI(stiValue);
699  }
700 
703  void set_LTI(Handle h, AttentionValue::lti_t ltiValue) const {
704  h->setLTI(ltiValue);
705  }
706 
709  void inc_VLTI(Handle h) const { h->incVLTI(); }
710 
713  void dec_VLTI(Handle h) const { h->decVLTI(); }
714 
718  return h->getAttentionValue()->getSTI();
719  }
720 
724  return h->getAttentionValue()->getLTI();
725  }
726 
730  return h->getAttentionValue()->getVLTI();
731  }
732 
735  const HandleSeq& get_outgoing(Handle h) const {
736  static HandleSeq empty;
737  LinkPtr lll(LinkCast(h));
738  if (lll) return lll->getOutgoingSet();
739  return empty;
740  }
741 
744  Handle get_outgoing(Handle h, Arity idx) const {
745  LinkPtr lll = LinkCast(h);
746  if (lll) return lll->getOutgoingAtom(idx);
747  return Handle::UNDEFINED;
748  }
749 
752  Arity get_arity(Handle h) const {
753  LinkPtr lll(LinkCast(h));
754  if (lll) return lll->getArity();
755  return 0;
756  }
757 
760  bool is_source(Handle source, Handle link) const
761  {
762  LinkPtr l(LinkCast(link));
763  if (l) return l->isSource(source);
764  return false;
765  }
766 
770  return h->getAttentionValue();
771  }
772 
776  h->setAttentionValue(av);
777  }
778 
781  Type get_type(Handle h) const {
782  return h->getType();
783  }
784 
788  {
789  return h->getTruthValue();
790  }
791 
795  return h->getTruthValue()->getMean();
796  }
797 
801  return h->getTruthValue()->getConfidence();
802  }
803 
806  void set_TV(Handle h, TruthValuePtr tv) const {
807  h->setTruthValue(tv);
808  }
809 };
810 
812 } // namespace opencog
813 
814 namespace std {
815 
820 ostream& operator<<(ostream&, const opencog::AtomSpace&);
821 
822 } //namespace std
823 
824 #endif // _OPENCOG_ATOMSPACE_H
void set_LTI(Handle h, AttentionValue::lti_t ltiValue) const
Definition: AtomSpace.h:703
AttentionValuePtr getAttentionValue()
Definition: Atom.cc:146
TVCHSigl & TVChangedSignal()
Definition: AtomTable.h:350
UnorderedHandleSet getHandlesByAV(AttentionValue::sti_t lowerBound, AttentionValue::sti_t upperBound=AttentionValue::MAXSTI) const
Definition: AtomTable.h:241
bool purge_atom(Handle h, bool recursive=false)
Definition: AtomSpace.h:261
boost::signals2::connection addAtomSignal(const AtomSignal::slot_type &function)
Definition: AtomSpace.h:596
boost::signals2::connection removeAtomSignal(const AtomPtrSignal::slot_type &function)
Definition: AtomSpace.h:600
Handle get_handle(Type t, const HandleSeq &outgoing)
Definition: AtomSpace.h:324
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd)
Definition: AtomSpace.h:141
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he)
Definition: AtomSpace.h:146
void update_max_STI(AttentionValue::sti_t m)
Definition: AtomSpace.h:587
AttentionValue::sti_t get_STI(Handle h) const
Definition: AtomSpace.h:717
Handle add_node(Type t, const std::string &name="", bool async=false)
Definition: AtomSpace.cc:135
float getNormalisedSTI(AttentionValuePtr, bool average, bool clip) const
AtomSpace(const AtomSpace &)
Definition: AtomSpace.cc:70
AttentionValue::sti_t setAttentionalFocusBoundary(AttentionValue::sti_t s)
virtual void loadType(AtomTable &, Type)=0
Handle get_outgoing(Handle h, Arity idx) const
Definition: AtomSpace.h:744
BackingStore * backing_store
Definition: AtomSpace.h:72
void setSTI(AttentionValue::sti_t stiValue)
Definition: Atom.h:242
void decVLTI()
Definition: Atom.h:268
boost::signals2::connection AddAFSignal(const AVCHSigl::slot_type &function)
Definition: AtomSpace.h:612
IncomingSet getIncomingSet()
Definition: Atom.cc:321
void setLTI(AttentionValue::lti_t ltiValue)
Definition: Atom.h:254
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
std::shared_ptr< Atom > AtomPtr
Definition: Handle.h:48
void set_TV(Handle h, TruthValuePtr tv) const
Definition: AtomSpace.h:806
int get_num_links() const
Definition: AtomSpace.h:92
AttentionValue::vlti_t get_VLTI(Handle h) const
Definition: AtomSpace.h:729
short vlti_t
very long-term importance type
AttentionValue::sti_t set_attentional_focus_boundary(AttentionValue::sti_t s)
Definition: AtomSpace.h:548
std::shared_ptr< TruthValue > TruthValuePtr
Definition: TruthValue.h:85
Handle get_handle(Type t, const Handle &ha, const Handle &hb)
Definition: AtomSpace.h:330
OutputIterator get_handles_by_type(OutputIterator result, Type type, bool subclass=false) const
Definition: AtomSpace.h:432
std::shared_ptr< AttentionValue > AttentionValuePtr
void fetch_all_atoms_of_type(Type t)
Definition: AtomSpace.h:219
Arity get_arity(Handle h) const
Definition: AtomSpace.h:752
AtomPtrSignal & removeAtomSignal()
Definition: AtomTable.h:344
long getSTIFunds() const
virtual std::string toShortString(std::string indent="")=0
Handle getHandle()
Definition: Atom.h:211
Handle get_link(Type t, Handle ha, Handle hb)
Definition: AtomSpace.h:315
Handle get_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd)
Definition: AtomSpace.h:321
void barrier(void)
Definition: AtomTable.cc:615
strength_t get_mean(Handle h) const
Definition: AtomSpace.h:794
void registerBackingStore(BackingStore *)
Definition: AtomSpace.cc:88
float get_normalised_STI(Handle h, bool average=true, bool clip=false) const
Definition: AtomSpace.h:483
short lti_t
long-term importance type
void update_min_STI(AttentionValue::sti_t m)
Definition: AtomSpace.h:577
virtual std::string toString(std::string indent="")=0
Type getType() const
Definition: Atom.h:197
boost::signals2::connection TVChangedSignal(const TVCHSigl::slot_type &function)
Definition: AtomSpace.h:608
AtomTable atomTable
Definition: AtomSpace.h:67
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf)
Definition: AtomSpace.h:152
Handle add_link(Type t, Handle ha, Handle hb, Handle hc)
Definition: AtomSpace.h:136
AtomSpace & operator=(const AtomSpace &)
Definition: AtomSpace.cc:79
std::shared_ptr< Link > LinkPtr
Definition: Atom.h:53
float strength_t
void setTruthValue(TruthValuePtr)
Sets the TruthValue object of the atom.
Definition: Atom.cc:81
AtomPtrSet extract(Handle &handle, bool recursive=true)
Definition: AtomTable.cc:667
void get_handles_by_type(HandleSeq &appendToHandles, Type type, bool subclass=false) const
Definition: AtomSpace.h:392
ClassServer & classserver(ClassServerFactory *=ClassServer::createInstance)
Definition: ClassServer.cc:159
Handle add_link(Type t, Handle h)
Definition: AtomSpace.h:126
OutputIterator get_handles_by_name(OutputIterator result, const std::string &name, Type type=NODE, bool subclass=true)
Definition: AtomSpace.h:630
long get_LTI_funds() const
Definition: AtomSpace.h:591
static NodePtr NodeCast(const Handle &h)
Definition: Node.h:113
confidence_t get_confidence(Handle h) const
Definition: AtomSpace.h:800
friend class SavingLoading
Definition: AtomSpace.h:56
int get_num_nodes() const
Definition: AtomSpace.h:91
void setAttentionValue(AttentionValuePtr)
Sets the AttentionValue object of the atom.
Definition: Atom.cc:163
void unregisterBackingStore(BackingStore *)
Definition: AtomSpace.cc:93
AVCHSigl & AVChangedSignal()
Definition: AtomTable.h:347
void set_STI(Handle h, AttentionValue::sti_t stiValue) const
Definition: AtomSpace.h:697
float confidence_t
static const Handle UNDEFINED
Definition: Handle.h:77
AtomTable & get_atomtable(void)
Definition: AtomSpace.h:74
Handle get_link(Type t, Handle ha)
Definition: AtomSpace.h:312
size_t getNumNodes() const
Definition: AtomTable.cc:625
AttentionValue::sti_t getAttentionalFocusBoundary() const
short sti_t
short-term importance type
void update_STI_funds(AttentionValue::sti_t m)
Definition: AtomSpace.h:588
AttentionBank bank
Definition: AtomSpace.h:68
bool foreach_handle_of_type(Type atype, bool(T::*cb)(const Handle &), T *data, bool subclass=false)
Definition: AtomSpace.h:447
long get_STI_funds() const
Definition: AtomSpace.h:590
AFCHSigl & RemoveAFSignal()
Definition: AttentionBank.h:91
int get_num_atoms_of_type(Type type, bool subclass=false) const
Definition: AtomSpace.h:93
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)
Definition: AtomSpace.h:171
Handle get_node(Type t, const std::string &name="")
Definition: AtomSpace.cc:155
float getNormalisedZeroToOneSTI(AttentionValuePtr, bool average, bool clip) const
bool is_source(Handle source, Handle link) const
Definition: AtomSpace.h:760
Handle get_atom(Handle)
Definition: AtomSpace.cc:312
long getLTIFunds() const
bool remove_atom(Handle h, bool recursive=false)
Definition: AtomSpace.cc:344
AttentionValue::sti_t get_max_STI(bool average=true) const
Definition: AtomSpace.h:558
AttentionValue::sti_t getMinSTI(bool average=true) const
Handle get_handle(Type t, const std::string &str)
Definition: AtomSpace.h:294
size_t getNumAtomsOfType(Type type, bool subclass=true) const
Definition: AtomTable.cc:637
bool is_valid_handle(Handle h) const
Definition: AtomSpace.h:355
size_t getNumLinks() const
Definition: AtomTable.cc:631
void updateMinSTI(AttentionValue::sti_t m)
ostream & operator<<(ostream &out, const opencog::AtomSpace &as)
Definition: AtomSpace.cc:382
static LinkPtr LinkCast(const Handle &h)
Definition: Link.h:263
void inc_VLTI(Handle h) const
Definition: AtomSpace.h:709
AFCHSigl & AddAFSignal()
Definition: AttentionBank.h:90
long updateLTIFunds(AttentionValue::lti_t diff)
void foreachRecursive(Function func, Type type)
Definition: ClassServer.h:122
void incVLTI()
Definition: Atom.h:265
AtomSignal & addAtomSignal()
Definition: AtomTable.h:343
TruthValuePtr get_TV(Handle h) const
Definition: AtomSpace.h:787
AttentionValue::sti_t get_attentional_focus_boundary() const
Definition: AtomSpace.h:538
AttentionValue::lti_t get_LTI(Handle h) const
Definition: AtomSpace.h:723
OutputIterator get_handles_by_AV(OutputIterator result, AttentionValue::sti_t lowerBound, AttentionValue::sti_t upperBound=AttentionValue::MAXSTI) const
Definition: AtomSpace.h:511
std::shared_ptr< Node > NodePtr
Definition: Node.h:112
bool is_node(Handle h) const
Definition: AtomSpace.h:676
bool is_link(Handle h) const
Definition: AtomSpace.h:677
HandleSeq get_incoming(Handle h) const
Definition: AtomSpace.h:668
OutputIterator get_incoming_set_by_type(OutputIterator result, Handle handle, Type type, bool subclass) const
Definition: AtomSpace.h:658
Handle get_link(Type t, const HandleSeq &outgoing)
Definition: AtomSpace.cc:217
TruthValuePtr getTruthValue()
Definition: Atom.cc:104
const std::string & get_name(Handle h) const
Definition: AtomSpace.h:688
virtual void barrier()=0
AttentionValuePtr get_AV(Handle h) const
Definition: AtomSpace.h:769
void barrier(void)
Definition: AtomSpace.h:186
void updateMaxSTI(AttentionValue::sti_t m)
float get_normalised_zero_to_one_STI(Handle h, bool average=true, bool clip=false) const
Definition: AtomSpace.h:497
std::string atom_as_string(Handle h, bool terse=true) const
Definition: AtomSpace.h:681
int get_size() const
Definition: AtomSpace.h:90
unsigned short Type
type of Atoms, represented as short integer (16 bits)
Definition: types.h:40
std::unordered_set< Handle, handle_hash > UnorderedHandleSet
a hash that associates the handle to its unique identificator
Definition: Handle.h:250
void store_atom(Handle h)
Definition: AtomSpace.cc:245
void update_LTI_funds(AttentionValue::lti_t m)
Definition: AtomSpace.h:589
OutputIterator get_handle_set_in_attentional_focus(OutputIterator result) const
Definition: AtomSpace.h:526
void set_AV(Handle h, AttentionValuePtr av) const
Definition: AtomSpace.h:775
Handle add_link(Type t, const HandleSeq &outgoing, bool async=false)
Definition: AtomSpace.cc:175
Handle add_link(Type t, Handle ha, Handle hb)
Definition: AtomSpace.h:131
size_t getSize() const
Definition: AtomTable.cc:620
OutputIterator getIncomingSetByType(OutputIterator result, Type type, bool subclass=false)
Definition: Atom.h:353
long updateSTIFunds(AttentionValue::sti_t diff)
Handle fetch_atom(Handle h)
Definition: AtomSpace.cc:253
void dec_VLTI(Handle h) const
Definition: AtomSpace.h:713
Handle get_link(Type t, Handle ha, Handle hb, Handle hc)
Definition: AtomSpace.h:318
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg, Handle hh)
Definition: AtomSpace.h:164
unsigned short Arity
arity of Links, represented as short integer (16 bits)
Definition: Link.h:40
AttentionValue::sti_t get_min_STI(bool average=true) const
Definition: AtomSpace.h:567
OutputIterator getHandlesByType(OutputIterator result, Type type, bool subclass=false, bool parent=true) const
Definition: AtomTable.h:204
boost::signals2::connection AVChangedSignal(const AVCHSigl::slot_type &function)
Definition: AtomSpace.h:604
void clear()
Clear the atomspace, remove all atoms.
Definition: AtomSpace.cc:355
Type get_type(Handle h) const
Definition: AtomSpace.h:781
Handle fetch_incoming_set(Handle, bool)
Definition: AtomSpace.cc:321
const HandleSeq & get_outgoing(Handle h) const
Definition: AtomSpace.h:735
static const sti_t MAXSTI
Handle add_atom(AtomPtr atom, bool async=false)
Definition: AtomSpace.cc:100
Handle get_handle(Type t, const Handle &ha)
Definition: AtomSpace.h:327
Handle add_link(Type t, Handle ha, Handle hb, Handle hc, Handle hd, Handle he, Handle hf, Handle hg)
Definition: AtomSpace.h:158
boost::signals2::connection RemoveAFSignal(const AVCHSigl::slot_type &function)
Definition: AtomSpace.h:616