Add SimpleIdentifier traits for non-crypto identifiers

This commit is contained in:
Vinnie Falco
2013-09-23 12:40:35 -07:00
parent 3518a51d4a
commit 426636f48d
31 changed files with 459 additions and 168 deletions

View File

@@ -22,7 +22,7 @@ public:
}
};
typedef boost::unordered_map <PublicKey, Info, PublicKey::hasher> MapType;
typedef boost::unordered_map <RipplePublicKey, Info, RipplePublicKey::hasher> MapType;
ChosenList (std::size_t expectedSize = 0)
{
@@ -40,17 +40,17 @@ public:
return m_map.size ();
}
void insert (PublicKey const& key, Info const& info) noexcept
void insert (RipplePublicKey const& key, Info const& info) noexcept
{
m_map [key] = info;
}
bool containsPublicKey (PublicKey const& publicKey) const noexcept
bool containsPublicKey (RipplePublicKey const& publicKey) const noexcept
{
return m_map.find (publicKey) != m_map.cend ();
}
bool containsPublicKeyHash (PublicKeyHash const& publicKeyHash) const noexcept
bool containsPublicKeyHash (RipplePublicKeyHash const& publicKeyHash) const noexcept
{
return false;
}

View File

@@ -46,7 +46,7 @@ public:
};
typedef boost::unordered_map <
PublicKey, ValidatorInfo, PublicKey::hasher> MapType;
RipplePublicKey, ValidatorInfo, RipplePublicKey::hasher> MapType;
struct State
{
@@ -388,7 +388,7 @@ public:
// Returns `true` if the public key hash is contained in the Chosen List.
//
bool isTrustedPublicKeyHash (PublicKeyHash const& publicKeyHash)
bool isTrustedPublicKeyHash (RipplePublicKeyHash const& publicKeyHash)
{
return m_chosenList->containsPublicKeyHash (publicKeyHash);
}

View File

@@ -119,7 +119,7 @@ public:
for (uint32 i = m_start ; i < m_end; ++i)
{
Info info;
info.publicKey = Validators::PublicKey::createFromInteger (i);
info.publicKey = RipplePublicKey::createFromInteger (i);
info.label = String::fromNumber (i);
result.list.add (info);
}

View File

@@ -236,17 +236,17 @@ Time Utilities::stringToTime (String s)
return Time (0);
}
std::string Utilities::publicKeyToString (PublicKey const& publicKey)
std::string Utilities::publicKeyToString (RipplePublicKey const& publicKey)
{
std::string s (PublicKey::size, ' ');
std::string s (RipplePublicKey::size, ' ');
std::copy (publicKey.cbegin(), publicKey.cend(), s.begin());
return s;
}
PublicKey Utilities::stringToPublicKey (std::string const& s)
RipplePublicKey Utilities::stringToPublicKey (std::string const& s)
{
bassert (s.size() == PublicKey::size);
return PublicKey ();
bassert (s.size() == RipplePublicKey::size);
return RipplePublicKey ();
}
//------------------------------------------------------------------------------

View File

@@ -54,9 +54,9 @@ public:
static String timeToString (Time const& t);
static Time stringToTime (String s);
// conversion between PublicKey and String
static std::string publicKeyToString (PublicKey const& publicKey);
static PublicKey stringToPublicKey (std::string const& s);
// conversion between RipplePublicKey and String
static std::string publicKeyToString (RipplePublicKey const& publicKey);
static RipplePublicKey stringToPublicKey (std::string const& s);
struct Helpers;