CatapultServer  v0.5.0.1 (Elephant)
ReadOnlyCatapultCache.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <vector>
23 
24 namespace catapult { namespace cache {
25 
28  public:
30  explicit ReadOnlyCatapultCache(const std::vector<const void*>& readOnlyViews);
31 
32  public:
34  template<typename TCache>
35  const typename TCache::CacheReadOnlyType& sub() const {
36  return *static_cast<const typename TCache::CacheReadOnlyType*>(m_readOnlyViews[TCache::Id]);
37  }
38 
39  private:
40  std::vector<const void*> m_readOnlyViews;
41  };
42 }}
catapult::cache::ReadOnlyCatapultCache::ReadOnlyCatapultCache
ReadOnlyCatapultCache(const std::vector< const void * > &readOnlyViews)
Creates a read-only overlay on top of readOnlyViews.
Definition: ReadOnlyCatapultCache.cpp:26
catapult::cache::ReadOnlyCatapultCache::sub
const TCache::CacheReadOnlyType & sub() const
Gets a specific sub cache read-only view.
Definition: ReadOnlyCatapultCache.h:35
Id
NamespaceId Id
Definition: RootNamespaceHistorySerializer.cpp:100
catapult::validators::CacheReadOnlyType
typename cache::AccountRestrictionCacheTypes::CacheReadOnlyType CacheReadOnlyType
Definition: AddressInteractionValidator.cpp:30
CatapultCache.h
catapult::cache::ReadOnlyCatapultCache::m_readOnlyViews
std::vector< const void * > m_readOnlyViews
Definition: ReadOnlyCatapultCache.h:40
ReadOnlyCatapultCache.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::cache::ReadOnlyCatapultCache
A read-only overlay on top of a catapult cache.
Definition: ReadOnlyCatapultCache.h:27