tudocomp
– The TU Dortmund Compression Framework
Env.hpp
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace tdc {
6 
8  return *m_algo_value;
9 }
10 
11 inline Env::Env(Env&& other):
12  m_root(std::move(other.m_root)),
13  m_node(other.m_node) {}
14 
15 inline Env::Env(std::shared_ptr<EnvRoot> root,
16  const AlgorithmValue& node):
17  m_root(root),
18  m_node(node) {}
19 
20 inline Env::~Env() = default;
21 
22 inline const AlgorithmValue& Env::algo() const {
23  return m_node;
24 }
25 
26 inline const std::shared_ptr<EnvRoot>& Env::root() const {
27  return m_root;
28 }
29 
30 inline void Env::error(const std::string& msg) const {
31  throw std::runtime_error(msg);
32 }
33 
34 inline Env Env::env_for_option(const std::string& option) const {
35  CHECK(algo().arguments().count(option) > 0)
36  << "env_for_option(): There is no option '"
37  << option
38  << "'";
39  auto& a = algo().arguments().at(option).as_algorithm();
40 
41  return Env(m_root, a);
42 }
43 
44 inline const OptionValue& Env::option(const std::string& option) const {
45  return algo().arguments().at(option);
46 }
47 
48 }
49 
const std::shared_ptr< EnvRoot > & root() const
Definition: Env.hpp:26
Contains the text compression and encoding framework.
Definition: namespaces.hpp:11
Env env_for_option(const std::string &option) const
Create the environment for a sub algorithm option.
Definition: Env.hpp:34
const OptionValue & option(const std::string &option) const
Get an option of this algorithm.
Definition: Env.hpp:44
void error(const std::string &msg) const
Log an error and end the current operation.
Definition: Env.hpp:30
const ArgumentMap & arguments() const
AlgorithmValue & algo_value()
Definition: Env.hpp:7
Env()=delete
Local environment for a compression/encoding/decompression call.