OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AtomUtils.h
Go to the documentation of this file.
1 /*
2  * AtomUtils.h
3  *
4  * Copyright (C) 2014 OpenCog Foundation
5  *
6  * Author: William Ma <https://github.com/williampma>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License v3 as
10  * published by the Free Software Foundation and including the exceptions
11  * at http://opencog.org/wiki/Licenses
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program; if not, write to:
20  * Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22  */
23 
24 #ifndef _OPENCOG_ATOM_UTILS_H
25 #define _OPENCOG_ATOM_UTILS_H
26 
27 #include <opencog/atomspace/atom_types.h>
28 #include <opencog/atomspace/Atom.h>
31 
32 namespace opencog
33 {
38 const bool NO_SUBCLASSES = false;
39 
46 
48 
50 
52 
65 HandleSeq get_neighbors(const Handle&, bool fanin=true, bool fanout=true,
66  Type linkType=LINK, bool subClasses=true);
67 
78  const std::vector<Type>& types =
79  std::vector<Type>());
80 
89 UnorderedHandleSet get_distant_neighbors(const Handle& h, int dist = 1);
90 
131 HandleSeq get_predicates(const Handle& target,
132  Type predicateType=PREDICATE_NODE,
133  bool subClasses=true);
134 
181 HandleSeq get_predicates_for(const Handle& target,
182  const Handle& predicate);
183 
185 }
186 
187 
188 #endif // _OPENCOG_ATOM_UTILS_H
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
const bool NO_SUBCLASSES
Definition: AtomUtils.h:38
HandleSeq get_neighbors(const Handle &h, bool fanin, bool fanout, Type desiredLinkType, bool subClasses)
Definition: AtomUtils.cc:130
UnorderedHandleSet get_distant_neighbors(const Handle &h, int dist)
Definition: AtomUtils.cc:216
HandleSeq get_predicates(const Handle &target, Type predicateType, bool subClasses)
Definition: AtomUtils.cc:225
HandleSeq get_all_atoms(Handle h)
Definition: AtomUtils.cc:89
HandleSeq get_all_nodes(Handle h)
Definition: AtomUtils.cc:40
HandleSeq get_predicates_for(const Handle &target, const Handle &predicate)
Definition: AtomUtils.cc:268
UnorderedHandleSet get_outgoing_nodes(const Handle &hinput, const std::vector< Type > &types)
Definition: AtomUtils.cc:156
UnorderedHandleSet get_all_unique_nodes(Handle h)
Definition: AtomUtils.cc:66
UnorderedHandleSet get_all_unique_atoms(Handle h)
Definition: AtomUtils.cc:113
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