OpenCog Framework  Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
opencog::HandleSeqIndex Class Reference

#include <HandleSeqIndex.h>

Public Member Functions

void insert (const HandleSeq &seq, const Handle &h)
 
const Handleget (const HandleSeq &seq) const
 
void remove (const HandleSeq &seq)
 
size_t size (void) const
 
void remove (bool(*)(const Handle &))
 

Private Attributes

std::map< const HandleSeq,
Handle, handle_seq_less
idx
 

Detailed Description

Implements a Handle-sequence index as an RB-tree (C++ map) That is, given a HandleSeq, it will return a (single) Handle associated with that HandleSeq. This map is in the "opposite" direction from the HandleIndex.

Todo:
Notice that it this wastes a fair amount of RAM by storing a copy of a HandleSeq — it could save a fair amount of space by storing a pointer to the HandleSeq that is in the Link already (at the cost of some fragility in Link deletion). Alternately, we could use a "HandleSeq cache", analogous to a string cache, to ensure only one copy of a HandleSeq per system... XXX FixMe!

Definition at line 50 of file HandleSeqIndex.h.

Member Function Documentation

const Handle& opencog::HandleSeqIndex::get ( const HandleSeq seq) const
inline

Definition at line 60 of file HandleSeqIndex.h.

References idx, and opencog::Handle::UNDEFINED.

+ Here is the caller graph for this function:

void opencog::HandleSeqIndex::insert ( const HandleSeq seq,
const Handle h 
)
inline

Definition at line 56 of file HandleSeqIndex.h.

References idx.

+ Here is the caller graph for this function:

void opencog::HandleSeqIndex::remove ( const HandleSeq seq)
inline

Definition at line 67 of file HandleSeqIndex.h.

References idx.

+ Here is the caller graph for this function:

void HandleSeqIndex::remove ( bool(*)(const Handle &)  filter)

Definition at line 26 of file HandleSeqIndex.cc.

References idx.

size_t opencog::HandleSeqIndex::size ( void  ) const
inline

Definition at line 71 of file HandleSeqIndex.h.

References idx.

Member Data Documentation

std::map<const HandleSeq, Handle, handle_seq_less> opencog::HandleSeqIndex::idx
private

Definition at line 53 of file HandleSeqIndex.h.


The documentation for this class was generated from the following files: