mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Tidy up TxFormat and create TxFormats, TxFlags
This commit is contained in:
49
modules/ripple_data/protocol/ripple_TxFormats.cpp
Normal file
49
modules/ripple_data/protocol/ripple_TxFormats.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
|
||||
TxFormats& TxFormats::getInstance ()
|
||||
{
|
||||
static TxFormats instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
TxFormat* TxFormats::add (TxFormat* txFormat)
|
||||
{
|
||||
// VFALCO TODO Figure out when and how to delete the TxFormat objects later?
|
||||
m_types [txFormat->getType ()] = txFormat;
|
||||
m_names [txFormat->getName ()] = txFormat;
|
||||
|
||||
return txFormat;
|
||||
}
|
||||
|
||||
TxFormat* TxFormats::findByType (TransactionType type)
|
||||
{
|
||||
TxFormat* result = NULL;
|
||||
|
||||
TypeMap::iterator const iter = m_types.find (type);
|
||||
|
||||
if (iter != m_types.end ())
|
||||
{
|
||||
result = iter->second;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
TxFormat* TxFormats::findByName (std::string const& name)
|
||||
{
|
||||
TxFormat* result = NULL; // VFALCO TODO replace all NULL with nullptr
|
||||
|
||||
NameMap::iterator const iter = m_names.find (name);
|
||||
|
||||
if (iter != m_names.end ())
|
||||
{
|
||||
result = iter->second;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
TxFormats::TxFormats ()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user