CatapultServer
v0.5.0.1 (Elephant)
|
Namespaces | |
detail | |
log | |
traits | |
Classes | |
struct | ArrayHasher |
struct | ArrayPointerEquality |
Functor for comparing two array pointers. More... | |
struct | ArrayPointerHasher |
Functor for hashing an array pointer. More... | |
class | AtomicIncrementDecrementGuard |
RAII class that increments an atomic on construction and decrements it on destruction. More... | |
class | BaseValue |
Immutable wrapper for basic types, to provide some type-safety. More... | |
struct | BaseValueHasher |
Hasher object for a base value. More... | |
class | BasicBaseValue |
Base class for immutable wrappers of basic types, to provide some type-safety. More... | |
struct | BasicLoggerOptions |
Basic logger options. More... | |
class | BasicRawBuffer |
Basic raw buffer that is composed of a pointer and a size. More... | |
class | BasicSpinReaderWriterLock |
class | BlockSpan |
Represents a block duration. More... | |
class | ByteArray |
Base class for wrappers of byte array types, to provide some type-safety. More... | |
class | CheckedArray |
An array that checks for overflow. More... | |
class | CircularBuffer |
A fixed size circular buffer. More... | |
struct | ClampedBaseValue |
Base values that are constrained to a range of values. More... | |
class | ConfigurationBag |
A simple bag of properties. More... | |
struct | ConfigurationKey |
A configuration key. More... | |
class | ContainerHexFormatter |
Formatter for printing a container of integral hex numbers to a stream. More... | |
class | DiagnosticCounter |
A diagnostic counter. More... | |
class | DiagnosticCounterId |
A diagnostic counter id. More... | |
struct | FileLoggerOptions |
File logger options. More... | |
class | FileSize |
Represents a file size. More... | |
class | IdentifierGroup |
A group of identifiers that share a common (external) attribute. More... | |
class | ImmutableValue |
A move-only value wrapper. More... | |
class | IntegralHexFormatter |
Formatter for printing an integral hex number to a stream. More... | |
class | IntegralHexFormatterGuard |
struct | LogFilter |
Filter used for filtering logs by level and/or component. More... | |
class | LoggingBootstrapper |
Bootstraps boost logging. More... | |
class | ModificationSafeIterableContainer |
Wraps a container type and provides modification-safe iteration support. More... | |
class | MoveOnly |
A class that can be moved but not copied. More... | |
class | MutableRawString |
A mutable string buffer. More... | |
class | NamedObjectMixin |
Mixin to have named objects. More... | |
class | NonCopyable |
A class that can neither be copied nor moved. More... | |
struct | NoOpReaderNotificationPolicy |
A no-op reader notification policy. More... | |
class | property_malformed_error |
Exception class that is thrown when a configuration property is malformed. More... | |
class | property_not_found_error |
Exception class that is thrown when a required configuration property is missing. More... | |
class | RawString |
A const string buffer. More... | |
class | reader_reentrancy_error |
Exception class that is thrown when reader reentrancy is detected. More... | |
class | ReentrancyCheckReaderNotificationPolicy |
A reentrancy check reader notification policy. More... | |
class | ResettableWrappedWithOwnerDecorator |
struct | ShortHash_tag |
struct | ShortHashHasher |
class | SlowOperationLogger |
Simple RAII class that logs slow operation messages. More... | |
class | SpinLock |
class | StackLogger |
Simple RAII class that logs scope messages. More... | |
class | StackTimer |
Stack based timer. More... | |
class | StreamFormatGuard |
class | ThrottleLogger |
class | TimeSpan |
Represents a time duration. More... | |
class | WeakContainer |
A container of weak_ptr<T> pointing to closable items. More... | |
class | WrappedWithOwnerDecorator |
Typedefs | |
template<typename TArray > | |
using | ArraySet = std::unordered_set< TArray, ArrayHasher< TArray > > |
A set of arrays. More... | |
template<typename TArray > | |
using | ArrayPointerSet = std::unordered_set< const TArray *, ArrayPointerHasher< TArray >, ArrayPointerEquality< TArray > > |
A set of array pointers. More... | |
template<typename TArray > | |
using | ArrayPointerFlagMap = std::unordered_map< const TArray *, bool, ArrayPointerHasher< TArray >, ArrayPointerEquality< TArray > > |
A map of array pointers to flags. More... | |
using | HashSet = ArraySet< Hash256 > |
A hash set. More... | |
using | KeySet = ArraySet< Key > |
A key set. More... | |
using | SortedKeySet = std::set< Key > |
A sorted key set. More... | |
using | HashPointerSet = ArrayPointerSet< Hash256 > |
A hash pointer set. More... | |
using | KeyPointerSet = ArrayPointerSet< Key > |
A key pointer set. More... | |
using | RawBuffer = BasicRawBuffer< const uint8_t > |
A const binary buffer. More... | |
using | MutableRawBuffer = BasicRawBuffer< uint8_t > |
A mutable binary buffer. More... | |
using | ShortHash = BaseValue< uint32_t, ShortHash_tag > |
using | ShortHashesSet = std::unordered_set< ShortHash, ShortHashHasher > |
using | SpinLockGuard = std::lock_guard< SpinLock > |
A spin lock guard. More... | |
using | DefaultReaderNotificationPolicy = NoOpReaderNotificationPolicy |
using | SpinReaderWriterLock = BasicSpinReaderWriterLock< DefaultReaderNotificationPolicy > |
A default reader writer lock. More... | |
Enumerations | |
enum | LogLevel { LogLevel::Trace = boost::log::trivial::trace, LogLevel::Debug = boost::log::trivial::debug, LogLevel::Info = boost::log::trivial::info, LogLevel::Warning = boost::log::trivial::warning, LogLevel::Error = boost::log::trivial::error, LogLevel::Fatal = boost::log::trivial::fatal, LogLevel::Min = Trace, LogLevel::Max = Fatal } |
Catapult log levels. More... | |
enum | LogSinkType { LogSinkType::Sync, LogSinkType::Async } |
Catapult log sink types. More... | |
enum | LogColorMode { LogColorMode::Ansi, LogColorMode::AnsiBold, LogColorMode::None } |
Catapult (console) log color modes. More... | |
Functions | |
template<typename T > | |
AtomicIncrementDecrementGuard< T > | MakeIncrementDecrementGuard (std::atomic< T > &value) |
Factory function for creating AtomicIncrementDecrementGuard<T>. More... | |
bool | TryBase32Encode (const RawBuffer &data, const MutableRawString &encodedData) |
void | Base32Encode (const RawBuffer &data, const MutableRawString &encodedData) |
std::string | Base32Encode (const RawBuffer &data) |
Encodes an array of bytes pointed to by data. The size must be a multiple of 5. More... | |
bool | TryBase32Decode (const RawString &encodedData, const MutableRawBuffer &data) |
void | Base32Decode (const RawString &encodedData, const MutableRawBuffer &data) |
constexpr size_t | GetEncodedDataSize (size_t decodedSize) |
Gets the encoded size of decoded data with size decodedSize. More... | |
constexpr size_t | GetDecodedDataSize (size_t encodedSize) |
Gets the decoded size of encoded data with size encodedSize. More... | |
template<size_t N> | |
std::array< uint8_t, N > | Base32Decode (const RawString &encodedData) |
Decodes a base32 encoded string pointed to by encodedData. The string length must be a multiple of 8. More... | |
std::ostream & | operator<< (std::ostream &out, const BlockSpan &blockSpan) |
Insertion operator for outputting blockSpan to out. More... | |
template<size_t N, typename TTag > | |
constexpr void | HexFormat (const ByteArray< N, TTag > &) |
template<typename T > | |
constexpr const T & | as_const (T &ref) |
Coerces a reference (ref) to a const reference. More... | |
template<typename TEnum > | |
constexpr std::underlying_type_t< TEnum > | to_underlying_type (TEnum value) |
Converts a strongly typed enumeration value to its underlying integral value. More... | |
template<typename TSource , typename TDest > | |
TDest | checked_cast (TSource value) |
std::string | GetIniPropertyName (const char *cppVariableName) |
Gets the ini property name corresponding to the cpp variable name (cppVariableName). More... | |
void | VerifyBagSizeLte (const ConfigurationBag &bag, size_t expectedSize) |
Verifies that the number of properties in bag is no greater than expectedSize. More... | |
ConfigurationBag | ExtractSectionAsBag (const ConfigurationBag &bag, const char *section) |
Extracts all section properties from bag into a new bag with a single section with a default (empty string) name. More... | |
std::pair< std::unordered_set< std::string >, size_t > | ExtractSectionAsUnorderedSet (const ConfigurationBag &bag, const char *section) |
std::pair< std::vector< std::string >, size_t > | ExtractSectionAsOrderedVector (const ConfigurationBag &bag, const char *section) |
template<typename T > | |
void | LoadIniProperty (const ConfigurationBag &bag, const char *section, const char *cppVariableName, T &value) |
bool | TryParseValue (const std::string &str, LogLevel &parsedValue) |
Tries to parse str into a log level (parsedValue). More... | |
bool | TryParseValue (const std::string &str, LogSinkType &parsedValue) |
Tries to parse str into a log sink type (parsedValue). More... | |
bool | TryParseValue (const std::string &str, LogColorMode &parsedValue) |
Tries to parse str into a log color mode (parsedValue). More... | |
bool | TryParseValue (const std::string &str, bool &parsedValue) |
Tries to parse str into a boolean (parsedValue). More... | |
bool | TryParseValue (const std::string &str, uint8_t &parsedValue) |
Tries to parse str into a uint8_t (parsedValue). More... | |
bool | TryParseValue (const std::string &str, uint16_t &parsedValue) |
Tries to parse str into a uint16_t (parsedValue). More... | |
bool | TryParseValue (const std::string &str, uint32_t &parsedValue) |
Tries to parse str into a uint32_t (parsedValue). More... | |
bool | TryParseValue (const std::string &str, uint64_t &parsedValue) |
Tries to parse str into a uint64_t (parsedValue). More... | |
bool | TryParseValue (const std::string &str, Amount &parsedValue) |
Tries to parse str into an Amount (parsedValue). More... | |
bool | TryParseValue (const std::string &str, BlockFeeMultiplier &parsedValue) |
Tries to parse str into a BlockFeeMultiplier (parsedValue). More... | |
bool | TryParseValue (const std::string &str, Height &parsedValue) |
Tries to parse str into a Height (parsedValue). More... | |
bool | TryParseValue (const std::string &str, Importance &parsedValue) |
Tries to parse str into an Importance (parsedValue). More... | |
bool | TryParseValue (const std::string &str, MosaicId &parsedValue) |
Tries to parse str into a MosaicId (parsedValue). More... | |
bool | TryParseValue (const std::string &str, TimeSpan &parsedValue) |
Tries to parse str into a TimeSpan (parsedValue). More... | |
bool | TryParseValue (const std::string &str, BlockSpan &parsedValue) |
Tries to parse str into a BlockSpan (parsedValue). More... | |
bool | TryParseValue (const std::string &str, FileSize &parsedValue) |
Tries to parse str into a FileSize (parsedValue). More... | |
bool | TryParseValue (const std::string &str, Key &parsedValue) |
Tries to parse str into a Key (parsedValue). More... | |
bool | TryParseValue (const std::string &str, Hash256 &parsedValue) |
Tries to parse str into a Hash256 (parsedValue). More... | |
bool | TryParseValue (const std::string &str, GenerationHash &parsedValue) |
Tries to parse str into a GenerationHash (parsedValue). More... | |
bool | TryParseValue (const std::string &str, std::string &parsedValue) |
bool | TryParseValue (const std::string &str, std::unordered_set< std::string > &parsedValue) |
template<typename T , size_t N> | |
bool | TryParseEnumValue (const std::array< std::pair< const char *, T >, N > &stringToValueMapping, const std::string &str, T &parsedValue) |
Tries to parse str into an enum value (parsedValue) given a mapping of strings to values (stringToValueMapping). More... | |
template<typename T , size_t N> | |
bool | TryParseBitwiseEnumValue (const std::array< std::pair< const char *, T >, N > &stringToValueMapping, const std::string &str, T &parsedValues) |
Tries to parse str into a bitwise enum value (parsedValue) given a mapping of strings to values (stringToValueMapping). More... | |
template<typename TMap , typename TPredicate > | |
void | map_erase_if (TMap &map, TPredicate predicate) |
Removes all entries from map that fulfill the given predicate. More... | |
std::ostream & | operator<< (std::ostream &out, const FileSize &fileSize) |
Insertion operator for outputting fileSize to out. More... | |
template<typename TContainer , typename TInitial , typename TFunction > | |
auto | Reduce (const TContainer &container, TInitial initialValue, TFunction fun) |
template<typename TContainer , typename TFunction > | |
auto | Sum (const TContainer &container, TFunction accessor) |
template<typename TInputIterator > | |
auto | HexFormat (TInputIterator begin, TInputIterator end, char separator=0) |
Factory function for creating a hex formatter around iterators begin and end with separator. More... | |
template<typename TContainer > | |
auto | HexFormat (const TContainer &container, char separator) |
Factory function for creating a hex formatter around container with separator. More... | |
template<typename T > | |
auto | HexFormat (const T &data) |
Factory function for creating a hex formatter around data. More... | |
template<typename T > | |
auto | HexFormat (const std::vector< T > &container) |
Factory function for creating a hex formatter around container. More... | |
template<typename T , size_t N> | |
auto | HexFormat (const std::array< T, N > &container) |
Factory function for creating a hex formatter around container. More... | |
uint8_t | ParseByte (char ch1, char ch2) |
Parses two characters (ch1 and ch2) into a byte. More... | |
bool | TryParseByte (char ch1, char ch2, uint8_t &by) |
Tries to parse two characters (ch1 and ch2) into a byte (by). More... | |
template<typename TContainer > | |
bool | TryParseHexStringIntoContainer (const char *const pHexData, size_t dataSize, TContainer &outputContainer) |
Tries to parse a hex string (pHexData with size dataSize) into outputContainer. More... | |
template<typename TContainer > | |
void | ParseHexStringIntoContainer (const char *const pHexData, size_t dataSize, TContainer &outputContainer) |
Parses a hex string (pHexData with size dataSize) into outputContainer. More... | |
template<typename TByteArray > | |
TByteArray | ParseByteArray (const std::string &hexString) |
Parses a hex string (hexString) into a byte array. More... | |
uint64_t | Log2TimesPowerOfTwo (uint64_t value, uint64_t n) |
Calculates log2(value^(2^n)). More... | |
template<typename T > | |
bool | CheckedAdd (T &value, T delta) |
Adds delta to value if and only if there is no overflow. More... | |
template<typename T , typename X = std::enable_if_t<std::is_integral_v<T>>> | |
constexpr T | GetNumBits () |
Gets the number of bits in the specified type. More... | |
template<typename T , typename X = std::enable_if_t<std::is_unsigned_v<T>>> | |
constexpr T | Log2 (T value) |
Calculates log2(value). More... | |
template<typename T , typename X = std::enable_if_t<std::is_unsigned_v<T>>> | |
constexpr T | Pow2 (T value) |
Calculates 2^(value). More... | |
template<typename T , typename X = std::enable_if_t<std::is_unsigned_v<T>>> | |
constexpr T | DivideAndGetRemainder (T &value, T divisor) |
Divides value by divisor and returns the remainder. More... | |
template<typename T , typename X = std::enable_if_t<std::is_unsigned_v<T>>> | |
constexpr bool | IsPowerMultiple (T lhs, T rhs, T base) |
Returns true if rhs is equal to lhs multipled by a power of base. More... | |
void | CatapultLogFlush () |
template<typename T > | |
std::unique_ptr< T > | MakeUniqueWithSize (size_t size) |
Creates a unique pointer of the specified type with custom size. More... | |
template<typename T > | |
std::shared_ptr< T > | MakeSharedWithSize (size_t size) |
Creates a shared pointer of the specified type with custom size. More... | |
template<typename T > | |
std::shared_ptr< T > | UniqueToShared (std::unique_ptr< T > &&pointer) |
Converts a unique pointer to a shared pointer of the same type. More... | |
template<typename TNamedObjects > | |
std::vector< std::string > | ExtractNames (const TNamedObjects &namedObjects) |
Extracts all names from namedObjects. More... | |
std::string | ReduceNames (const std::vector< std::string > &names) |
Reduces names into a single string. More... | |
Timestamp | NetworkTime () |
Returns the network time, i.e. the number of milliseconds since Epoch_Time. More... | |
Timestamp | ToNetworkTime (const Timestamp ×tamp) |
Timestamp | ToUnixTime (const Timestamp ×tamp) |
constexpr bool | IsDirectorySeparator (char ch) |
Gets a value indicating whether or not ch is a directory separator. More... | |
constexpr const char * | AdvanceToEnd (const char *str) |
Advances str to its end (the NUL terminator). More... | |
constexpr const char * | ExtractFilename (const char *fullPath) |
constexpr const char * | ExtractDirectoryAndFilename (const char *fullPath) |
constexpr RawString | ExtractDirectoryName (const char *fullPath) |
template<typename T , typename X = std::enable_if_t<std::is_same_v<char, typename std::remove_const_t<T>>>> | |
std::ostream & | operator<< (std::ostream &out, const BasicRawBuffer< T > &str) |
Insertion operator for outputting str to out. More... | |
ShortHash | ToShortHash (const Hash256 &hash) |
Gets the short hash corresponding to hash. More... | |
std::ostream & | operator<< (std::ostream &out, const TimeSpan &timeSpan) |
Insertion operator for outputting timeSpan to out. More... | |
constexpr Timestamp | operator+ (const Timestamp ×tamp, const TimeSpan &timeSpan) |
Adds timestamp and a timeSpan resulting in new timestamp. More... | |
constexpr Timestamp | SubtractNonNegative (const Timestamp ×tamp, const TimeSpan &timeSpan) |
Subtracts timeSpan from timestamp and returns the maximum of the difference and zero. More... | |
Variables | |
const uint32_t | Base32_Decoded_Block_Size = 5 |
const uint32_t | Base32_Encoded_Block_Size = 8 |
constexpr auto | Epoch_Time = std::chrono::duration<int64_t, std::milli>(1459468800000) |
Represents the number of milliseconds between 1970-01-01 00:00:00 UTC and 2016-04-01 00:00:00 UTC. More... | |
using catapult::utils::ArrayPointerFlagMap = typedef std::unordered_map<const TArray*, bool, ArrayPointerHasher<TArray>, ArrayPointerEquality<TArray> > |
A map of array pointers to flags.
using catapult::utils::ArrayPointerSet = typedef std::unordered_set<const TArray*, ArrayPointerHasher<TArray>, ArrayPointerEquality<TArray> > |
A set of array pointers.
using catapult::utils::ArraySet = typedef std::unordered_set<TArray, ArrayHasher<TArray> > |
A set of arrays.
using catapult::utils::HashPointerSet = typedef ArrayPointerSet<Hash256> |
A hash pointer set.
using catapult::utils::HashSet = typedef ArraySet<Hash256> |
A hash set.
using catapult::utils::KeyPointerSet = typedef ArrayPointerSet<Key> |
A key pointer set.
using catapult::utils::KeySet = typedef ArraySet<Key> |
A key set.
using catapult::utils::MutableRawBuffer = typedef BasicRawBuffer<uint8_t> |
A mutable binary buffer.
using catapult::utils::RawBuffer = typedef BasicRawBuffer<const uint8_t> |
A const binary buffer.
using catapult::utils::ShortHash = typedef BaseValue<uint32_t, ShortHash_tag> |
using catapult::utils::ShortHashesSet = typedef std::unordered_set<ShortHash, ShortHashHasher> |
using catapult::utils::SortedKeySet = typedef std::set<Key> |
A sorted key set.
using catapult::utils::SpinLockGuard = typedef std::lock_guard<SpinLock> |
A spin lock guard.
using catapult::utils::SpinReaderWriterLock = typedef BasicSpinReaderWriterLock<DefaultReaderNotificationPolicy> |
A default reader writer lock.
|
strong |
|
strong |
Catapult log levels.
|
strong |
|
constexpr |
Advances str to its end (the NUL
terminator).
|
constexpr |
Coerces a reference (ref) to a const reference.
std::array<uint8_t, N> catapult::utils::Base32Decode | ( | const RawString & | encodedData | ) |
Decodes a base32 encoded string pointed to by encodedData. The string length must be a multiple of 8.
void catapult::utils::Base32Decode | ( | const RawString & | encodedData, |
const MutableRawBuffer & | data | ||
) |
Decodes a base32 encoded string pointed to by encodedData into data.
std::string catapult::utils::Base32Encode | ( | const RawBuffer & | data | ) |
Encodes an array of bytes pointed to by data. The size must be a multiple of 5.
void catapult::utils::Base32Encode | ( | const RawBuffer & | data, |
const MutableRawString & | encodedData | ||
) |
Encodes an array of bytes pointed to by data into encodedData.
void catapult::utils::CatapultLogFlush | ( | ) |
Flushes all buffered log records and waits for all sinks to complete processing of them.
TDest catapult::utils::checked_cast | ( | TSource | value | ) |
Converts value from one integral type (TSource) to another (TDest). This cast can only be used when data truncation is possible. An exception is thrown if data truncation is detected.
bool catapult::utils::CheckedAdd | ( | T & | value, |
T | delta | ||
) |
Adds delta to value if and only if there is no overflow.
|
constexpr |
Divides value by divisor and returns the remainder.
|
constexpr |
Extracts the last directory and filename from fullPath. e.g. ExtractDirectoryAndFilename("cat/baz/bar/foo.cpp") == "bar/foo.cpp"
|
constexpr |
Extracts the last directory name from fullPath. e.g. ExtractLastDirectoryName("cat/baz/bar/foo.cpp") == "bar"
|
constexpr |
Extracts the filename part from fullPath. e.g. ExtractFilename("cat/bar/baz/foo.cpp") == "foo.cpp"
std::vector<std::string> catapult::utils::ExtractNames | ( | const TNamedObjects & | namedObjects | ) |
Extracts all names from namedObjects.
ConfigurationBag catapult::utils::ExtractSectionAsBag | ( | const ConfigurationBag & | bag, |
const char * | section | ||
) |
Extracts all section properties from bag into a new bag with a single section with a default (empty string) name.
std::pair< std::vector< std::string >, size_t > catapult::utils::ExtractSectionAsOrderedVector | ( | const ConfigurationBag & | bag, |
const char * | section | ||
) |
Extracts all section properties from bag into an ordered vector.
true
values will be included. std::pair< std::unordered_set< std::string >, size_t > catapult::utils::ExtractSectionAsUnorderedSet | ( | const ConfigurationBag & | bag, |
const char * | section | ||
) |
Extracts all section properties from bag into an unordered set.
true
values will be included.
|
constexpr |
Gets the decoded size of encoded data with size encodedSize.
|
constexpr |
Gets the encoded size of decoded data with size decodedSize.
std::string catapult::utils::GetIniPropertyName | ( | const char * | cppVariableName | ) |
Gets the ini property name corresponding to the cpp variable name (cppVariableName).
|
constexpr |
Gets the number of bits in the specified type.
|
constexpr |
auto catapult::utils::HexFormat | ( | const std::array< T, N > & | container | ) |
Factory function for creating a hex formatter around container.
auto catapult::utils::HexFormat | ( | const std::vector< T > & | container | ) |
Factory function for creating a hex formatter around container.
auto catapult::utils::HexFormat | ( | const T & | data | ) |
Factory function for creating a hex formatter around data.
auto catapult::utils::HexFormat | ( | const TContainer & | container, |
char | separator | ||
) |
Factory function for creating a hex formatter around container with separator.
auto catapult::utils::HexFormat | ( | TInputIterator | begin, |
TInputIterator | end, | ||
char | separator = 0 |
||
) |
Factory function for creating a hex formatter around iterators begin and end with separator.
|
constexpr |
Gets a value indicating whether or not ch is a directory separator.
|
constexpr |
Returns true
if rhs is equal to lhs multipled by a power of base.
void catapult::utils::LoadIniProperty | ( | const ConfigurationBag & | bag, |
const char * | section, | ||
const char * | cppVariableName, | ||
T & | value | ||
) |
Loads an ini property from bag into value given a section name (section) and a cpp variable name (cppVariableName).
|
constexpr |
Calculates log2(value).
uint64_t catapult::utils::Log2TimesPowerOfTwo | ( | uint64_t | value, |
uint64_t | n | ||
) |
Calculates log2(value^(2^n)).
AtomicIncrementDecrementGuard<T> catapult::utils::MakeIncrementDecrementGuard | ( | std::atomic< T > & | value | ) |
Factory function for creating AtomicIncrementDecrementGuard<T>.
std::shared_ptr<T> catapult::utils::MakeSharedWithSize | ( | size_t | size | ) |
Creates a shared pointer of the specified type with custom size.
std::unique_ptr<T> catapult::utils::MakeUniqueWithSize | ( | size_t | size | ) |
Creates a unique pointer of the specified type with custom size.
void catapult::utils::map_erase_if | ( | TMap & | map, |
TPredicate | predicate | ||
) |
Removes all entries from map that fulfill the given predicate.
Timestamp catapult::utils::NetworkTime | ( | ) |
Returns the network time, i.e. the number of milliseconds since Epoch_Time.
|
constexpr |
Adds timestamp and a timeSpan resulting in new timestamp.
std::ostream& catapult::utils::operator<< | ( | std::ostream & | out, |
const BasicRawBuffer< T > & | str | ||
) |
Insertion operator for outputting str to out.
std::ostream & catapult::utils::operator<< | ( | std::ostream & | out, |
const BlockSpan & | blockSpan | ||
) |
Insertion operator for outputting blockSpan to out.
std::ostream & catapult::utils::operator<< | ( | std::ostream & | out, |
const FileSize & | fileSize | ||
) |
Insertion operator for outputting fileSize to out.
std::ostream & catapult::utils::operator<< | ( | std::ostream & | out, |
const TimeSpan & | timeSpan | ||
) |
Insertion operator for outputting timeSpan to out.
uint8_t catapult::utils::ParseByte | ( | char | ch1, |
char | ch2 | ||
) |
Parses two characters (ch1 and ch2) into a byte.
TByteArray catapult::utils::ParseByteArray | ( | const std::string & | hexString | ) |
Parses a hex string (hexString) into a byte array.
void catapult::utils::ParseHexStringIntoContainer | ( | const char *const | pHexData, |
size_t | dataSize, | ||
TContainer & | outputContainer | ||
) |
Parses a hex string (pHexData with size dataSize) into outputContainer.
|
constexpr |
Calculates 2^(value).
auto catapult::utils::Reduce | ( | const TContainer & | container, |
TInitial | initialValue, | ||
TFunction | fun | ||
) |
Applies an accumulator function (fun) against an initial value(initialValue) and each element of container to reduce it to a single value.
|
inline |
Reduces names into a single string.
|
constexpr |
Subtracts timeSpan from timestamp and returns the maximum of the difference and zero.
auto catapult::utils::Sum | ( | const TContainer & | container, |
TFunction | accessor | ||
) |
Applies accessor on each element of container and sums resulting values.
|
constexpr |
Converts a strongly typed enumeration value to its underlying integral value.
Given a unix timestamp, returns the corresponding network timestamp that the unix timestamp represents.
Gets the short hash corresponding to hash.
Given a network timestamp, returns the corresponding unix timestamp that the network timestamp represents.
bool catapult::utils::TryBase32Decode | ( | const RawString & | encodedData, |
const MutableRawBuffer & | data | ||
) |
Tries to decode a base32 encoded string pointed to by encodedData into data.
bool catapult::utils::TryBase32Encode | ( | const RawBuffer & | data, |
const MutableRawString & | encodedData | ||
) |
Tries to encode an array of bytes pointed to by data into encodedData.
bool catapult::utils::TryParseBitwiseEnumValue | ( | const std::array< std::pair< const char *, T >, N > & | stringToValueMapping, |
const std::string & | str, | ||
T & | parsedValues | ||
) |
Tries to parse str into a bitwise enum value (parsedValue) given a mapping of strings to values (stringToValueMapping).
bool catapult::utils::TryParseByte | ( | char | ch1, |
char | ch2, | ||
uint8_t & | by | ||
) |
Tries to parse two characters (ch1 and ch2) into a byte (by).
bool catapult::utils::TryParseEnumValue | ( | const std::array< std::pair< const char *, T >, N > & | stringToValueMapping, |
const std::string & | str, | ||
T & | parsedValue | ||
) |
Tries to parse str into an enum value (parsedValue) given a mapping of strings to values (stringToValueMapping).
bool catapult::utils::TryParseHexStringIntoContainer | ( | const char *const | pHexData, |
size_t | dataSize, | ||
TContainer & | outputContainer | ||
) |
Tries to parse a hex string (pHexData with size dataSize) into outputContainer.
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
Amount & | parsedValue | ||
) |
Tries to parse str into an Amount (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
BlockFeeMultiplier & | parsedValue | ||
) |
Tries to parse str into a BlockFeeMultiplier (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
BlockSpan & | parsedValue | ||
) |
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
bool & | parsedValue | ||
) |
Tries to parse str into a boolean (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
FileSize & | parsedValue | ||
) |
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
GenerationHash & | parsedValue | ||
) |
Tries to parse str into a GenerationHash (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
Hash256 & | parsedValue | ||
) |
Tries to parse str into a Hash256 (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
Height & | parsedValue | ||
) |
Tries to parse str into a Height (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
Importance & | parsedValue | ||
) |
Tries to parse str into an Importance (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
Key & | parsedValue | ||
) |
Tries to parse str into a Key (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
LogColorMode & | parsedValue | ||
) |
Tries to parse str into a log color mode (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
LogLevel & | parsedValue | ||
) |
Tries to parse str into a log level (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
LogSinkType & | parsedValue | ||
) |
Tries to parse str into a log sink type (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
MosaicId & | parsedValue | ||
) |
Tries to parse str into a MosaicId (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
std::string & | parsedValue | ||
) |
Tries to parse str into a string (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
std::unordered_set< std::string > & | parsedValue | ||
) |
Tries to parse str into a set of strings (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
TimeSpan & | parsedValue | ||
) |
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
uint16_t & | parsedValue | ||
) |
Tries to parse str into a uint16_t (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
uint32_t & | parsedValue | ||
) |
Tries to parse str into a uint32_t (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
uint64_t & | parsedValue | ||
) |
Tries to parse str into a uint64_t (parsedValue).
bool catapult::utils::TryParseValue | ( | const std::string & | str, |
uint8_t & | parsedValue | ||
) |
Tries to parse str into a uint8_t (parsedValue).
std::shared_ptr<T> catapult::utils::UniqueToShared | ( | std::unique_ptr< T > && | pointer | ) |
Converts a unique pointer to a shared pointer of the same type.
void catapult::utils::VerifyBagSizeLte | ( | const ConfigurationBag & | bag, |
size_t | expectedSize | ||
) |
Verifies that the number of properties in bag is no greater than expectedSize.
const uint32_t catapult::utils::Base32_Decoded_Block_Size = 5 |
const uint32_t catapult::utils::Base32_Encoded_Block_Size = 8 |
|
constexpr |
Represents the number of milliseconds between 1970-01-01 00:00:00 UTC and 2016-04-01 00:00:00 UTC.