Tidy up TxFormat and create TxFormats, TxFlags

This commit is contained in:
Vinnie Falco
2013-06-15 07:18:14 -07:00
parent 17e370918b
commit 8aab3645cb
56 changed files with 1883 additions and 1599 deletions

View 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 ()
{
}