OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AttentionBank.h
Go to the documentation of this file.
1 /*
2  * opencog/atomspace/AttentionBank.h
3  *
4  * Copyright (C) 2011 OpenCog Foundation
5  * All Rights Reserved
6  *
7  * Written by Joel Pitt <joel@opencog.org>
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_ATTENTION_BANK_H
26 #define _OPENCOG_ATTENTION_BANK_H
27 
28 #include <mutex>
29 
30 #include <boost/signals2.hpp>
31 
32 #include <opencog/util/recent_val.h>
34 
35 namespace opencog
36 {
41 typedef boost::signals2::signal<void (const Handle&,
42  const AttentionValuePtr&,
44 
45 class AtomTable;
46 
48 {
50  boost::signals2::connection AVChangedConnection;
52 
59 
63 
64  opencog::recent_val<AttentionValue::sti_t> maxSTI;
65  opencog::recent_val<AttentionValue::sti_t> minSTI;
66 
67  mutable std::mutex lock_maxSTI;
68  mutable std::mutex lock_minSTI;
69 
70  /* These indicate the amount importance funds available in the
71  * AtomSpace */
72  long fundsSTI;
73  long fundsLTI;
74 
77 
78  mutable std::mutex lock_funds;
79 
80 public:
84  void shutdown(void);
85 
92 
99  long getTotalSTI() const;
100 
107  long getTotalLTI() const;
108 
114  long getSTIFunds() const;
115 
122  long getLTIFunds() const;
123 
126 
135 
145 
153  AttentionValue::sti_t getMaxSTI(bool average=true) const;
154 
162  AttentionValue::sti_t getMinSTI(bool average=true) const;
163 
173 
183 
185  //void setVLTI(AttentionValueHolderPtr avh, AttentionValue::vlti_t);
186 
198  float getNormalisedSTI(AttentionValuePtr, bool average, bool clip) const;
199 
203  float getNormalisedSTI(AttentionValuePtr) const;
214  float getNormalisedZeroToOneSTI(AttentionValuePtr, bool average, bool clip) const;
215 };
216 
218 } //namespace opencog
219 
220 #endif // _OPENCOG_ATTENTION_BANK_H
float getNormalisedSTI(AttentionValuePtr, bool average, bool clip) const
AttentionValue::sti_t setAttentionalFocusBoundary(AttentionValue::sti_t s)
std::shared_ptr< AttentionValue > AttentionValuePtr
long getSTIFunds() const
short lti_t
long-term importance type
AttentionValue::sti_t getAttentionalFocusBoundary() const
short sti_t
short-term importance type
AFCHSigl & RemoveAFSignal()
Definition: AttentionBank.h:91
AttentionValue::sti_t getMaxSTI(bool average=true) const
float getNormalisedZeroToOneSTI(AttentionValuePtr, bool average, bool clip) const
long getLTIFunds() const
AttentionValue::sti_t getMinSTI(bool average=true) const
void updateMinSTI(AttentionValue::sti_t m)
AFCHSigl & AddAFSignal()
Definition: AttentionBank.h:90
long updateLTIFunds(AttentionValue::lti_t diff)
AttentionValue::sti_t attentionalFocusBoundary
Definition: AttentionBank.h:58
boost::signals2::signal< void(const Handle &, const AttentionValuePtr &, const AttentionValuePtr &)> AFCHSigl
Definition: AttentionBank.h:43
AttentionBank(AtomTable &)
void updateMaxSTI(AttentionValue::sti_t m)
long getTotalLTI() const
long updateSTIFunds(AttentionValue::sti_t diff)
opencog::recent_val< AttentionValue::sti_t > maxSTI
Definition: AttentionBank.h:64
long getTotalSTI() const
opencog::recent_val< AttentionValue::sti_t > minSTI
Definition: AttentionBank.h:65
boost::signals2::connection AVChangedConnection
Definition: AttentionBank.h:50
void AVChanged(Handle, AttentionValuePtr, AttentionValuePtr)