CatapultServer  v0.5.0.1 (Elephant)
NetworkInfo.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 
24 namespace catapult { namespace model {
25 
27 #define NETWORK_IDENTIFIER_LIST \
28  /* A default (zero) identifier that does not identify any known network. */ \
29  ENUM_VALUE(Zero, 0) \
30  \
31  /* Mijin network identifier. */ \
32  ENUM_VALUE(Mijin, 0x60) \
33  \
34  /* Mijin test network identifier. */ \
35  ENUM_VALUE(Mijin_Test, 0x90) \
36  \
37  /* Public main network identifier. */ \
38  ENUM_VALUE(Public, 0x68) \
39  \
40  /* Public test network identifier. */ \
41  ENUM_VALUE(Public_Test, 0x98)
42 
43 #define ENUM_VALUE(LABEL, VALUE) LABEL = VALUE,
44  enum class NetworkIdentifier : uint8_t {
47  };
48 #undef ENUM_VALUE
49 
51  std::ostream& operator<<(std::ostream& out, NetworkIdentifier value);
52 
54  struct NetworkInfo {
55  public:
57  constexpr NetworkInfo() : NetworkInfo(NetworkIdentifier::Zero, {}, {})
58  {}
59 
62  constexpr NetworkInfo(NetworkIdentifier identifier, const Key& publicKey, const catapult::GenerationHash& generationHash)
63  : Identifier(identifier)
64  , PublicKey(publicKey)
65  , GenerationHash(generationHash)
66  {}
67 
68  public:
71 
74 
77  };
78 
80  bool TryParseValue(const std::string& networkName, NetworkIdentifier& networkIdentifier);
81 }}
catapult::model::NetworkIdentifier::NETWORK_IDENTIFIER_LIST
catapult::model::NetworkInfo::NetworkInfo
constexpr NetworkInfo(NetworkIdentifier identifier, const Key &publicKey, const catapult::GenerationHash &generationHash)
Definition: NetworkInfo.h:62
MacroBasedEnum.h
catapult::model::NetworkInfo
Information about a network.
Definition: NetworkInfo.h:54
catapult::model::TryParseValue
bool TryParseValue(const std::string &networkName, NetworkIdentifier &networkIdentifier)
Tries to parse networkName into a network identifier (networkIdentifier).
Definition: NetworkInfo.cpp:44
NetworkInfo.h
catapult::utils::TryParseEnumValue
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 (stringToVal...
Definition: ConfigurationValueParsers.h:104
catapult::model::NetworkInfo::GenerationHash
catapult::GenerationHash GenerationHash
Nemesis generation hash.
Definition: NetworkInfo.h:76
MacroBasedEnumIncludes.h
catapult::model::NetworkIdentifier
NetworkIdentifier
Possible network identifiers.
Definition: NetworkInfo.h:45
catapult::model::operator<<
std::ostream & operator<<(std::ostream &out, const EmbeddedTransaction &transaction)
Insertion operator for outputting transaction to out.
Definition: EmbeddedTransaction.cpp:28
types.h
ConfigurationValueParsers.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::model::NetworkInfo::NetworkInfo
constexpr NetworkInfo()
Creates a default, uninitialized network info.
Definition: NetworkInfo.h:57
catapult::utils::ByteArray< Key_Size, Key_tag >
catapult::utils::TryParseValue
bool TryParseValue(const std::string &str, LogLevel &parsedValue)
Tries to parse str into a log level (parsedValue).
Definition: ConfigurationValueParsers.cpp:60
catapult::model::NetworkInfo::PublicKey
Key PublicKey
Nemesis public key.
Definition: NetworkInfo.h:73
catapult::model::NetworkInfo::Identifier
NetworkIdentifier Identifier
Network identifier.
Definition: NetworkInfo.h:70