libmoost
|
neigh_multi_map is a container that associates keys to list of pairs of integers and floats read from the standard-mir format neigh. More...
#include <neigh_multi_map.hpp>
Public Types | |
typedef multi_map< int, std::pair< int, float > , TLocMap > ::loc_map_policy_type | loc_map_policy_type |
Public Member Functions | |
neigh_multi_map (const loc_map_policy_type &locHandlerPolicy) | |
neigh_multi_map () | |
void | create_map (const std::string &dataFileName, int maxEntriesPerVec=(std::numeric_limits< int >::max)()) |
template<typename TranformIDPolicy > | |
void | create_map (const std::string &dataFileName, const TranformIDPolicy &getIDPolicy, int maxEntriesPerVec=(std::numeric_limits< int >::max)()) |
void | create_map_from_vector (std::vector< std::pair< int, std::pair< int, float > > > &i2i) |
Private Attributes | |
bool | m_externalLocMap |
neigh_multi_map is a container that associates keys to list of pairs of integers and floats read from the standard-mir format neigh.
It is similar in concept of having an hashmap: hm[key] -> { pair<int, float>, pair<int, float>, pair<int, float>, ..} but it's way more efficient.
Example usage:
moost::container::neigh_multi_map test; test.create_map( "myFile.bin" ); moost::container::multi_map<int, float>::range rt; rt = test[10]; moost::container::multi_map<int, float>::range_iterator mapIt; for ( mapIt = rt.begin(); mapIt != rt.end(); ++mapIt ) cout << *mapIt << endl;
Please note that the default policy uses moost::container::dense_hash_map to map the keys. If you expect keys with zero value, please specify a policy with a different empty key, i.e.
typedef moost::container::neigh_multi_map<> multi_map_type; // this defines empty_key=-1 // also note that the bucket size is less important here because neigh_multi_map figures // out the optimal size given the number of entries multi_map_type::loc_map_policy_type policy(-1); multi_map_type data(policy);
Is it also possible to define a different container for the locatin map, i.e. if one want to use a sparse hash map the declaration is:
typedef moost::container::neigh_multi_map< int, float, sparse_hash_map<int, moost::container::multimap_value_type> > multi_map_sparse; multi_map_sparse data(policy);
Definition at line 100 of file neigh_multi_map.hpp.
typedef multi_map< int, std::pair<int, float>, TLocMap >::loc_map_policy_type moost::container::neigh_multi_map< TLocMap >::loc_map_policy_type |
Reimplemented from moost::container::multi_map< int, std::pair< int, float >, TLocMap >.
Definition at line 105 of file neigh_multi_map.hpp.
moost::container::neigh_multi_map< TLocMap >::neigh_multi_map | ( | const loc_map_policy_type & | locHandlerPolicy | ) | [inline] |
Definition at line 117 of file neigh_multi_map.hpp.
moost::container::neigh_multi_map< TLocMap >::neigh_multi_map | ( | ) | [inline] |
Definition at line 121 of file neigh_multi_map.hpp.
void moost::container::neigh_multi_map< TLocMap >::create_map | ( | const std::string & | dataFileName, |
int | maxEntriesPerVec = (std::numeric_limits<int>::max)() |
||
) | [inline] |
void moost::container::neigh_multi_map< TLocMap >::create_map | ( | const std::string & | dataFileName, |
const TranformIDPolicy & | getIDPolicy, | ||
int | maxEntriesPerVec = (std::numeric_limits<int>::max)() |
||
) |
Definition at line 185 of file neigh_multi_map.hpp.
void moost::container::neigh_multi_map< TLocMap >::create_map_from_vector | ( | std::vector< std::pair< int, std::pair< int, float > > > & | i2i | ) | [inline] |
Definition at line 143 of file neigh_multi_map.hpp.
bool moost::container::neigh_multi_map< TLocMap >::m_externalLocMap [private] |
Definition at line 155 of file neigh_multi_map.hpp.