bm::compressed_collection< Value, BV > Class Template Reference

Compressed (sparse collection of objects). More...

`#include <bmsparsevec_util.h>`

Inheritance diagram for bm::compressed_collection< Value, BV >:
[legend]
Collaboration diagram for bm::compressed_collection< Value, BV >:
[legend]

## Public Types

typedef BV | bvector_type
typedef BV::size_type | size_type
typedef size_type | key_type
typedef size_type | address_type
typedef Value | value_type
typedef Value | mapped_type
typedef std::vector< value_type > | container_type
typedef bm::bvps_addr_resolver< bvector_type > | address_resolver_type

## Public Member Functions

| compressed_collection ()
bool | push_back (key_type key, const value_type &val)
| Add new value to compressed collection.
const value_type & | at (key_type key) const
| find and return const associated value (with bounds/presense checking)
value_type & | at (key_type key)
| find and return associated value (with bounds/presense checking)
void | sync ()
| Checkpoint method to prepare collection for reading.
void | optimize (bm::word_t *temp_block=0)
| perform memory optimizations/compression
bool | resolve (key_type key, address_type *addr) const
| Resolve key address (index) in the dense vector.
const value_type & | get (address_type addr) const
| Get access to associated value by resolved address.
const address_resolver_type & | resolver () const
| Get address resolver.
address_resolver_type & | resolver ()
| Get address resolver.
size_t | size () const
| size of collection
bool | equal (const compressed_collection< Value, BV > &ccoll) const
| perform equality comparison with another collection
container_type & | container ()
| return dense container for direct access (this should be treated as an internal function designed for deserialization)

## Protected Member Functions

void | throw_range_error (const char *err_msg) const

## Protected Attributes

address_resolver_type | addr_res_
| address resolver
container_type | dense_vect_
| compressed space container
key_type | last_add_
| last added element

## Detailed Description

template<class Value, class BV>
class bm::compressed_collection< Value, BV >

Compressed (sparse collection of objects).

Definition at line 226 of file bmsparsevec_util.h.

## Member Typedef Documentation

## address_resolver_type

template<class Value, class BV>

typedef bm::bvps_addr_resolver<bvector_type> bm::compressed_collection< Value, BV >::address_resolver_type

Definition at line 236 of file bmsparsevec_util.h.

## address_type

template<class Value, class BV>

typedef size_type bm::compressed_collection< Value, BV >::address_type

Definition at line 232 of file bmsparsevec_util.h.

## bvector_type

template<class Value, class BV>

typedef BV bm::compressed_collection< Value, BV >::bvector_type

Definition at line 229 of file bmsparsevec_util.h.

## container_type

template<class Value, class BV>

typedef std::vector<value_type> bm::compressed_collection< Value, BV >::container_type

Definition at line 235 of file bmsparsevec_util.h.

## key_type

template<class Value, class BV>

typedef size_type bm::compressed_collection< Value, BV >::key_type

Definition at line 231 of file bmsparsevec_util.h.

## mapped_type

template<class Value, class BV>

typedef Value bm::compressed_collection< Value, BV >::mapped_type

Definition at line 234 of file bmsparsevec_util.h.

## size_type

template<class Value, class BV>

typedef BV::size_type bm::compressed_collection< Value, BV >::size_type

Definition at line 230 of file bmsparsevec_util.h.

## value_type

template<class Value, class BV>

typedef Value bm::compressed_collection< Value, BV >::value_type

Definition at line 233 of file bmsparsevec_util.h.

## Constructor & Destructor Documentation

## compressed_collection()

template<class Value, class BV>

bm::compressed_collection< Value, BV >::compressed_collection | ( |  | ) |

Definition at line 602 of file bmsparsevec_util.h.

References last_add_.

Referenced by equal().

## Member Function Documentation

## at() [1/2]

template<class Value, class BV>

compressed_collection< Value, BV >::value_type & bm::compressed_collection< Value, BV >::at | ( | key_type | key | ) |

find and return associated value (with bounds/presense checking)

Definition at line 684 of file bmsparsevec_util.h.

References addr_res_, dense_vect_, and throw_range_error().

## at() [2/2]

template<class Value, class BV>

