Kyoto Cabinet

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions
kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO > Class Template Reference

Doubly-linked hash map. More...

`#include <kcmap.h>`

List of all members.

## Classes

class | Iterator
| Iterator of records. More...
struct | Record
| Record data.

## Public Types

enum | MoveMode { MCURRENT, MFIRST, MLAST }
| Moving Modes. More...

## Public Member Functions

| LinkedHashMap ()
| Default constructor.
| LinkedHashMap (size_t bnum)
| Constructor.
| ~LinkedHashMap ()
| Destructor.
VALUE * | set (const KEY &key, const VALUE &value, MoveMode mode)
| Store a record.
bool | remove (const KEY &key)
| Remove a record.
VALUE * | migrate (const KEY &key, LinkedHashMap *dist, MoveMode mode)
| Migrate a record to another map.
VALUE * | get (const KEY &key, MoveMode mode)
| Retrieve a record.
void | clear ()
| Remove all records.
size_t | count ()
| Get the number of records.
Iterator | begin ()
| Get an iterator at the first record.
Iterator | end ()
| Get an iterator of the end sentry.
Iterator | find (const KEY &key)
| Get an iterator at a record.
const KEY & | first_key ()
| Get the reference of the key of the first record.
VALUE & | first_value ()
| Get the reference of the value of the first record.
const KEY & | last_key ()
| Get the reference of the key of the last record.
VALUE & | last_value ()
| Get the reference of the value of the last record.

## Detailed Description

### template<class KEY, class VALUE, class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>
class kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >

Doubly-linked hash map.

Parameters:

  KEY | the key type.
  VALUE | the value type.
  HASH | the hash functor.
  EQUALTO | the equality checking functor.

## Member Enumeration Documentation

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

enum kyotocabinet::LinkedHashMap::MoveMode

Moving Modes.

Enumerator:

  MCURRENT | keep the current position
  MFIRST | move to the first
  MLAST | move to the last

## Constructor & Destructor Documentation

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::LinkedHashMap | ( |  | ) | `[explicit]`

Default constructor.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::LinkedHashMap | ( | size_t | bnum | ) | `[explicit]`

Constructor.

Parameters:

  bnum | the number of buckets of the hash table.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::~LinkedHashMap | ( |  | ) |

Destructor.

## Member Function Documentation

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

VALUE* kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::set | ( | const KEY & | key,
|  | const VALUE & | value,
|  | MoveMode | mode
| ) |  |

Store a record.

Parameters:

  key | the key.
  value | the value.
  mode | the moving mode.

Returns:
  the pointer to the value of the stored record.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

bool kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::remove | ( | const KEY & | key | ) |

Remove a record.

Parameters:

  key | the key.

Returns:
  true on success, or false on failure.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

VALUE* kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::migrate | ( | const KEY & | key,
|  | LinkedHashMap< KEY, VALUE, HASH, EQUALTO > * | dist,
|  | MoveMode | mode
| ) |  |

Migrate a record to another map.

Parameters:

  key | the key.
  dist | the destination map.
  mode | the moving mode.

Returns:
  the pointer to the value of the migrated record, or NULL on failure.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

VALUE* kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::get | ( | const KEY & | key,
|  | MoveMode | mode
| ) |  |

Retrieve a record.

Parameters:

  key | the key.
  mode | the moving mode.

Returns:
  the pointer to the value of the corresponding record, or NULL on failure.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

void kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::clear | ( |  | ) |

Remove all records.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

size_t kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::count | ( |  | ) |

Get the number of records.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

Iterator kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::begin | ( |  | ) |

Get an iterator at the first record.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

Iterator kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::end | ( |  | ) |

Get an iterator of the end sentry.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

Iterator kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::find | ( | const KEY & | key | ) |

Get an iterator at a record.

Parameters:

  key | the key.

Returns:
  the pointer to the value of the corresponding record, or NULL on failure.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

const KEY& kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::first_key | ( |  | ) |

Get the reference of the key of the first record.

Returns:
  the reference of the key of the first record.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

VALUE& kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::first_value | ( |  | ) |

Get the reference of the value of the first record.

Returns:
  the reference of the value of the first record.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

const KEY& kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::last_key | ( |  | ) |

Get the reference of the key of the last record.

Returns:
  the reference of the key of the last record.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class EQUALTO = std::equal_to<KEY>>

VALUE& kyotocabinet::LinkedHashMap< KEY, VALUE, HASH, EQUALTO >::last_value | ( |  | ) |

Get the reference of the value of the last record.

Returns:
  the reference of the value of the last record.