OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LinkIndex.h
Go to the documentation of this file.
1 /*
2  * opencog/atomspace/LinkIndex.h
3  *
4  * Copyright (C) 2008,2009 Linas Vepstas <linasvepstas@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License v3 as
8  * published by the Free Software Foundation and including the exceptions
9  * at http://opencog.org/wiki/Licenses
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program; if not, write to:
18  * Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #ifndef _OPENCOG_LINK_INDEX_H
23 #define _OPENCOG_LINK_INDEX_H
24 
25 #include <set>
26 #include <vector>
27 
30 
31 namespace opencog
32 {
43 class LinkIndex
44 {
45  private:
46  std::vector<HandleSeqIndex> idx;
47  public:
48  LinkIndex(void);
49  void insertAtom(const AtomPtr&);
50  void removeAtom(const AtomPtr&);
51  void remove(bool (*)(const Handle&));
52  void resize();
53  size_t size() const;
54 
55  Handle getHandle(Type type, const HandleSeq&) const;
56  UnorderedHandleSet getHandleSet(Type type, const HandleSeq&, bool subclass) const;
57 };
58 
60 } //namespace opencog
61 
62 #endif // _OPENCOG_LINK_INDEX_H
std::vector< HandleSeqIndex > idx
Definition: LinkIndex.h:46
std::vector< Handle > HandleSeq
a list of handles
Definition: Handle.h:246
UnorderedHandleSet getHandleSet(Type type, const HandleSeq &, bool subclass) const
Definition: LinkIndex.cc:85
std::shared_ptr< Atom > AtomPtr
Definition: Handle.h:48
void removeAtom(const AtomPtr &)
Definition: LinkIndex.cc:60
void insertAtom(const AtomPtr &)
Definition: LinkIndex.cc:49
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
size_t size() const
Definition: LinkIndex.cc:42
Handle getHandle(Type type, const HandleSeq &) const
Definition: LinkIndex.cc:71