[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 4591445 10/10: Initialize antediluvian databa
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 4591445 10/10: Initialize antediluvian database statically |
Date: |
Tue, 2 Aug 2016 12:35:21 +0000 (UTC) |
branch: master
commit 45914453f85e4965306d1ee1312903338212685e
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Initialize antediluvian database statically
The antediluvian branch has only one database, so initialize it OAOO.
---
database.cpp | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/database.cpp b/database.cpp
index 6c7b65f..ea52fa8 100644
--- a/database.cpp
+++ b/database.cpp
@@ -175,6 +175,19 @@ bool product_database::varies_by_state(e_database_key k)
const
return 1 != entity_from_key(k).axis_lengths().at(e_axis_state);
}
+namespace
+{
+/// Antediluvian database for static initialization.
+
+boost::shared_ptr<DBDictionary const> antediluvian_db()
+{
+ boost::shared_ptr<DBDictionary> z(new DBDictionary);
+ z->InitAntediluvian();
+ LMI_ASSERT(z);
+ return z;
+}
+} // Unnamed namespace.
+
/// Initialize upon construction.
///
/// Set maturity age and default length (number of years to maturity).
@@ -183,9 +196,8 @@ void product_database::initialize(std::string const&
product_name)
{
if(is_antediluvian_fork())
{
- boost::shared_ptr<DBDictionary> d(new DBDictionary);
- d->InitAntediluvian();
- db_ = d;
+ static boost::shared_ptr<DBDictionary const> z(antediluvian_db());
+ db_ = z;
}
else
{
- [lmi-commits] [lmi] master updated (a60bbf4 -> 4591445), Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master cc4b3eb 01/10: Expunge superfluous typenames, Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master fd26a86 05/10: Expunge typedefs that are no longer helpful, Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master 469307a 03/10: Use 'auto' for iterator type, Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master 780fb8b 04/10: Deduce pair type rather than specify it, Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master b178f96 02/10: Improve typedef-names for type retrieved from cache, Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master 80a031e 06/10: Expunge an intermediate variable, and simplify control flow, Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master 4591445 10/10: Initialize antediluvian database statically,
Greg Chicares <=
- [lmi-commits] [lmi] master 7f9eece 07/10: Remove old caching from DBDictionary (VS), Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master 7fffe41 08/10: Use caching for DBDictionary (VS), Greg Chicares, 2016/08/02
- [lmi-commits] [lmi] master 7ea93d3 09/10: Adapt 2012-06-15 patches just applied to renamed caching class, Greg Chicares, 2016/08/02