OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
NullTruthValue.cc
Go to the documentation of this file.
1 /*
2  * opencog/atomspace/NullTruthValue.cc
3  *
4  * Copyright (C) 2002-2007 Novamente LLC
5  * All Rights Reserved
6  *
7  * Written by Welter Silva <welter@vettalabs.com>
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 #include "NullTruthValue.h"
26 
27 #include <opencog/util/exceptions.h>
28 
29 using namespace opencog;
30 
32 
34 {
35  return true;
36 }
37 
38 bool NullTruthValue::operator==(const TruthValue& rhs) const
39 {
40  const NullTruthValue *ntv = dynamic_cast<const NullTruthValue *>(&rhs);
41  if (ntv) return true;
42  return false;
43 }
44 
45 std::string NullTruthValue::toString() const
46 {
47  return "(null TV)";
48 }
49 
50 strength_t NullTruthValue::getMean() const throw (RuntimeException)
51 {
52  throw RuntimeException(TRACE_INFO, "Cannot call getMean() method of a NullTruthvalue");
53 }
54 
55 count_t NullTruthValue::getCount() const throw (RuntimeException)
56 {
57  throw RuntimeException(TRACE_INFO, "Cannot call getCount() method of a NullTruthvalue");
58 }
59 
60 confidence_t NullTruthValue::getConfidence() const throw (RuntimeException)
61 {
62  throw RuntimeException(TRACE_INFO, "Cannot call getConfidence() method of a NullTruthvalue");
63 }
64 
66 {
67  return NULL_TRUTH_VALUE;
68 }
69 
70 TruthValuePtr NullTruthValue::merge(TruthValuePtr,TVMergeStyle ms/*=DEFAULT*/) const throw (RuntimeException)
71 {
72  throw RuntimeException(TRACE_INFO, "Cannot call merge() method of a NullTruthvalue");
73 }
74 
76 {
77  static TruthValuePtr nullo(new NullTruthValue());
78  return nullo;
79 }
80 
82 {
83  return new NullTruthValue();
84 }
85 
std::string toString() const
TruthValuePtr clone() const
TruthValueType getType() const
TruthValueType
Definition: TruthValue.h:63
std::shared_ptr< TruthValue > TruthValuePtr
Definition: TruthValue.h:85
virtual bool operator==(const TruthValue &rhs) const
float strength_t
float confidence_t
double count_t
a special type of TruthValue
strength_t getMean() const
TruthValue * rawclone() const
confidence_t getConfidence() const
count_t getCount() const
TruthValuePtr merge(TruthValuePtr, TVMergeStyle ms=DEFAULT) const
TVMergeStyle
Definition: TruthValue.h:76