tudocomp
– The TU Dortmund Compression Framework
InputView.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace tdc {namespace io {
5  class InputViewInternal {
6  InputAllocChunkHandle m_handle;
7 
8  friend class InputView;
9  friend class Input;
10 
11  inline InputViewInternal(const InputViewInternal& other) = delete;
12  inline InputViewInternal() = delete;
13 
14  inline InputViewInternal(InputViewInternal&& s):
15  m_handle(std::move(s.m_handle)) {}
16 
17  inline InputViewInternal(const InputAllocChunkHandle& handle):
18  m_handle(handle) {}
19 
20  inline ~InputViewInternal() {
21  unregister_alloc_chunk_handle(m_handle);
22  }
23  };
25 
29  class InputView: InputViewInternal, public View {
30  friend class Input;
31 
32  inline InputView(InputViewInternal&& mem):
33  InputViewInternal(std::move(mem)),
34  View(m_handle->view()) {}
35  public:
37  inline InputView(InputView&& mem):
38  InputViewInternal(std::move(mem)),
39  View(std::move(mem)) {}
40 
42  inline InputView(const InputView& other) = delete;
43 
45  inline InputView() = delete;
46  };
47 
48  inline InputView Input::Variant::as_view() const {
49  return InputView {
50  alloc().find_or_construct(source(), from(), to(), restrictions())
51  };
52  }
53 
54  inline std::ostream& operator<<(std::ostream& o, const InputView& iv) {
55  return o << (static_cast<const View&>(iv));
56  }
57 
58 }}
Contains the text compression and encoding framework.
Definition: namespaces.hpp:11
io::Input Input
Convenience shortcut to io::Input.
Definition: io.hpp:17
A const view into a slice of memory.
std::ostream & operator<<(std::ostream &o, const InputRestrictions &v)
InputView(InputView &&mem)
Move constructor.
Definition: InputView.hpp:37
Provides a view on the input that allows for random access.
Definition: InputView.hpp:29
An abstraction layer for algorithm input.
Definition: Input.hpp:37