mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
New SharedSingleton, resolves destruction of objects with static storage duration.
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
//==============================================================================
|
||||
|
||||
LedgerFormats::LedgerFormats ()
|
||||
: SharedSingleton <LedgerFormats> (SingletonLifetime::persistAfterCreation)
|
||||
{
|
||||
add ("AccountRoot", ltACCOUNT_ROOT)
|
||||
<< SOElement (sfAccount, SOE_REQUIRED)
|
||||
@@ -105,11 +104,6 @@ LedgerFormats::LedgerFormats ()
|
||||
;
|
||||
}
|
||||
|
||||
LedgerFormats* LedgerFormats::createInstance ()
|
||||
{
|
||||
return new LedgerFormats;
|
||||
}
|
||||
|
||||
void LedgerFormats::addCommonFields (Item& item)
|
||||
{
|
||||
item
|
||||
@@ -118,3 +112,8 @@ void LedgerFormats::addCommonFields (Item& item)
|
||||
<< SOElement(sfFlags, SOE_REQUIRED)
|
||||
;
|
||||
}
|
||||
|
||||
LedgerFormats* LedgerFormats::getInstance ()
|
||||
{
|
||||
return SharedSingleton <LedgerFormats>::getInstance ();
|
||||
}
|
||||
|
||||
@@ -103,15 +103,12 @@ enum LedgerSpecificFlags
|
||||
|
||||
/** Holds the list of known ledger entry formats.
|
||||
*/
|
||||
class LedgerFormats
|
||||
: public KnownFormats <LedgerEntryType>
|
||||
, public SharedSingleton <LedgerFormats>
|
||||
class LedgerFormats : public KnownFormats <LedgerEntryType>
|
||||
{
|
||||
private:
|
||||
public:
|
||||
LedgerFormats ();
|
||||
|
||||
public:
|
||||
static LedgerFormats* createInstance ();
|
||||
static LedgerFormats* getInstance ();
|
||||
|
||||
private:
|
||||
void addCommonFields (Item& item);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
//==============================================================================
|
||||
|
||||
TxFormats::TxFormats ()
|
||||
: SharedSingleton <TxFormats> (SingletonLifetime::persistAfterCreation)
|
||||
{
|
||||
add ("AccountSet", ttACCOUNT_SET)
|
||||
<< SOElement (sfEmailHash, SOE_OPTIONAL)
|
||||
@@ -91,7 +90,7 @@ void TxFormats::addCommonFields (Item& item)
|
||||
;
|
||||
}
|
||||
|
||||
TxFormats* TxFormats::createInstance ()
|
||||
TxFormats* TxFormats::getInstance ()
|
||||
{
|
||||
return new TxFormats;
|
||||
return SharedSingleton <TxFormats>::getInstance ();
|
||||
}
|
||||
|
||||
@@ -37,21 +37,18 @@ enum TxType
|
||||
|
||||
/** Manages the list of known transaction formats.
|
||||
*/
|
||||
class TxFormats
|
||||
: public KnownFormats <TxType>
|
||||
, public SharedSingleton <TxFormats>
|
||||
class TxFormats : public KnownFormats <TxType>
|
||||
{
|
||||
private:
|
||||
/** Create the object.
|
||||
void addCommonFields (Item& item);
|
||||
|
||||
public:
|
||||
/** Create the object.
|
||||
This will load the object will all the known transaction formats.
|
||||
*/
|
||||
TxFormats ();
|
||||
|
||||
void addCommonFields (Item& item);
|
||||
|
||||
public:
|
||||
static TxFormats* createInstance ();
|
||||
static TxFormats* getInstance ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user