Moved cpp code to src/cpp and js code to src/js.

This commit is contained in:
Stefan Thomas
2012-11-06 12:02:59 -08:00
parent 3c880b8301
commit fa3fab5816
214 changed files with 62 additions and 57 deletions

View File

@@ -0,0 +1,55 @@
#include "CanonicalTXSet.h"
bool CanonicalTXKey::operator<(const CanonicalTXKey& key) const
{
if (mAccount < key.mAccount) return true;
if (mAccount > key.mAccount) return false;
if (mSeq < key.mSeq) return true;
if (mSeq > key.mSeq) return false;
return mTXid < key.mTXid;
}
bool CanonicalTXKey::operator>(const CanonicalTXKey& key) const
{
if (mAccount > key.mAccount) return true;
if (mAccount < key.mAccount) return false;
if (mSeq > key.mSeq) return true;
if (mSeq < key.mSeq) return false;
return mTXid > key.mTXid;
}
bool CanonicalTXKey::operator<=(const CanonicalTXKey& key) const
{
if (mAccount < key.mAccount) return true;
if (mAccount > key.mAccount) return false;
if (mSeq < key.mSeq) return true;
if (mSeq > key.mSeq) return false;
return mTXid <= key.mTXid;
}
bool CanonicalTXKey::operator>=(const CanonicalTXKey& key)const
{
if (mAccount > key.mAccount) return true;
if (mAccount < key.mAccount) return false;
if (mSeq > key.mSeq) return true;
if (mSeq < key.mSeq) return false;
return mTXid >= key.mTXid;
}
void CanonicalTXSet::push_back(SerializedTransaction::ref txn)
{
uint256 effectiveAccount = mSetHash;
effectiveAccount ^= txn->getSourceAccount().getAccountID().to256();
mMap.insert(std::make_pair(CanonicalTXKey(effectiveAccount, txn->getSequence(), txn->getTransactionID()), txn));
}
CanonicalTXSet::iterator CanonicalTXSet::erase(const iterator& it)
{
iterator tmp = it;
++tmp;
mMap.erase(it);
return tmp;
}