|
| FilterMap (Factors f) |
| Basic constructor. More...
|
|
| FilterMap (TrieType t, ItemsContainer c) |
| Constructor from trie and items. More...
|
|
Factors | getF () const |
| This function returns the set factor space for the FilterMap. More...
|
|
template<typename... Args> |
void | emplace (const PartialFactors &pf, Args &&... args) |
| This function creates an instance of T within the container. More...
|
|
Iterable | filter (const Factors &f) |
| This function creates an iterable object over all values matching the input key. More...
|
|
ConstIterable | filter (const Factors &f) const |
| This function creates an iterable object over all values matching the input key. More...
|
|
template<typename TT = TrieType, typename = std::enable_if_t<std::is_same_v<TT, Trie>>> |
Iterable | filter (const Factors &f, size_t offset) |
| This function creates an iterable object over all values matching the input key. More...
|
|
template<typename TT = TrieType, typename = std::enable_if_t<std::is_same_v<TT, Trie>>> |
ConstIterable | filter (const Factors &f, size_t offset) const |
| This function creates an iterable object over all values matching the input key. More...
|
|
Iterable | filter (const PartialFactors &pf) |
| This function creates an iterable object over all values matching the input key. More...
|
|
ConstIterable | filter (const PartialFactors &pf) const |
| This function creates an iterable object over all values matching the input key. More...
|
|
void | reserve (size_t size) |
| This function reserves the specified space to avoid reallocations. More...
|
|
size_t | size () const |
| This function returns the number of values that have been added to the FilterMap. More...
|
|
ItemsContainer::iterator | begin () |
| This function returns the beginning of a range containing all items added to the container. More...
|
|
ItemsContainer::const_iterator | begin () const |
| This function returns the beginning of a range containing all items added to the container. More...
|
|
ItemsContainer::iterator | end () |
| This function returns the end of a range containing all items added to the container. More...
|
|
ItemsContainer::const_iterator | end () const |
| This function returns the end of a range containing all items added to the container. More...
|
|
const T & | operator[] (size_t id) const |
| This function allows direct access to the items in the container. More...
|
|
T & | operator[] (size_t id) |
| This function allows direct access to the items in the container. More...
|
|
const ItemsContainer & | getContainer () const |
| This function provides a direct view on the items contained by the container. More...
|
|
const TrieType & | getTrie () const |
| This function returns the underlying trie object. More...
|
|
template<typename T, typename TrieType = FasterTrie>
class AIToolbox::Factored::FilterMap< T, TrieType >
This class is a container which uses PartialFactors as keys.
This class stores values using PartialFactors as keys. The values can then be reached using Factors. The result will be an iterable object which will iterate over all values where the key matched the input.
This class does not allow removal of elements.
- Template Parameters
-
T | The type of object to be stored. |
template<typename T , typename TrieType = FasterTrie>
Constructor from trie and items.
This constructor is provided when the user wants to copy two FilterMap of different types but which share the underlying factorization.
With this constructor, the underlying TrieType can be copied, while a new container of items must be provided, of the same size as the input TrieType.
If the two sizes are not equal, the constructor will throw an std::invalid_argument exception.
- Parameters
-
t | The trie to copy. |
c | The new items to store. |
template<typename T , typename TrieType = FasterTrie>
template<typename... Args>
This function creates an instance of T within the container.
If very many items must be emplaced in the container, it is recommended to call reserve() beforehand in order to avoid multiple reallocations. In addition, see the Trie documentation on how to most efficiently insert new keys (if speed is very important).
- See also
- Trie::insert()
- Parameters
-
pf | The key where the value should be stored. |
args | The arguments needed to emplace the new value. |
template<typename T , typename TrieType = FasterTrie>
template<typename TT = TrieType, typename = std::enable_if_t<std::is_same_v<TT, Trie>>>
This function creates an iterable object over all values matching the input key.
- See also
- Trie::filter(const Factors&, size_t)
This method can only be used if the underlying TrieType supports it.
- Parameters
-
f | The key that must be matched. |
offset | The offset of the key, if smaller than the factor space. |
- Returns
- An iterable object over all values matching the input.
template<typename T , typename TrieType = FasterTrie>
template<typename TT = TrieType, typename = std::enable_if_t<std::is_same_v<TT, Trie>>>
This function creates an iterable object over all values matching the input key.
- See also
- Trie::filter(const Factors&, size_t)
This method can only be used if the underlying TrieType supports it.
- Parameters
-
f | The key that must be matched. |
offset | The offset of the key, if smaller than the factor space. |
- Returns
- An iterable object over all values matching the input.