CatapultServer  v0.5.0.1 (Elephant)
AccountStateSerializer.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "AccountState.h"
23 #include "catapult/io/Stream.h"
24 #include <vector>
25 
26 namespace catapult { namespace state {
27 
31  static constexpr uint16_t State_Version = 1;
32 
34  static void Save(const AccountState& accountState, io::OutputStream& output);
35 
37  static AccountState Load(io::InputStream& input);
38  };
39 
43  static constexpr uint16_t State_Version = 1;
44 
46  static void Save(const AccountState& accountState, io::OutputStream& output);
47 
49  static AccountState Load(io::InputStream& input);
50  };
51 }}
catapult::state::AccountBalances::optimizedMosaicId
MosaicId optimizedMosaicId() const
Gets the optimized mosaic id.
Definition: AccountBalances.cpp:50
MemoryUtils.h
catapult::state::AccountState::PublicKey
Key PublicKey
Public key of an account. Present if PublicKeyHeight > 0.
Definition: AccountState.h:64
catapult::model::ImportanceHeight
utils::BaseValue< Height::ValueType, ImportanceHeight_tag > ImportanceHeight
Represents a height at which importance is calculated.
Definition: ImportanceHeight.h:29
catapult::state::AccountStateSerializer::Save
static void Save(const AccountState &accountState, io::OutputStream &output)
Saves accountState to output.
Definition: AccountStateSerializer.cpp:222
catapult::state::AccountStateSerializer
Policy for saving and loading account state data.
Definition: AccountStateSerializer.h:41
catapult::io::Write16
void Write16(TIo &output, uint16_t value)
Writes value into output.
Definition: PodIoUtils.h:48
catapult::io::Write8
void Write8(TIo &output, uint8_t value)
Writes value into output.
Definition: PodIoUtils.h:54
catapult::state::AccountState
Account state data.
Definition: AccountState.h:44
catapult::state::AccountState::PublicKeyHeight
Height PublicKeyHeight
Height at which public key has been obtained.
Definition: AccountState.h:67
catapult::state::AccountState::AccountType
state::AccountType AccountType
Type of account.
Definition: AccountState.h:70
catapult::state::AccountState::ActivityBuckets
AccountActivityBuckets ActivityBuckets
Activity buckets of the account.
Definition: AccountState.h:79
catapult::utils::to_underlying_type
constexpr std::underlying_type_t< TEnum > to_underlying_type(TEnum value)
Converts a strongly typed enumeration value to its underlying integral value.
Definition: Casting.h:37
catapult::state::AccountStateSerializer::Load
static AccountState Load(io::InputStream &input)
Loads a single value from input.
Definition: AccountStateSerializer.cpp:236
catapult::io::Read32
auto Read32(TIo &input)
Reads value from input.
Definition: PodIoUtils.h:74
m_bucketsIndex
size_t m_bucketsIndex
Definition: AccountStateSerializer.cpp:98
catapult::utils::BaseValue
Immutable wrapper for basic types, to provide some type-safety.
Definition: BaseValue.h:100
catapult::io::OutputStream::write
virtual void write(const RawBuffer &buffer)=0
catapult::state::AccountStateNonHistoricalSerializer::Load
static AccountState Load(io::InputStream &input)
Loads a single value from input.
Definition: AccountStateSerializer.cpp:210
catapult::state::AccountStateNonHistoricalSerializer
Policy for saving and loading account state data without historical information.
Definition: AccountStateSerializer.h:29
catapult::state::AccountState::Address
catapult::Address Address
Address of an account.
Definition: AccountState.h:58
catapult::io::InputStream
Reader interface.
Definition: Stream.h:27
catapult::io::Read8
auto Read8(TIo &input)
Reads value from input.
Definition: PodIoUtils.h:90
catapult::state::AccountImportanceSnapshots::current
Importance current() const
Gets the current importance of the account.
Definition: AccountImportanceSnapshots.cpp:26
m_buckets
std::array< AccountActivityBuckets::ActivityBucket, Activity_Bucket_History_Size > m_buckets
Definition: AccountStateSerializer.cpp:99
catapult::state::AccountState::LinkedAccountKey
Key LinkedAccountKey
Public key of linked account.
Definition: AccountState.h:73
catapult::state::AccountStateNonHistoricalSerializer::Save
static void Save(const AccountState &accountState, io::OutputStream &output)
Saves accountState to output.
Definition: AccountStateSerializer.cpp:144
m_snapshots
std::array< AccountImportanceSnapshots::ImportanceSnapshot, Importance_History_Size > m_snapshots
Definition: AccountStateSerializer.cpp:97
catapult::Rollback_Buffer_Size
constexpr size_t Rollback_Buffer_Size
Number of buffer values required to guarantee deterministic rollbacks.
Definition: src/catapult/constants.h:27
catapult::io::Write
void Write(TIo &output, const utils::BasicBaseValue< TValue, TTag, TBaseValue > &value)
Writes base value into output.
Definition: PodIoUtils.h:30
CATAPULT_THROW_INVALID_ARGUMENT_1
#define CATAPULT_THROW_INVALID_ARGUMENT_1(MESSAGE, PARAM1)
Macro used to throw a catapult invalid argument with a single parameter.
Definition: exceptions.h:183
catapult::action
std::function< void()> action
An action function.
Definition: functions.h:27
catapult::io::Write64
void Write64(TIo &output, uint64_t value)
Writes value into output.
Definition: PodIoUtils.h:36
catapult::Importance_History_Size
constexpr size_t Importance_History_Size
Number of historical importances associated with a single account.
Definition: src/catapult/constants.h:30
catapult::state::AccountBalances::size
size_t size() const
Returns the number of mosaics owned.
Definition: AccountBalances.h:51
catapult::io::Read16
auto Read16(TIo &input)
Reads value from input.
Definition: PodIoUtils.h:82
AccountState.h
catapult::io::InputStream::read
virtual void read(const MutableRawBuffer &buffer)=0
catapult::state::AccountState::Balances
AccountBalances Balances
Balances of an account.
Definition: AccountState.h:82
Casting.h
catapult::Activity_Bucket_History_Size
constexpr size_t Activity_Bucket_History_Size
Definition: src/catapult/constants.h:34
catapult::state::@1330::AccountStateFormat
AccountStateFormat
Definition: AccountStateSerializer.cpp:31
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::io::Read64
auto Read64(TIo &input)
Reads value from input.
Definition: PodIoUtils.h:66
PodIoUtils.h
catapult::io::Write32
void Write32(TIo &output, uint32_t value)
Writes value into output.
Definition: PodIoUtils.h:42
catapult::utils::ByteArray< Address_Decoded_Size, Address_tag >
catapult::state::AccountStateNonHistoricalSerializer::State_Version
static constexpr uint16_t State_Version
Serialized state version.
Definition: AccountStateSerializer.h:31
Stream.h
AccountStateSerializer.h
catapult::state::AccountState::AddressHeight
Height AddressHeight
Height at which address has been obtained.
Definition: AccountState.h:61
catapult::state::AccountState::ImportanceSnapshots
AccountImportanceSnapshots ImportanceSnapshots
Importance snapshots of the account.
Definition: AccountState.h:76
catapult::io::OutputStream
Writer interface.
Definition: Stream.h:41
catapult::state::AccountStateSerializer::State_Version
static constexpr uint16_t State_Version
Serialized state version.
Definition: AccountStateSerializer.h:43
m_snapshotsIndex
size_t m_snapshotsIndex
Definition: AccountStateSerializer.cpp:96