OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
#include <TypeIndex.h>
Classes | |
class | iterator |
Public Member Functions | |
TypeIndex (void) | |
void | resize (void) |
void | insertAtom (Atom *a) |
void | removeAtom (Atom *a) |
size_t | getNumAtomsOfType (Type type, bool subclass) const |
iterator | begin (Type, bool) const |
iterator | end (void) const |
![]() | |
~FixedIntegerIndex () | |
void | insert (size_t i, Atom *a) |
void | remove (size_t i, Atom *a) |
size_t | size (size_t i) const |
size_t | size (void) const |
Private Attributes | |
size_t | num_types |
Additional Inherited Members | |
![]() | |
void | resize (size_t sz) |
![]() | |
std::vector< UnorderedAtomSet > | idx |
Implements an integer index as an RB-tree (C++ set) That is, given an atom Type, this returns all of the Handles for that Type.
The primary interface for this is an iterator, and that is because the index will typically contain millions of atoms, and this is far too much to try to return in some temporary array. Iterating is much safer.
Definition at line 52 of file TypeIndex.h.
TypeIndex::TypeIndex | ( | void | ) |
Definition at line 28 of file TypeIndex.cc.
References resize().
TypeIndex::iterator TypeIndex::begin | ( | Type | t, |
bool | sub | ||
) | const |
Definition at line 66 of file TypeIndex.cc.
References opencog::classserver(), opencog::TypeIndex::iterator::currtype, opencog::FixedIntegerIndex::idx, opencog::TypeIndex::iterator::s, opencog::TypeIndex::iterator::se, opencog::TypeIndex::iterator::send, and opencog::TypeIndex::iterator::type.
TypeIndex::iterator TypeIndex::end | ( | void | ) | const |
Definition at line 89 of file TypeIndex.cc.
References opencog::TypeIndex::iterator::currtype, opencog::FixedIntegerIndex::idx, num_types, opencog::TypeIndex::iterator::s, opencog::TypeIndex::iterator::se, and opencog::TypeIndex::iterator::send.
size_t TypeIndex::getNumAtomsOfType | ( | Type | type, |
bool | subclass | ||
) | const |
Definition at line 39 of file TypeIndex.cc.
References opencog::classserver(), opencog::FixedIntegerIndex::idx, opencog::TypeIndex::iterator::s, opencog::TypeIndex::iterator::send, and opencog::TypeIndex::iterator::type.
|
inline |
Definition at line 59 of file TypeIndex.h.
References python.create_atoms_by_type::a, opencog::Atom::getType(), and opencog::FixedIntegerIndex::insert().
|
inline |
Definition at line 63 of file TypeIndex.h.
References python.create_atoms_by_type::a, and opencog::Atom::getType().
void TypeIndex::resize | ( | void | ) |
Definition at line 33 of file TypeIndex.cc.
References opencog::classserver(), opencog::ClassServer::getNumberOfClasses(), num_types, and opencog::FixedIntegerIndex::resize().
|
private |
Definition at line 55 of file TypeIndex.h.