Reformatting using AStyle

This commit is contained in:
Vinnie Falco
2013-06-14 08:45:13 -07:00
parent 36bd8f7173
commit 521e812fc4
294 changed files with 54609 additions and 47598 deletions

View File

@@ -1,67 +1,95 @@
#ifndef __TRANSACTIONENGINE__
#define __TRANSACTIONENGINE__
DEFINE_INSTANCE(TransactionEngine);
DEFINE_INSTANCE (TransactionEngine);
// A TransactionEngine applies serialized transactions to a ledger
// It can also, verify signatures, verify fees, and give rejection reasons
// One instance per ledger.
// Only one transaction applied at a time.
class TransactionEngine : private IS_INSTANCE(TransactionEngine)
class TransactionEngine : private IS_INSTANCE (TransactionEngine)
{
private:
LedgerEntrySet mNodes;
LedgerEntrySet mNodes;
TER setAuthorized(const SerializedTransaction& txn, bool bMustSetGenerator);
TER checkSig(const SerializedTransaction& txn);
TER setAuthorized (const SerializedTransaction & txn, bool bMustSetGenerator);
TER checkSig (const SerializedTransaction & txn);
TER takeOffers(
bool bPassive,
uint256 const& uBookBase,
const uint160& uTakerAccountID,
SLE::ref sleTakerAccount,
const STAmount& saTakerPays,
const STAmount& saTakerGets,
STAmount& saTakerPaid,
STAmount& saTakerGot);
TER takeOffers (
bool bPassive,
uint256 const & uBookBase,
const uint160 & uTakerAccountID,
SLE::ref sleTakerAccount,
const STAmount & saTakerPays,
const STAmount & saTakerGets,
STAmount & saTakerPaid,
STAmount & saTakerGot);
protected:
Ledger::pointer mLedger;
int mTxnSeq;
Ledger::pointer mLedger;
int mTxnSeq;
uint160 mTxnAccountID;
SLE::pointer mTxnAccount;
uint160 mTxnAccountID;
SLE::pointer mTxnAccount;
void txnWrite();
void txnWrite ();
public:
typedef boost::shared_ptr<TransactionEngine> pointer;
typedef boost::shared_ptr<TransactionEngine> pointer;
TransactionEngine() : mTxnSeq(0) { ; }
TransactionEngine(Ledger::ref ledger) : mLedger(ledger), mTxnSeq(0) { assert(mLedger); }
TransactionEngine () : mTxnSeq (0)
{
;
}
TransactionEngine (Ledger::ref ledger) : mLedger (ledger), mTxnSeq (0)
{
assert (mLedger);
}
LedgerEntrySet& getNodes() { return mNodes; }
Ledger::ref getLedger() { return mLedger; }
void setLedger(Ledger::ref ledger) { assert(ledger); mLedger = ledger; }
LedgerEntrySet& getNodes ()
{
return mNodes;
}
Ledger::ref getLedger ()
{
return mLedger;
}
void setLedger (Ledger::ref ledger)
{
assert (ledger);
mLedger = ledger;
}
SLE::pointer entryCreate(LedgerEntryType type, uint256 const& index) { return mNodes.entryCreate(type, index); }
SLE::pointer entryCache(LedgerEntryType type, uint256 const& index) { return mNodes.entryCache(type, index); }
void entryDelete(SLE::ref sleEntry) { mNodes.entryDelete(sleEntry); }
void entryModify(SLE::ref sleEntry) { mNodes.entryModify(sleEntry); }
SLE::pointer entryCreate (LedgerEntryType type, uint256 const & index)
{
return mNodes.entryCreate (type, index);
}
SLE::pointer entryCache (LedgerEntryType type, uint256 const & index)
{
return mNodes.entryCache (type, index);
}
void entryDelete (SLE::ref sleEntry)
{
mNodes.entryDelete (sleEntry);
}
void entryModify (SLE::ref sleEntry)
{
mNodes.entryModify (sleEntry);
}
TER applyTransaction(const SerializedTransaction&, TransactionEngineParams, bool& didApply);
bool checkInvariants(TER result, const SerializedTransaction& txn, TransactionEngineParams params);
TER applyTransaction (const SerializedTransaction&, TransactionEngineParams, bool & didApply);
bool checkInvariants (TER result, const SerializedTransaction & txn, TransactionEngineParams params);
};
inline TransactionEngineParams operator|(const TransactionEngineParams& l1, const TransactionEngineParams& l2)
inline TransactionEngineParams operator| (const TransactionEngineParams& l1, const TransactionEngineParams& l2)
{
return static_cast<TransactionEngineParams>(static_cast<int>(l1) | static_cast<int>(l2));
return static_cast<TransactionEngineParams> (static_cast<int> (l1) | static_cast<int> (l2));
}
inline TransactionEngineParams operator&(const TransactionEngineParams& l1, const TransactionEngineParams& l2)
inline TransactionEngineParams operator& (const TransactionEngineParams& l1, const TransactionEngineParams& l2)
{
return static_cast<TransactionEngineParams>(static_cast<int>(l1) & static_cast<int>(l2));
return static_cast<TransactionEngineParams> (static_cast<int> (l1) & static_cast<int> (l2));
}
#endif