CatapultServer  v0.5.0.1 (Elephant)
CacheSerializerAdapter.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "StateVersion.h"
26 
27 namespace catapult { namespace cache {
28 
30  template<typename TSerializerTraits, typename TDescriptor = TSerializerTraits>
32  public:
33  using KeyType = typename TDescriptor::KeyType;
34  using ValueType = typename TDescriptor::ValueType;
35 
36  public:
38  static std::string SerializeValue(const ValueType& value) {
41  TSerializerTraits::Save(value, calculator);
42 
45  TSerializerTraits::Save(value, output);
46  return output.str();
47  }
48 
50  static ValueType DeserializeValue(const RawBuffer& buffer) {
53  return TSerializerTraits::Load(input);
54  }
55  };
56 }}
StateVersion.h
catapult::observers::calculator
uint8_t const model::InflationCalculator & calculator
Definition: HarvestFeeObserver.cpp:65
catapult::cache::CacheSerializerAdapter< state::SecretLockInfoSerializer, SecretLockInfoCacheDescriptor >::ValueType
typename SecretLockInfoCacheDescriptor ::ValueType ValueType
Definition: CacheSerializerAdapter.h:34
SizeCalculatingOutputStream.h
catapult::cache::StateVersion::ReadAndCheck
static void ReadAndCheck(io::InputStream &input)
Reads state version from input and verifies it.
Definition: StateVersion.h:37
catapult::cache::StateVersion::Write
static void Write(io::OutputStream &output)
Writes state version to output.
Definition: StateVersion.h:32
catapult::cache::CacheSerializerAdapter
Cache serializer adapter.
Definition: CacheSerializerAdapter.h:31
catapult::io::BufferInputStreamAdapter
Adapt a typed buffer to be used as an input stream.
Definition: BufferInputStreamAdapter.h:30
StringOutputStream.h
catapult::io::SizeCalculatingOutputStream
Stream implementation for calculating the stream size.
Definition: SizeCalculatingOutputStream.h:27
catapult::cache::CacheSerializerAdapter::DeserializeValue
static ValueType DeserializeValue(const RawBuffer &buffer)
Deserializes value from buffer.
Definition: CacheSerializerAdapter.h:50
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::io::StringOutputStream
String output stream.
Definition: StringOutputStream.h:27
catapult::cache::CacheSerializerAdapter::SerializeValue
static std::string SerializeValue(const ValueType &value)
Serializes value to string.
Definition: CacheSerializerAdapter.h:38
catapult::model::InflationCalculator::size
size_t size() const
Gets the number of inflation entries.
Definition: InflationCalculator.cpp:26
catapult::cache::CacheSerializerAdapter< state::SecretLockInfoSerializer, SecretLockInfoCacheDescriptor >::KeyType
typename SecretLockInfoCacheDescriptor ::KeyType KeyType
Definition: CacheSerializerAdapter.h:33
BufferInputStreamAdapter.h
catapult::utils::RawBuffer
BasicRawBuffer< const uint8_t > RawBuffer
A const binary buffer.
Definition: RawBuffer.h:62