CA: CAssetID -> CAsset

This commit is contained in:
Mark Friedenbach 2017-03-04 14:56:18 -08:00 committed by Gregory Sanders
parent 892cb984ae
commit a25f6c6e08
19 changed files with 347 additions and 347 deletions

View file

@ -44,14 +44,14 @@ std::string CFeeRate::ToString() const
CAmountMap& operator+=(CAmountMap& a, const CAmountMap& b)
{
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
a[it->first] += it->second;
return a;
}
CAmountMap& operator-=(CAmountMap& a, const CAmountMap& b)
{
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
a[it->first] -= it->second;
return a;
}
@ -59,9 +59,9 @@ CAmountMap& operator-=(CAmountMap& a, const CAmountMap& b)
CAmountMap operator+(const CAmountMap& a, const CAmountMap& b)
{
CAmountMap c;
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it)
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it)
c[it->first] += it->second;
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
c[it->first] += it->second;
return c;
}
@ -69,9 +69,9 @@ CAmountMap operator+(const CAmountMap& a, const CAmountMap& b)
CAmountMap operator-(const CAmountMap& a, const CAmountMap& b)
{
CAmountMap c;
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it)
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it)
c[it->first] += it->second;
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
c[it->first] -= it->second;
return c;
}
@ -79,14 +79,14 @@ CAmountMap operator-(const CAmountMap& a, const CAmountMap& b)
bool operator<(const CAmountMap& a, const CAmountMap& b)
{
bool smallerElement = false;
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
CAmount aValue = a.count(it->first) ? a.find(it->first)->second : 0;
if (aValue > it->second)
return false;
if (aValue < it->second)
smallerElement = true;
}
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
CAmount bValue = b.count(it->first) ? b.find(it->first)->second : 0;
if (it->second > bValue)
return false;
@ -98,12 +98,12 @@ bool operator<(const CAmountMap& a, const CAmountMap& b)
bool operator<=(const CAmountMap& a, const CAmountMap& b)
{
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
CAmount aValue = a.count(it->first) ? a.find(it->first)->second : 0;
if (aValue > it->second)
return false;
}
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
CAmount bValue = b.count(it->first) ? b.find(it->first)->second : 0;
if (it->second > bValue)
return false;
@ -114,14 +114,14 @@ bool operator<=(const CAmountMap& a, const CAmountMap& b)
bool operator>(const CAmountMap& a, const CAmountMap& b)
{
bool largerElement = false;
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
CAmount aValue = a.count(it->first) ? a.find(it->first)->second : 0;
if (aValue < it->second)
return false;
if (aValue > it->second)
largerElement = true;
}
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
CAmount bValue = b.count(it->first) ? b.find(it->first)->second : 0;
if (it->second < bValue)
return false;
@ -133,11 +133,11 @@ bool operator>(const CAmountMap& a, const CAmountMap& b)
bool operator>=(const CAmountMap& a, const CAmountMap& b)
{
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
if ((a.count(it->first) ? a.find(it->first)->second : 0) < it->second)
return false;
}
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
if (it->second < (b.count(it->first) ? b.find(it->first)->second : 0))
return false;
}
@ -146,11 +146,11 @@ bool operator>=(const CAmountMap& a, const CAmountMap& b)
bool operator==(const CAmountMap& a, const CAmountMap& b)
{
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it) {
if ((b.count(it->first) ? b.find(it->first)->second : 0) != it->second)
return false;
}
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it) {
if ((a.count(it->first) ? a.find(it->first)->second : 0) != it->second)
return false;
}
@ -164,7 +164,7 @@ bool operator!=(const CAmountMap& a, const CAmountMap& b)
bool hasNegativeValue(const CAmountMap& amount)
{
for(std::map<CAssetID, CAmount>::const_iterator it = amount.begin(); it != amount.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = amount.begin(); it != amount.end(); ++it) {
if (it->second < 0)
return true;
}
@ -173,7 +173,7 @@ bool hasNegativeValue(const CAmountMap& amount)
bool hasNonPostiveValue(const CAmountMap& amount)
{
for(std::map<CAssetID, CAmount>::const_iterator it = amount.begin(); it != amount.end(); ++it) {
for(std::map<CAsset, CAmount>::const_iterator it = amount.begin(); it != amount.end(); ++it) {
if (it->second <= 0)
return true;
}