Example: A customized ContainerFactory using a hashed IdxContainer type
typedef DBView<Example, ParamObjExample> ViewType;
typedef CBFunctor1wRet<const Example *, size_t> IVHash;
typedef CBFunctor2wRet<const Example *, const Example *, bool> IVCompare;
typedef hash_multiset<Example *, IVHash, IVCompare> HashMultisetType;
typedef DBIndex<ViewType. HashMultisetType, HASH> HashIdxType;
template<> class dtl::ContainerFactory<HashIdxType>
{
public:
HashMultisetType operator()(HashIdxType *pDBIndex, HASH h)
{
if (pDBIndex->GetName() == "PrimaryIndex")
return HashMultisetType(MEDIUM_HASH_TABLE, cb_ptr_fun_w_ret(my_hash_strings),
cb_ptr_fun_w_ret(*pDBIndex, &HashIdxType::eq));
else
return HashMultisetType(MEDIUM_HASH_TABLE, cb_ptr_fun_w_ret(*pDBIndex, &HashIdxType::hash),
cb_ptr_fun_w_ret(*pDBIndex, &HashIdxType::eq));
}
};