OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BackingStore.cc
Go to the documentation of this file.
1 /*
2  * opencog/atomspace/BackingStore.cc
3  *
4  * Copyright (C) 2013 Linas Vepstas
5  * All Rights Reserved
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License v3 as
9  * published by the Free Software Foundation and including the exceptions
10  * at http://opencog.org/wiki/Licenses
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Affero General Public License
18  * along with this program; if not, write to:
19  * Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 #include <algorithm>
24 
25 #include "BackingStore.h"
26 
27 using namespace opencog;
28 
29 
31 {
32  // If the handle is a uuid only, and no atom, we can't ignore it.
33  AtomPtr a(h);
34  if (NULL == a) return false;
35 
36  // If the atom is of an ignoreable type, then ignore.
37  if (ignoreType(a->getType())) return true;
38 
39  // If its a link, then scan the outgoing set.
40  LinkPtr l(LinkCast(a));
41  if (NULL == l) return false;
42 
43  const HandleSeq& hs = l->getOutgoingSet();
44  if (std::any_of(hs.begin(), hs.end(), [this](Handle ho) { return ignoreAtom(ho); }))
45  return true;
46  return false;
47 }
48 
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
std::shared_ptr< Atom > AtomPtr
Definition: Handle.h:48
std::shared_ptr< Link > LinkPtr
Definition: Atom.h:53
virtual bool ignoreType(Type t) const
Definition: BackingStore.h:105
static LinkPtr LinkCast(const Handle &h)
Definition: Link.h:263
virtual bool ignoreAtom(Handle) const
Definition: BackingStore.cc:30