Add instance counts to core classes.

This commit is contained in:
JoelKatz
2012-10-31 15:50:14 -07:00
parent cd93bd0de3
commit f0eb8e7943
7 changed files with 25 additions and 6 deletions

View File

@@ -20,6 +20,7 @@
#include "Log.h"
SETUP_LOG();
DECLARE_INSTANCE(Ledger);
Ledger::Ledger(const RippleAddress& masterID, uint64 startAmount) : mTotCoins(startAmount), mLedgerSeq(1),
mCloseTime(0), mParentCloseTime(0), mCloseResolution(LEDGER_TIME_ACCURACY), mCloseFlags(0),

View File

@@ -18,6 +18,7 @@
#include "types.h"
#include "BitcoinUtil.h"
#include "SHAMap.h"
#include "InstanceCounter.h"
enum LedgerStateParms
{
@@ -38,7 +39,9 @@ enum LedgerStateParms
#define LEDGER_JSON_DUMP_STATE 0x20000000
#define LEDGER_JSON_FULL 0x40000000
class Ledger : public boost::enable_shared_from_this<Ledger>
DEFINE_INSTANCE(Ledger);
class Ledger : public boost::enable_shared_from_this<Ledger>, public IS_INSTANCE(Ledger)
{ // The basic Ledger structure, can be opened, closed, or synching
friend class TransactionEngine;
public:

View File

@@ -91,6 +91,8 @@ public:
void setLedgerRangePresent(uint32 minV, uint32 maxV) { mCompleteLedgers.setRange(minV, maxV); }
bool addHeldTransaction(const Transaction::pointer& trans);
void sweep(void) { mLedgerHistory.sweep(); }
};
#endif

View File

@@ -16,6 +16,7 @@
#include "Log.h"
SETUP_LOG();
DECLARE_INSTANCE(Peer);
// Don't try to run past receiving nonsense from a peer
#define TRUST_NETWORK

View File

@@ -11,6 +11,7 @@
#include "PackedMessage.h"
#include "Ledger.h"
#include "Transaction.h"
#include "InstanceCounter.h"
enum PeerPunish
{
@@ -21,7 +22,9 @@ enum PeerPunish
typedef std::pair<std::string,int> ipPort;
class Peer : public boost::enable_shared_from_this<Peer>
DEFINE_INSTANCE(Peer);
class Peer : public boost::enable_shared_from_this<Peer>, public IS_INSTANCE(Peer)
{
public:
typedef boost::shared_ptr<Peer> pointer;

View File

@@ -17,6 +17,10 @@
SETUP_LOG();
DECLARE_INSTANCE(SHAMap);
DECLARE_INSTANCE(SHAMapItem);
DECLARE_INSTANCE(SHAMapTreeNode);
std::size_t hash_value(const SHAMapNode& mn)
{
std::size_t seed = theApp->getNonceST();

View File

@@ -14,6 +14,11 @@
#include "ScopedLock.h"
#include "Serializer.h"
#include "HashedObject.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(SHAMap);
DEFINE_INSTANCE(SHAMapItem);
DEFINE_INSTANCE(SHAMapTreeNode);
class SHAMap;
@@ -31,7 +36,7 @@ private:
public:
static const int rootDepth=0;
static const int rootDepth = 0;
SHAMapNode() : mDepth(0) { ; }
SHAMapNode(int depth, const uint256& hash);
@@ -77,7 +82,7 @@ extern std::size_t hash_value(const SHAMapNode& mn);
inline std::ostream& operator<<(std::ostream& out, const SHAMapNode& node) { return out << node.getString(); }
class SHAMapItem
class SHAMapItem : public IS_INSTANCE(SHAMapItem)
{ // an item stored in a SHAMap
public:
typedef boost::shared_ptr<SHAMapItem> pointer;
@@ -135,7 +140,7 @@ enum SHAMapType
smtFREE =3, // A tree not part of a ledger
};
class SHAMapTreeNode : public SHAMapNode
class SHAMapTreeNode : public SHAMapNode, public IS_INSTANCE(SHAMapTreeNode)
{
friend class SHAMap;
@@ -276,7 +281,7 @@ public:
extern std::ostream& operator<<(std::ostream&, const SHAMapMissingNode&);
class SHAMap
class SHAMap : public IS_INSTANCE(SHAMap)
{
public:
typedef boost::shared_ptr<SHAMap> pointer;