const compressed_collection< Value, BV >::value_type & bm::compressed_collection< Value, BV >::at | ( | key_type | key | ) | const

find and return const associated value (with bounds/presense checking)

Definition at line 669 of file bmsparsevec_util.h.

References addr_res_, get(), and throw_range_error().

## container()

template<class Value, class BV>

container_type & bm::compressed_collection< Value, BV >::container | ( |  | ) |

inline

return dense container for direct access (this should be treated as an internal function designed for deserialization)

Definition at line 296 of file bmsparsevec_util.h.

## equal()

template<class Value, class BV>

bool bm::compressed_collection< Value, BV >::equal | ( | const compressed_collection< Value, BV > & | ccoll | ) | const

perform equality comparison with another collection

Definition at line 711 of file bmsparsevec_util.h.

References addr_res_, BM_ASSERT, compressed_collection(), dense_vect_, and bm::bvps_addr_resolver< BV >::get_bvector().

## get()

template<class Value, class BV>

const compressed_collection< Value, BV >::value_type & bm::compressed_collection< Value, BV >::get | ( | address_type | addr | ) | const

Get access to associated value by resolved address.

Definition at line 660 of file bmsparsevec_util.h.

References dense_vect_.

Referenced by at().

## optimize()

template<class Value, class BV>

void bm::compressed_collection< Value, BV >::optimize | ( | bm::word_t * | temp_block = 0 | ) |

perform memory optimizations/compression

Definition at line 639 of file bmsparsevec_util.h.

References addr_res_.

## push_back()

template<class Value, class BV>

bool bm::compressed_collection< Value, BV >::push_back | ( | key_type | key,
|  | const value_type & | val )

Add new value to compressed collection.

Must be added in sorted key order (growing).

Unsorted will not be added!

Returns
  true if value was added (does not violate sorted key order)

Definition at line 610 of file bmsparsevec_util.h.

References addr_res_, BM_ASSERT, dense_vect_, and last_add_.

## resolve()

template<class Value, class BV>

bool bm::compressed_collection< Value, BV >::resolve | ( | key_type | key,
|  | address_type * | addr ) const

Resolve key address (index) in the dense vector.

Definition at line 647 of file bmsparsevec_util.h.

References addr_res_.

## resolver() [1/2]

template<class Value, class BV>

address_resolver_type & bm::compressed_collection< Value, BV >::resolver | ( |  | ) |

inline

Get address resolver.

Definition at line 283 of file bmsparsevec_util.h.

## resolver() [2/2]

template<class Value, class BV>

const address_resolver_type & bm::compressed_collection< Value, BV >::resolver | ( |  | ) | const

inline

Get address resolver.

Definition at line 279 of file bmsparsevec_util.h.

## size()

template<class Value, class BV>

size_t bm::compressed_collection< Value, BV >::size | ( |  | ) | const

inline

size of collection

Definition at line 287 of file bmsparsevec_util.h.

## sync()

template<class Value, class BV>

void bm::compressed_collection< Value, BV >::sync | ( |  | ) |

Checkpoint method to prepare collection for reading.

Definition at line 631 of file bmsparsevec_util.h.

References addr_res_.

## throw_range_error()

template<class Value, class BV>

void bm::compressed_collection< Value, BV >::throw_range_error | ( | const char * | err_msg | ) | const

protected

Definition at line 699 of file bmsparsevec_util.h.

References BM_ASSERT_THROW.

Referenced by at(), and at().

## Field Documentation

## addr_res_

template<class Value, class BV>

address_resolver_type bm::compressed_collection< Value, BV >::addr_res_

protected

address resolver

Definition at line 302 of file bmsparsevec_util.h.

Referenced by at(), at(), equal(), optimize(), push_back(), resolve(), and sync().

## dense_vect_

template<class Value, class BV>

container_type bm::compressed_collection< Value, BV >::dense_vect_

protected

compressed space container

Definition at line 303 of file bmsparsevec_util.h.

Referenced by at(), equal(), get(), and push_back().

## last_add_

template<class Value, class BV>

key_type bm::compressed_collection< Value, BV >::last_add_

protected

last added element

Definition at line 304 of file bmsparsevec_util.h.

Referenced by compressed_collection(), and push_back().

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

- bmsparsevec_util.h