10 template<
typename T,
typename registry_root_t = T>
13 std::string m_options;
32 Meta meta = T::meta();
33 auto fixed_static_args = std::move(meta).build_static_args_ast_value();
35 auto padded_options = meta.
name() +
"(" + m_options +
")";
36 auto meta_type = meta.
type();
43 ast::Parser p { padded_options };
45 auto evald_algo = eval::cl_eval(
49 std::move(fixed_static_args)
52 auto evaluated_options = evald_algo.as_algorithm();
54 auto env_root = std::make_shared<EnvRoot>(std::move(evaluated_options));
55 Env env(env_root, env_root->algo_value());
65 template<
typename... Args>
67 return T(
env(), std::forward<Args>(args)...);
82 template<
typename T,
typename registry_root_t = T>
89 inline std::unique_ptr<Compressor> create_algo_with_registry_dynamic(
92 return registry.select_algorithm(algorithm_value);
95 template<
typename T,
typename registry_root_t,
typename... Args>
96 T create_algo_with_registry(
const std::string&
options,
99 return builder<T, registry_root_t>()
102 .
instance(std::forward<Args>(args)...);
117 template<
class T,
class... Args>
119 return create_algo_with_registry<T>(
options,
Registry<T>(), std::forward<Args>(args)...);
132 return create_algo<T>(
"");
145 auto fixed_static_args = std::move(meta).build_static_args_ast_value();
147 auto padded_options = meta.name() +
"(" + options +
")";
148 auto meta_type = meta.type();
150 eval::AlgorithmTypes types;
151 gather_types(types, {
155 ast::Parser p { padded_options };
157 auto evald_algo = eval::cl_eval(
161 std::move(fixed_static_args)
164 auto evaluated_options = evald_algo.as_algorithm();
165 auto env_root = std::make_shared<EnvRoot>(std::move(evaluated_options));
166 Env env(env_root, env_root->algo_value());
Contains the text compression and encoding framework.
Env create_env(Meta &&meta, const std::string &options="")
Creates an environment.
T create_algo(const std::string &options, Args &&... args)
Template for easy algorithm instantiation.
Builder & registry(const Registry< registry_root_t > ®)
Sets a registry to be used for dynamic type lookups during instantiation.
T instance(Args &&... args)
Instances T by creating the right Env instance, and passing any extra arguments to the constructor of...
eval::AlgorithmTypes & algorithm_map()
Env env()
Creates the Env instance needed for instantiating T.
Builder & options(const std::string &options)
Sets an options string for the created environment.
Builder< T, registry_root_t > builder()
Builder pattern template for easy algorithm instantiation.
Local environment for a compression/encoding/decompression call.