3 #include <unordered_set> 12 struct AlreadySeenPair {
13 std::array<std::string, 2> pair;
16 inline bool operator==(
const AlreadySeenPair& lhs,
const AlreadySeenPair& rhs) {
17 return lhs.pair[0] == rhs.pair[0] && lhs.pair[1] == rhs.pair[1];
28 template<
typename algorithm_t>
30 typedef std::function<std::unique_ptr<algorithm_t>(
Env&&)> constructor_t;
33 eval::AlgorithmTypes m_algorithms;
34 std::map<pattern::Algorithm, constructor_t> m_registered;
37 std::shared_ptr<RegistryData>
m_data;
38 std::string m_root_type;
41 friend class AlgorithmTypeBuilder;
42 friend class GlobalRegistry;
46 inline Registry(
const std::string& root_type =
"any"):
47 m_data(
std::make_shared<RegistryData>()), m_root_type(root_type) {}
58 void register_algorithm();
60 inline eval::AlgorithmTypes& algorithm_map();
61 inline const eval::AlgorithmTypes& algorithm_map()
const;
65 inline std::vector<pattern::Algorithm> all_algorithms_with_static(
View type)
const;
66 inline std::vector<pattern::Algorithm> all_algorithms_with_static_internal(std::vector<AlreadySeenPair>& already_seen,
View type)
const;
67 inline std::vector<pattern::Algorithm> check_for_undefined_algorithms();
68 inline std::unique_ptr<algorithm_t> select_algorithm(
const AlgorithmValue& algo)
const;
70 inline std::unique_ptr<algorithm_t>
select(
const std::string& text)
const;
72 inline std::string generate_doc_string(
const std::string& title)
const;
79 struct hash<typename
tdc::AlreadySeenPair>
82 return std::hash<tdc::ConstGenericView<std::string>>()(
Contains the text compression and encoding framework.
A const view into a slice of memory.
bool operator==(const ConstGenericView< uliteral_t > &lhs, const ConstGenericView< uliteral_t > &rhs)
size_t operator()(const tdc::AlreadySeenPair &x) const
A registry for algorithms to be made available in the driver application.
const value_type * data() const noexcept
The backing memory location.
Automatically select compress mode, internal use in TextDS only.
Local environment for a compression/encoding/decompression call.
Registry(const std::string &root_type="any")