New SharedSingleton, resolves destruction of objects with static storage duration.

This commit is contained in:
Vinnie Falco
2013-09-12 04:35:13 -07:00
parent 048dcf8a3c
commit 3550a21294
24 changed files with 194 additions and 282 deletions

View File

@@ -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 ();
}

View File

@@ -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);

View File

@@ -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 ();
}

View File

@@ -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