Tkrzw
|
On-memory secondary index implementation with std::map for generic types. More...
#include <tkrzw_index.h>
Classes | |
class | Iterator |
Iterator for each record. More... | |
Public Member Functions | |
StdIndex () | |
Default constructor. More... | |
~StdIndex () | |
Destructor. More... | |
StdIndex (const StdIndex &rhs)=delete | |
Copy and assignment are disabled. More... | |
StdIndex & | operator= (const StdIndex &rhs)=delete |
bool | Check (const KEYTYPE &key, const VALUETYPE &value) |
Checks whether a record exists in the index. More... | |
std::vector< VALUETYPE > | GetValues (const KEYTYPE &key, size_t max=0) |
Gets all values of records of a key. More... | |
void | Add (const KEYTYPE &key, const VALUETYPE &value) |
Adds a record. More... | |
void | Remove (const KEYTYPE &key, const VALUETYPE &value) |
Removes a record. More... | |
size_t | Count () |
Gets the number of records. More... | |
void | Clear () |
Removes all records. More... | |
std::unique_ptr< Iterator > | MakeIterator () |
Makes an iterator for each record. More... | |
On-memory secondary index implementation with std::map for generic types.
KEYTYPE | the key type. |
VALUETYPE | the value type. |
CMPTYPE | the comparator type. |
All operations are thread-safe; Multiple threads can access the same index concurrently.
tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::StdIndex | ( | ) |
Default constructor.
tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::~StdIndex |
Destructor.
|
explicitdelete |
Copy and assignment are disabled.
bool tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::Check | ( | const KEYTYPE & | key, |
const VALUETYPE & | value | ||
) |
Checks whether a record exists in the index.
key | The key of the record. |
value | The value of the record. |
std::vector< VALUETYPE > tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::GetValues | ( | const KEYTYPE & | key, |
size_t | max = 0 |
||
) |
Gets all values of records of a key.
key | The key to look for. |
max | The maximum number of values to get. 0 means unlimited. |
void tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::Add | ( | const KEYTYPE & | key, |
const VALUETYPE & | value | ||
) |
Adds a record.
key | The key of the record. This can be an arbitrary expression to search the index. |
value | The value of the record. This should be a primary value of another database. |
void tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::Remove | ( | const KEYTYPE & | key, |
const VALUETYPE & | value | ||
) |
Removes a record.
key | The key of the record. |
value | The value of the record. |
size_t tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::Count |
Gets the number of records.
void tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::Clear |
Removes all records.
std::unique_ptr< typename StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::Iterator > tkrzw::StdIndex< KEYTYPE, VALUETYPE, CMPTYPE >::MakeIterator |
Makes an iterator for each record.