CatapultServer  v0.5.0.1 (Elephant)
ReadOnlyViewSupplier.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <utility>
23 
24 namespace catapult { namespace cache {
25 
27  template<typename TView>
28  class ReadOnlyViewSupplier : public TView {
29  public:
31  template<typename... TArgs>
32  ReadOnlyViewSupplier(TArgs&&... args)
33  : TView(std::forward<TArgs>(args)...)
34  , m_readOnlyView(*this)
35  {}
36 
40  : TView(std::move(rhs))
41  , m_readOnlyView(*this)
42  {}
43 
44  public:
46  const typename TView::ReadOnlyView& asReadOnly() const {
47  return m_readOnlyView;
48  }
49 
50  private:
51  typename TView::ReadOnlyView m_readOnlyView;
52  };
53 }}
catapult::cache::ReadOnlyViewSupplier
Decorates a view and supplies a read-only view.
Definition: ReadOnlyViewSupplier.h:28
catapult::cache::ReadOnlyViewSupplier::ReadOnlyViewSupplier
ReadOnlyViewSupplier(ReadOnlyViewSupplier &&rhs)
Definition: ReadOnlyViewSupplier.h:39
catapult::cache::ReadOnlyViewSupplier::m_readOnlyView
TView::ReadOnlyView m_readOnlyView
Definition: ReadOnlyViewSupplier.h:51
catapult::cache::ReadOnlyViewSupplier::asReadOnly
const TView::ReadOnlyView & asReadOnly() const
Returns a read-only view of this view.
Definition: ReadOnlyViewSupplier.h:46
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::cache::ReadOnlyViewSupplier::ReadOnlyViewSupplier
ReadOnlyViewSupplier(TArgs &&... args)
Creates a read-only view supplier around args.
Definition: ReadOnlyViewSupplier.h:32