From 8e4b11b668d2560ae6d236bdfee3a5b97679921c Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Wed, 31 Oct 2012 16:11:59 -0700 Subject: [PATCH] Add more counted types. --- src/SerializedLedger.cpp | 2 ++ src/SerializedLedger.h | 5 ++++- src/SerializedObject.cpp | 2 ++ src/SerializedObject.h | 8 ++++++-- src/SerializedTransaction.cpp | 2 ++ src/SerializedTransaction.h | 5 ++++- src/SerializedTypes.cpp | 1 + src/SerializedTypes.h | 6 ++++-- 8 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/SerializedLedger.cpp b/src/SerializedLedger.cpp index 359a93fa5..00a353987 100644 --- a/src/SerializedLedger.cpp +++ b/src/SerializedLedger.cpp @@ -5,6 +5,8 @@ #include "Ledger.h" #include "Log.h" +DECLARE_INSTANCE(SerializedLedgerEntry) + SerializedLedgerEntry::SerializedLedgerEntry(SerializerIterator& sit, const uint256& index) : STObject(sfLedgerEntry), mIndex(index) { diff --git a/src/SerializedLedger.h b/src/SerializedLedger.h index c02126db1..7bbdfaf99 100644 --- a/src/SerializedLedger.h +++ b/src/SerializedLedger.h @@ -4,8 +4,11 @@ #include "SerializedObject.h" #include "LedgerFormats.h" #include "RippleAddress.h" +#include "InstanceCounter.h" -class SerializedLedgerEntry : public STObject +DEFINE_INSTANCE(SerializedLedgerEntry); + +class SerializedLedgerEntry : public STObject, private IS_INSTANCE(SerializedLedgerEntry) { public: typedef boost::shared_ptr pointer; diff --git a/src/SerializedObject.cpp b/src/SerializedObject.cpp index 1477a2393..7b6a51f94 100644 --- a/src/SerializedObject.cpp +++ b/src/SerializedObject.cpp @@ -14,6 +14,8 @@ #include "SerializedTransaction.h" SETUP_LOG(); +DECLARE_INSTANCE(SerializedObject); +DECLARE_INSTANCE(SerializedArray); std::auto_ptr STObject::makeDefaultObject(SerializedTypeID id, SField::ref name) { diff --git a/src/SerializedObject.h b/src/SerializedObject.h index 00c89ed1e..d0d3ce6af 100644 --- a/src/SerializedObject.h +++ b/src/SerializedObject.h @@ -8,6 +8,10 @@ #include "../json/value.h" #include "SerializedTypes.h" +#include "InstanceCounter.h" + +DEFINE_INSTANCE(SerializedObject); +DEFINE_INSTANCE(SerializedArray); // Serializable object/array types @@ -22,7 +26,7 @@ public: SOElement(SField::ref fi, SOE_Flags fl) : e_field(fi), flags(fl) { ; } }; -class STObject : public SerializedType +class STObject : public SerializedType, private IS_INSTANCE(SerializedObject) { protected: boost::ptr_vector mData; @@ -175,7 +179,7 @@ namespace boost -class STArray : public SerializedType +class STArray : public SerializedType, private IS_INSTANCE(SerializedArray) { public: typedef std::vector vector; diff --git a/src/SerializedTransaction.cpp b/src/SerializedTransaction.cpp index d6b7a0291..bdc26d77e 100644 --- a/src/SerializedTransaction.cpp +++ b/src/SerializedTransaction.cpp @@ -8,6 +8,8 @@ #include "Log.h" #include "HashPrefixes.h" +DECLARE_INSTANCE(SerializedTransaction); + SerializedTransaction::SerializedTransaction(TransactionType type) : STObject(sfTransaction), mType(type) { mFormat = TransactionFormat::getTxnFormat(type); diff --git a/src/SerializedTransaction.h b/src/SerializedTransaction.h index 185ca6cda..50d974db0 100644 --- a/src/SerializedTransaction.h +++ b/src/SerializedTransaction.h @@ -9,6 +9,7 @@ #include "SerializedObject.h" #include "TransactionFormats.h" #include "RippleAddress.h" +#include "InstanceCounter.h" #define TXN_SQL_NEW 'N' #define TXN_SQL_CONFLICT 'C' @@ -17,7 +18,9 @@ #define TXN_SQL_INCLUDED 'I' #define TXN_SQL_UNKNOWN 'U' -class SerializedTransaction : public STObject +DEFINE_INSTANCE(SerializedTransaction); + +class SerializedTransaction : public STObject, private IS_INSTANCE(SerializedTransaction) { public: typedef boost::shared_ptr pointer; diff --git a/src/SerializedTypes.cpp b/src/SerializedTypes.cpp index 55fc7039b..5fc0ebbe3 100644 --- a/src/SerializedTypes.cpp +++ b/src/SerializedTypes.cpp @@ -14,6 +14,7 @@ #include "TransactionErr.h" SETUP_LOG(); +DECLARE_INSTANCE(SerializedEntry); STAmount saZero(CURRENCY_ONE, ACCOUNT_ONE, 0); STAmount saOne(CURRENCY_ONE, ACCOUNT_ONE, 1); diff --git a/src/SerializedTypes.h b/src/SerializedTypes.h index 62f7347c8..6e1267448 100644 --- a/src/SerializedTypes.h +++ b/src/SerializedTypes.h @@ -9,7 +9,7 @@ #include "uint256.h" #include "Serializer.h" #include "FieldNames.h" - +#include "InstanceCounter.h" enum PathFlags { @@ -30,7 +30,9 @@ enum PathFlags #define ACCOUNT_XNS uint160(0) #define ACCOUNT_ONE uint160(1) // Used as a place holder -class SerializedType +DEFINE_INSTANCE(SerializedEntry); + +class SerializedType : private IS_INSTANCE(SerializedEntry) { protected: SField::ptr fName;