lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [4976] Refactor, using symbolic member names in class DBDi


From: Greg Chicares
Subject: [lmi-commits] [4976] Refactor, using symbolic member names in class DBDictionary
Date: Sun, 06 Jun 2010 23:21:22 +0000

Revision: 4976
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4976
Author:   chicares
Date:     2010-06-06 23:21:21 +0000 (Sun, 06 Jun 2010)
Log Message:
-----------
Refactor, using symbolic member names in class DBDictionary

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/database.cpp
    lmi/trunk/database_document.cpp
    lmi/trunk/database_document.hpp
    lmi/trunk/database_view_editor.hpp
    lmi/trunk/dbdict.cpp
    lmi/trunk/dbdict.hpp
    lmi/trunk/input_test.cpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/ChangeLog 2010-06-06 23:21:21 UTC (rev 4976)
@@ -25952,3 +25952,14 @@
   dbvalue.hpp
 Add operator==().
 
+20100606T2321Z <address@hidden> [704]
+
+  database.cpp
+  database_document.cpp
+  database_document.hpp
+  database_view_editor.hpp
+  dbdict.cpp
+  dbdict.hpp
+  input_test.cpp
+Refactor, using symbolic member names in class DBDictionary.
+

Modified: lmi/trunk/database.cpp
===================================================================
--- lmi/trunk/database.cpp      2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/database.cpp      2010-06-06 23:21:21 UTC (rev 4976)
@@ -34,7 +34,6 @@
 #include "dbdict.hpp"
 #include "dbvalue.hpp"
 #include "lmi.hpp"                    // is_antediluvian_fork()
-#include "map_lookup.hpp"
 #include "oecumenic_enumerations.hpp" // methuselah
 #include "product_data.hpp"
 #include "yare_input.hpp"
@@ -230,6 +229,7 @@
 
 database_entity const& product_database::entity_from_key(e_database_key k) 
const
 {
-    return map_lookup(DBDictionary::instance().GetDictionary(), k);
+    DBDictionary const& db = DBDictionary::instance();
+    return db.datum(db_name_from_key(k));
 }
 

Modified: lmi/trunk/database_document.cpp
===================================================================
--- lmi/trunk/database_document.cpp     2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/database_document.cpp     2010-06-06 23:21:21 UTC (rev 4976)
@@ -32,6 +32,8 @@
 
 #include <wx/defs.h>
 
+#include <algorithm> // std::swap()
+
 namespace
 {
 
@@ -48,41 +50,54 @@
 class swap_workaround_for_singleton
 {
   public:
-    swap_workaround_for_singleton(dict_map& m1, dict_map& m2);
+    swap_workaround_for_singleton
+        (std::map<std::string,database_entity>&
+        ,DBDictionary&
+        );
     ~swap_workaround_for_singleton();
 
   private:
-    dict_map& m1_;
-    dict_map& m2_;
+    std::map<std::string,database_entity>& m1_;
+    DBDictionary&                          m2_;
 };
 
 inline swap_workaround_for_singleton::swap_workaround_for_singleton
-    (dict_map& m1
-    ,dict_map& m2
+    (std::map<std::string,database_entity>& m1
+    ,DBDictionary&                          m2
     )
     :m1_(m1)
     ,m2_(m2)
 {
-    m1_.swap(m2_); // initially swap
+    DatabaseDocument::swap_kludge(m1_, m2_);
 }
+
 inline swap_workaround_for_singleton::~swap_workaround_for_singleton()
 {
-    m1_.swap(m2_); // swap back
+    DatabaseDocument::swap_kludge(m1_, m2_);
 }
 
 } // Unnamed namespace.
 
 IMPLEMENT_DYNAMIC_CLASS(DatabaseDocument, ProductEditorDocument)
 
+void DatabaseDocument::swap_kludge
+    (std::map<std::string,database_entity>& m
+    ,DBDictionary&                          d
+    )
+{
+    typedef std::vector<std::string>::const_iterator svci;
+    for(svci i = d.member_names().begin(); i != d.member_names().end(); ++i)
+        {
+        std::swap(m[*i], d.datum(*i));
+        }
+}
+
 DatabaseDocument::DatabaseDocument()
     :ProductEditorDocument()
     ,dict_()
 {
-    // Initialize database dictionary
     DBDictionary& instance = DBDictionary::instance();
-
-    swap_workaround_for_singleton workaround(dict_, instance.dictionary_);
-
+    swap_workaround_for_singleton workaround(dict_, instance);
     instance.InitDB();
 }
 
@@ -92,20 +107,23 @@
 
 database_entity& DatabaseDocument::GetTDBValue(e_database_key index)
 {
-    if(dict_.find(index) == dict_.end())
+    std::string const& s = db_name_from_key(index);
+    if(dict_.find(s) == dict_.end())
         {
-        fatal_error() << "Index out of bounds." << LMI_FLUSH;
+        // A dummy entity ought to be good enough for non-leaf treenodes.
+        static database_entity dummy;
+        return dummy;
         }
-
-    return dict_[index];
+    else
+        {
+        return dict_[s];
+        }
 }
 
 void DatabaseDocument::ReadDocument(std::string const& filename)
 {
     DBDictionary& instance = DBDictionary::instance();
-
-    swap_workaround_for_singleton workaround(dict_, instance.dictionary_);
-
+    swap_workaround_for_singleton workaround(dict_, instance);
     DBDictionary::InvalidateCache();
     instance.Init(filename);
 }
@@ -113,9 +131,7 @@
 void DatabaseDocument::WriteDocument(std::string const& filename)
 {
     DBDictionary& instance = DBDictionary::instance();
-
-    swap_workaround_for_singleton workaround(dict_, instance.dictionary_);
-
+    swap_workaround_for_singleton workaround(dict_, instance);
     instance.WriteDB(filename);
 }
 

Modified: lmi/trunk/database_document.hpp
===================================================================
--- lmi/trunk/database_document.hpp     2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/database_document.hpp     2010-06-06 23:21:21 UTC (rev 4976)
@@ -31,6 +31,9 @@
 #include "dbdict.hpp"
 #include "dbnames.hpp"
 
+#include <map>
+#include <string>
+
 class LMI_SO database_entity;
 
 class DatabaseDocument
@@ -42,12 +45,17 @@
 
     database_entity& GetTDBValue(e_database_key index);
 
+    static void swap_kludge
+        (std::map<std::string,database_entity>&
+        ,DBDictionary&
+        );
+
   private:
     // ProductEditorDocument overrides.
     virtual void ReadDocument (std::string const& filename);
     virtual void WriteDocument(std::string const& filename);
 
-    dict_map dict_;
+    std::map<std::string,database_entity> dict_;
 
     DECLARE_DYNAMIC_CLASS(DatabaseDocument)
 };

Modified: lmi/trunk/database_view_editor.hpp
===================================================================
--- lmi/trunk/database_view_editor.hpp  2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/database_view_editor.hpp  2010-06-06 23:21:21 UTC (rev 4976)
@@ -50,7 +50,7 @@
 /// It does not really owns the database_entity instance which is passed to it.
 /// The boost::shared_ptr does.
 /// Regarding the fact that all the instances of database_entity are reside
-/// in the dict_map object and owned by it, one could pass entity via
+/// in the DBDictionary object and owned by it, one could pass entity via
 /// boost::shared_ptr constructed with deallocator object that does nothing.
 
 class DatabaseTableAdapter

Modified: lmi/trunk/dbdict.cpp
===================================================================
--- lmi/trunk/dbdict.cpp        2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/dbdict.cpp        2010-06-06 23:21:21 UTC (rev 4976)
@@ -49,12 +49,6 @@
 
 std::string DBDictionary::cached_filename_;
 
-// '23' is the number of non-leaf entities. Soon it will become
-// unnecessary, so there's no point in deriving it in a more
-// robust way.
-unsigned int const NumberOfEntries = DB_LAST;
-unsigned int const NumberOfLeaves  = DB_LAST - 23;
-
 namespace xml_serialize
 {
 template<> struct xml_io<database_entity>
@@ -63,60 +57,32 @@
     static void   to_xml(xml::element& e, T const& t) {t.write(e);}
     static void from_xml(xml::element const& e, T& t) {t.read (e);}
 };
+} // namespace xml_serialize
 
-/// Specialize xml_io<> for dict_map rather than coding a generic
-/// xml_io<std::map>, because the key would be stored redundantly:
-/// it's already part of class database_entity.
+/// Specialize value_cast<>() to throw an exception.
+///
+/// This is required by
+///   any_member::str()
+/// which is not useful here.
 
-template<> struct xml_io<dict_map>
+template<> std::string value_cast<std::string>(database_entity const&)
 {
-    static void to_xml(xml::element& e, dict_map const& t)
-    {
-        e.erase(e.begin(), e.end());
-        // Eventually the map key will be a string, not an integer.
-        // Anticipatorily sort output in the eventual order.
-        std::map<std::string,database_entity> m;
-        typedef dict_map::const_iterator tci;
-        for(tci i = t.begin(); i != t.end(); ++i)
-            {
-            db_names const& n = GetDBNames()[i->first];
-            LMI_ASSERT(i->first == n.Idx);
-            LMI_ASSERT(i->first == i->second.key());
-            LMI_ASSERT(n.ShortName == db_name_from_key(i->first));
-            // Only leaf entities are wanted.
-            if(DB_FIRST == n.ParentIdx)
-                {
-                continue;
-                }
-            m[n.ShortName] = i->second;
-            }
-        LMI_ASSERT(NumberOfLeaves == m.size());
-        typedef std::map<std::string,database_entity>::const_iterator mci;
-        for(mci i = m.begin(); i != m.end(); ++i)
-            {
-            // This is not equivalent to calling set_element():
-            // multiple <item> elements are expressly permitted.
-            xml::element z("item");
-            xml_serialize::to_xml(z, i->second);
-            e.push_back(z);
-            }
-    }
+    fatal_error() << "Invalid function call." << LMI_FLUSH;
+    throw "Unreachable--silences a compiler diagnostic.";
+}
 
-    static void from_xml(xml::element const& e, dict_map& t)
-    {
-        t.clear();
-        xml::const_nodes_view const items(e.elements("item"));
-        typedef xml::const_nodes_view::const_iterator cnvi;
-        for(cnvi i = items.begin(); i != items.end(); ++i)
-            {
-            database_entity z;
-            xml_serialize::from_xml(*i, z);
-            t[z.key()] = z;
-            }
-    }
-};
-} // namespace xml_serialize
+/// Specialize value_cast<>() to throw an exception.
+///
+/// This is required by
+///   any_member::operator=(std::string const&)
+/// which is not useful here.
 
+template<> database_entity value_cast<database_entity>(std::string const&)
+{
+    fatal_error() << "Invalid function call." << LMI_FLUSH;
+    throw "Unreachable--silences a compiler diagnostic.";
+}
+
 DBDictionary& DBDictionary::instance()
 {
     static DBDictionary z;
@@ -125,12 +91,306 @@
 
 DBDictionary::DBDictionary()
 {
+    ascribe_members();
 }
 
 DBDictionary::~DBDictionary()
 {
 }
 
+database_entity const& DBDictionary::datum(std::string const& name) const
+{
+    return *member_cast<database_entity>(operator[](name));
+}
+
+database_entity& DBDictionary::datum(std::string const& name)
+{
+    return *member_cast<database_entity>(operator[](name));
+}
+
+void DBDictionary::ascribe_members()
+{
+    ascribe("MinIssAge"           , &DBDictionary::MinIssAge           );
+    ascribe("MaxIssAge"           , &DBDictionary::MaxIssAge           );
+    ascribe("MaxIncrAge"          , &DBDictionary::MaxIncrAge          );
+    ascribe("AllowFullUw"         , &DBDictionary::AllowFullUw         );
+    ascribe("AllowSimpUw"         , &DBDictionary::AllowSimpUw         );
+    ascribe("AllowGuarUw"         , &DBDictionary::AllowGuarUw         );
+    ascribe("SmokeOrTobacco"      , &DBDictionary::SmokeOrTobacco      );
+    ascribe("PrefOrSelect"        , &DBDictionary::PrefOrSelect        );
+    ascribe("AllowPreferredClass" , &DBDictionary::AllowPreferredClass );
+    ascribe("AllowUltraPrefClass" , &DBDictionary::AllowUltraPrefClass );
+    ascribe("AllowSubstdTable"    , &DBDictionary::AllowSubstdTable    );
+    ascribe("AllowFlatExtras"     , &DBDictionary::AllowFlatExtras     );
+    ascribe("AllowRatedWp"        , &DBDictionary::AllowRatedWp        );
+    ascribe("AllowRatedAdb"       , &DBDictionary::AllowRatedAdb       );
+    ascribe("AllowRatedTerm"      , &DBDictionary::AllowRatedTerm      );
+    ascribe("AllowRetirees"       , &DBDictionary::AllowRetirees       );
+    ascribe("AllowUnisex"         , &DBDictionary::AllowUnisex         );
+    ascribe("AllowSexDistinct"    , &DBDictionary::AllowSexDistinct    );
+    ascribe("AllowUnismoke"       , &DBDictionary::AllowUnismoke       );
+    ascribe("AllowSmokeDistinct"  , &DBDictionary::AllowSmokeDistinct  );
+    ascribe("StateApproved"       , &DBDictionary::StateApproved       );
+    ascribe("AllowStateXX"        , &DBDictionary::AllowStateXX        );
+    ascribe("AllowForeign"        , &DBDictionary::AllowForeign        );
+    ascribe("Allowable"           , &DBDictionary::Allowable           );
+    ascribe("AllowCvat"           , &DBDictionary::AllowCvat           );
+    ascribe("AllowGpt"            , &DBDictionary::AllowGpt            );
+    ascribe("AllowNo7702"         , &DBDictionary::AllowNo7702         );
+    ascribe("CorridorTable"       , &DBDictionary::CorridorTable       );
+    ascribe("SevenPayTable"       , &DBDictionary::SevenPayTable       );
+    ascribe("Irc7702QTable"       , &DBDictionary::Irc7702QTable       );
+    ascribe("PremLoad7702"        , &DBDictionary::PremLoad7702        );
+    ascribe("Equiv7702Dbo3"       , &DBDictionary::Equiv7702Dbo3       );
+    ascribe("GuarCoiTable"        , &DBDictionary::GuarCoiTable        );
+    ascribe("GuarCoiIsAnnual"     , &DBDictionary::GuarCoiIsAnnual     );
+    ascribe("GuarCoiMultiplier"   , &DBDictionary::GuarCoiMultiplier   );
+    ascribe("CurrCoiTable"        , &DBDictionary::CurrCoiTable        );
+    ascribe("CurrCoiIsAnnual"     , &DBDictionary::CurrCoiIsAnnual     );
+    ascribe("CurrCoiMultiplier"   , &DBDictionary::CurrCoiMultiplier   );
+    ascribe("UnusualCoiBanding"   , &DBDictionary::UnusualCoiBanding   );
+    ascribe("CurrCoiTable0Limit"  , &DBDictionary::CurrCoiTable0Limit  );
+    ascribe("CurrCoiTable1"       , &DBDictionary::CurrCoiTable1       );
+    ascribe("CurrCoiTable1Limit"  , &DBDictionary::CurrCoiTable1Limit  );
+    ascribe("CurrCoiTable2"       , &DBDictionary::CurrCoiTable2       );
+    ascribe("MdptCoiTable"        , &DBDictionary::MdptCoiTable        );
+    ascribe("MdptCoiIsAnnual"     , &DBDictionary::MdptCoiIsAnnual     );
+    ascribe("CoiNyMinTable"       , &DBDictionary::CoiNyMinTable       );
+    ascribe("UseNyCoiFloor"       , &DBDictionary::UseNyCoiFloor       );
+    ascribe("MaxMonthlyCoiRate"   , &DBDictionary::MaxMonthlyCoiRate   );
+    ascribe("GuarCoiCeiling"      , &DBDictionary::GuarCoiCeiling      );
+    ascribe("CoiGuarIsMin"        , &DBDictionary::CoiGuarIsMin        );
+    ascribe("SubstdTableMult"     , &DBDictionary::SubstdTableMult     );
+    ascribe("SubstdTableMultTable", &DBDictionary::SubstdTableMultTable);
+    ascribe("CoiUpper12Method"    , &DBDictionary::CoiUpper12Method    );
+    ascribe("CoiInforceReentry"   , &DBDictionary::CoiInforceReentry   );
+    ascribe("AllowMortBlendSex"   , &DBDictionary::AllowMortBlendSex   );
+    ascribe("AllowMortBlendSmoke" , &DBDictionary::AllowMortBlendSmoke );
+    ascribe("GuarInt"             , &DBDictionary::GuarInt             );
+    ascribe("NaarDiscount"        , &DBDictionary::NaarDiscount        );
+    ascribe("GuarIntSpread"       , &DBDictionary::GuarIntSpread       );
+    ascribe("GuarMandE"           , &DBDictionary::GuarMandE           );
+    ascribe("CurrIntSpread"       , &DBDictionary::CurrIntSpread       );
+    ascribe("CurrMandE"           , &DBDictionary::CurrMandE           );
+    ascribe("GenAcctIntBonus"     , &DBDictionary::GenAcctIntBonus     );
+    ascribe("BonusInt"            , &DBDictionary::BonusInt            );
+    ascribe("IntFloor"            , &DBDictionary::IntFloor            );
+    ascribe("MaxGenAcctRate"      , &DBDictionary::MaxGenAcctRate      );
+    ascribe("MaxSepAcctRate"      , &DBDictionary::MaxSepAcctRate      );
+    ascribe("SepAcctSpreadMethod" , &DBDictionary::SepAcctSpreadMethod );
+    ascribe("IntSpreadMode"       , &DBDictionary::IntSpreadMode       );
+    ascribe("DynamicMandE"        , &DBDictionary::DynamicMandE        );
+    ascribe("AllowAmortPremLoad"  , &DBDictionary::AllowAmortPremLoad  );
+    ascribe("LoadAmortFundCharge" , &DBDictionary::LoadAmortFundCharge );
+    ascribe("AllowImfOverride"    , &DBDictionary::AllowImfOverride    );
+    ascribe("AssetChargeType"     , &DBDictionary::AssetChargeType     );
+    ascribe("StableValFundCharge" , &DBDictionary::StableValFundCharge );
+    ascribe("GuarFundAdminChg"    , &DBDictionary::GuarFundAdminChg    );
+    ascribe("CurrFundAdminChg"    , &DBDictionary::CurrFundAdminChg    );
+    ascribe("FundCharge"          , &DBDictionary::FundCharge          );
+    ascribe("GuarMonthlyPolFee"   , &DBDictionary::GuarMonthlyPolFee   );
+    ascribe("GuarAnnualPolFee"    , &DBDictionary::GuarAnnualPolFee    );
+    ascribe("GuarPremLoadTgt"     , &DBDictionary::GuarPremLoadTgt     );
+    ascribe("GuarPremLoadExc"     , &DBDictionary::GuarPremLoadExc     );
+    ascribe("GuarPremLoadTgtRfd"  , &DBDictionary::GuarPremLoadTgtRfd  );
+    ascribe("GuarPremLoadExcRfd"  , &DBDictionary::GuarPremLoadExcRfd  );
+    ascribe("GuarSpecAmtLoad"     , &DBDictionary::GuarSpecAmtLoad     );
+    ascribe("GuarSpecAmtLoadTable", &DBDictionary::GuarSpecAmtLoadTable);
+    ascribe("GuarAcctValLoad"     , &DBDictionary::GuarAcctValLoad     );
+    ascribe("CurrMonthlyPolFee"   , &DBDictionary::CurrMonthlyPolFee   );
+    ascribe("CurrAnnualPolFee"    , &DBDictionary::CurrAnnualPolFee    );
+    ascribe("CurrPremLoadTgt"     , &DBDictionary::CurrPremLoadTgt     );
+    ascribe("CurrPremLoadExc"     , &DBDictionary::CurrPremLoadExc     );
+    ascribe("CurrPremLoadTgtRfd"  , &DBDictionary::CurrPremLoadTgtRfd  );
+    ascribe("CurrPremLoadExcRfd"  , &DBDictionary::CurrPremLoadExcRfd  );
+    ascribe("CurrSpecAmtLoad"     , &DBDictionary::CurrSpecAmtLoad     );
+    ascribe("CurrSpecAmtLoadTable", &DBDictionary::CurrSpecAmtLoadTable);
+    ascribe("CurrAcctValLoad"     , &DBDictionary::CurrAcctValLoad     );
+    ascribe("TgtPremMonthlyPolFee", &DBDictionary::TgtPremMonthlyPolFee);
+    ascribe("LoadRfdProportion"   , &DBDictionary::LoadRfdProportion   );
+    ascribe("SpecAmtLoadLimit"    , &DBDictionary::SpecAmtLoadLimit    );
+    ascribe("DynamicSepAcctLoad"  , &DBDictionary::DynamicSepAcctLoad  );
+    ascribe("DynSepAcctLoadLimit" , &DBDictionary::DynSepAcctLoadLimit );
+    ascribe("DacTaxFundCharge"    , &DBDictionary::DacTaxFundCharge    );
+    ascribe("DacTaxPremLoad"      , &DBDictionary::DacTaxPremLoad      );
+    ascribe("PremTaxFundCharge"   , &DBDictionary::PremTaxFundCharge   );
+    ascribe("PremTaxLoad"         , &DBDictionary::PremTaxLoad         );
+    ascribe("WaivePremTaxInt1035" , &DBDictionary::WaivePremTaxInt1035 );
+    ascribe("PremTaxRetalLimit"   , &DBDictionary::PremTaxRetalLimit   );
+    ascribe("PremTaxTierGroup"    , &DBDictionary::PremTaxTierGroup    );
+    ascribe("PremTaxTierPeriod"   , &DBDictionary::PremTaxTierPeriod   );
+    ascribe("PremTaxTierNonDecr"  , &DBDictionary::PremTaxTierNonDecr  );
+    ascribe("PremTaxAmortPeriod"  , &DBDictionary::PremTaxAmortPeriod  );
+    ascribe("PremTaxAmortIntRate" , &DBDictionary::PremTaxAmortIntRate );
+    ascribe("PremTaxRate"         , &DBDictionary::PremTaxRate         );
+    ascribe("PremTaxState"        , &DBDictionary::PremTaxState        );
+    ascribe("PremTaxTable"        , &DBDictionary::PremTaxTable        );
+    ascribe("SurrChgAcctValMult"  , &DBDictionary::SurrChgAcctValMult  );
+    ascribe("SurrChgAcctValSlope" , &DBDictionary::SurrChgAcctValSlope );
+    ascribe("SurrChgSpecAmtMult"  , &DBDictionary::SurrChgSpecAmtMult  );
+    ascribe("SurrChgSpecAmtSlope" , &DBDictionary::SurrChgSpecAmtSlope );
+    ascribe("SurrChgPremMult"     , &DBDictionary::SurrChgPremMult     );
+    ascribe("SurrChgOnIncr"       , &DBDictionary::SurrChgOnIncr       );
+    ascribe("SurrChgOnDecr"       , &DBDictionary::SurrChgOnDecr       );
+    ascribe("Has1035ExchCharge"   , &DBDictionary::Has1035ExchCharge   );
+    ascribe("SnflQTable"          , &DBDictionary::SnflQTable          );
+    ascribe("CoiSnflIsGuar"       , &DBDictionary::CoiSnflIsGuar       );
+    ascribe("SurrChgByFormula"    , &DBDictionary::SurrChgByFormula    );
+    ascribe("SurrChgPeriod"       , &DBDictionary::SurrChgPeriod       );
+    ascribe("SurrChgZeroDur"      , &DBDictionary::SurrChgZeroDur      );
+    ascribe("SurrChgNlpMult"      , &DBDictionary::SurrChgNlpMult      );
+    ascribe("SurrChgNlpMax"       , &DBDictionary::SurrChgNlpMax       );
+    ascribe("SurrChgEaMax"        , &DBDictionary::SurrChgEaMax        );
+    ascribe("SurrChgAmort"        , &DBDictionary::SurrChgAmort        );
+    ascribe("AllowSpecAmtIncr"    , &DBDictionary::AllowSpecAmtIncr    );
+    ascribe("MinSpecAmtIncr"      , &DBDictionary::MinSpecAmtIncr      );
+    ascribe("EnforceNaarLimit"    , &DBDictionary::EnforceNaarLimit    );
+    ascribe("MinSpecAmt"          , &DBDictionary::MinSpecAmt          );
+    ascribe("MinIssSpecAmt"       , &DBDictionary::MinIssSpecAmt       );
+    ascribe("MinRenlSpecAmt"      , &DBDictionary::MinRenlSpecAmt      );
+    ascribe("MinRenlBaseSpecAmt"  , &DBDictionary::MinRenlBaseSpecAmt  );
+    ascribe("MaxIssSpecAmt"       , &DBDictionary::MaxIssSpecAmt       );
+    ascribe("MaxRenlSpecAmt"      , &DBDictionary::MaxRenlSpecAmt      );
+    ascribe("AllowDbo1"           , &DBDictionary::AllowDbo1           );
+    ascribe("AllowDbo2"           , &DBDictionary::AllowDbo2           );
+    ascribe("AllowDbo3"           , &DBDictionary::AllowDbo3           );
+    ascribe("AllowChangeToDbo2"   , &DBDictionary::AllowChangeToDbo2   );
+    ascribe("DboChgCanIncrSpecAmt", &DBDictionary::DboChgCanIncrSpecAmt);
+    ascribe("DboChgCanDecrSpecAmt", &DBDictionary::DboChgCanDecrSpecAmt);
+    ascribe("AllowExtEndt"        , &DBDictionary::AllowExtEndt        );
+    ascribe("AllowTerm"           , &DBDictionary::AllowTerm           );
+    ascribe("GuarTermTable"       , &DBDictionary::GuarTermTable       );
+    ascribe("TermTable"           , &DBDictionary::TermTable           );
+    ascribe("TermMinIssAge"       , &DBDictionary::TermMinIssAge       );
+    ascribe("TermMaxIssAge"       , &DBDictionary::TermMaxIssAge       );
+    ascribe("TermForcedConvAge"   , &DBDictionary::TermForcedConvAge   );
+    ascribe("MaxTermProportion"   , &DBDictionary::MaxTermProportion   );
+    ascribe("TermCoiRate"         , &DBDictionary::TermCoiRate         );
+    ascribe("TermPremRate"        , &DBDictionary::TermPremRate        );
+    ascribe("AllowWp"             , &DBDictionary::AllowWp             );
+    ascribe("WpTable"             , &DBDictionary::WpTable             );
+    ascribe("WpMinIssAge"         , &DBDictionary::WpMinIssAge         );
+    ascribe("WpMaxIssAge"         , &DBDictionary::WpMaxIssAge         );
+    ascribe("WpMax"               , &DBDictionary::WpMax               );
+    ascribe("WpCoiRate"           , &DBDictionary::WpCoiRate           );
+    ascribe("WpPremRate"          , &DBDictionary::WpPremRate          );
+    ascribe("WpChargeMethod"      , &DBDictionary::WpChargeMethod      );
+    ascribe("AllowAdb"            , &DBDictionary::AllowAdb            );
+    ascribe("AdbTable"            , &DBDictionary::AdbTable            );
+    ascribe("AdbMinIssAge"        , &DBDictionary::AdbMinIssAge        );
+    ascribe("AdbMaxIssAge"        , &DBDictionary::AdbMaxIssAge        );
+    ascribe("AdbLimit"            , &DBDictionary::AdbLimit            );
+    ascribe("AdbCoiRate"          , &DBDictionary::AdbCoiRate          );
+    ascribe("AdbPremRate"         , &DBDictionary::AdbPremRate         );
+    ascribe("AllowSpouseRider"    , &DBDictionary::AllowSpouseRider    );
+    ascribe("SpouseRiderGuarTable", &DBDictionary::SpouseRiderGuarTable);
+    ascribe("SpouseRiderTable"    , &DBDictionary::SpouseRiderTable    );
+    ascribe("AllowChildRider"     , &DBDictionary::AllowChildRider     );
+    ascribe("ChildRiderTable"     , &DBDictionary::ChildRiderTable     );
+    ascribe("AllowWd"             , &DBDictionary::AllowWd             );
+    ascribe("WdFee"               , &DBDictionary::WdFee               );
+    ascribe("WdFeeRate"           , &DBDictionary::WdFeeRate           );
+    ascribe("FreeWdProportion"    , &DBDictionary::FreeWdProportion    );
+    ascribe("MinWd"               , &DBDictionary::MinWd               );
+    ascribe("MaxWdAcctValMult"    , &DBDictionary::MaxWdAcctValMult    );
+    ascribe("MaxWdDed"            , &DBDictionary::MaxWdDed            );
+    ascribe("WdCanDecrSpecAmtDbo1", &DBDictionary::WdCanDecrSpecAmtDbo1);
+    ascribe("WdCanDecrSpecAmtDbo2", &DBDictionary::WdCanDecrSpecAmtDbo2);
+    ascribe("WdCanDecrSpecAmtDbo3", &DBDictionary::WdCanDecrSpecAmtDbo3);
+    ascribe("FirstWdYear"         , &DBDictionary::FirstWdYear         );
+    ascribe("AllowLoan"           , &DBDictionary::AllowLoan           );
+    ascribe("AllowPrefLoan"       , &DBDictionary::AllowPrefLoan       );
+    ascribe("AllowFixedLoan"      , &DBDictionary::AllowFixedLoan      );
+    ascribe("AllowVlr"            , &DBDictionary::AllowVlr            );
+    ascribe("FixedLoanRate"       , &DBDictionary::FixedLoanRate       );
+    ascribe("MaxVlrRate"          , &DBDictionary::MaxVlrRate          );
+    ascribe("MaxLoanAcctValMult"  , &DBDictionary::MaxLoanAcctValMult  );
+    ascribe("MaxLoanDed"          , &DBDictionary::MaxLoanDed          );
+    ascribe("GuarPrefLoanSpread"  , &DBDictionary::GuarPrefLoanSpread  );
+    ascribe("GuarRegLoanSpread"   , &DBDictionary::GuarRegLoanSpread   );
+    ascribe("CurrPrefLoanSpread"  , &DBDictionary::CurrPrefLoanSpread  );
+    ascribe("CurrRegLoanSpread"   , &DBDictionary::CurrRegLoanSpread   );
+    ascribe("FirstLoanYear"       , &DBDictionary::FirstLoanYear       );
+    ascribe("MinPremType"         , &DBDictionary::MinPremType         );
+    ascribe("MinPremIntSpread"    , &DBDictionary::MinPremIntSpread    );
+    ascribe("TgtPremType"         , &DBDictionary::TgtPremType         );
+    ascribe("TgtPremTable"        , &DBDictionary::TgtPremTable        );
+    ascribe("TgtPremFixedAtIssue" , &DBDictionary::TgtPremFixedAtIssue );
+    ascribe("TgtPremIgnoreSubstd" , &DBDictionary::TgtPremIgnoreSubstd );
+    ascribe("MinPmt"              , &DBDictionary::MinPmt              );
+    ascribe("NoLapseMinDur"       , &DBDictionary::NoLapseMinDur       );
+    ascribe("NoLapseMinAge"       , &DBDictionary::NoLapseMinAge       );
+    ascribe("NoLapseUnratedOnly"  , &DBDictionary::NoLapseUnratedOnly  );
+    ascribe("NoLapseDbo1Only"     , &DBDictionary::NoLapseDbo1Only     );
+    ascribe("NoLapseAlwaysActive" , &DBDictionary::NoLapseAlwaysActive );
+    ascribe("AllowHoneymoon"      , &DBDictionary::AllowHoneymoon      );
+    ascribe("AllowGenAcct"        , &DBDictionary::AllowGenAcct        );
+    ascribe("AllowSepAcct"        , &DBDictionary::AllowSepAcct        );
+    ascribe("DeductionMethod"     , &DBDictionary::DeductionMethod     );
+    ascribe("DeductionAcct"       , &DBDictionary::DeductionAcct       );
+    ascribe("DistributionMethod"  , &DBDictionary::DistributionMethod  );
+    ascribe("DistributionAcct"    , &DBDictionary::DistributionAcct    );
+    ascribe("EePremMethod"        , &DBDictionary::EePremMethod        );
+    ascribe("EePremAcct"          , &DBDictionary::EePremAcct          );
+    ascribe("ErPremMethod"        , &DBDictionary::ErPremMethod        );
+    ascribe("ErPremAcct"          , &DBDictionary::ErPremAcct          );
+    ascribe("CompTarget"          , &DBDictionary::CompTarget          );
+    ascribe("CompExcess"          , &DBDictionary::CompExcess          );
+    ascribe("CompChargeBack"      , &DBDictionary::CompChargeBack      );
+    ascribe("AssetComp"           , &DBDictionary::AssetComp           );
+    ascribe("AllowExtraAssetComp" , &DBDictionary::AllowExtraAssetComp );
+    ascribe("AllowExtraPremComp"  , &DBDictionary::AllowExtraPremComp  );
+    ascribe("AllowExpRating"      , &DBDictionary::AllowExpRating      );
+    ascribe("ExpRatStdDevMult"    , &DBDictionary::ExpRatStdDevMult    );
+    ascribe("ExpRatIbnrMult"      , &DBDictionary::ExpRatIbnrMult      );
+    ascribe("ExpRatCoiRetention"  , &DBDictionary::ExpRatCoiRetention  );
+    ascribe("ExpRatRiskCoiMult"   , &DBDictionary::ExpRatRiskCoiMult   );
+    ascribe("ExpRatAmortPeriod"   , &DBDictionary::ExpRatAmortPeriod   );
+    ascribe("LedgerType"          , &DBDictionary::LedgerType          );
+    ascribe("AgeLastOrNearest"    , &DBDictionary::AgeLastOrNearest    );
+    ascribe("MaxIllusAge"         , &DBDictionary::MaxIllusAge         );
+    ascribe("MaturityAge"         , &DBDictionary::MaturityAge         );
+    ascribe("LapseIgnoresSurrChg" , &DBDictionary::LapseIgnoresSurrChg );
+    ascribe("DefaultProcessOrder" , &DBDictionary::DefaultProcessOrder );
+    ascribe("NominallyPar"        , &DBDictionary::NominallyPar        );
+    ascribe("TableYTable"         , &DBDictionary::TableYTable         );
+    ascribe("Gam83Table"          , &DBDictionary::Gam83Table          );
+    ascribe("WeightClass"         , &DBDictionary::WeightClass         );
+    ascribe("WeightGender"        , &DBDictionary::WeightGender        );
+    ascribe("WeightSmoking"       , &DBDictionary::WeightSmoking       );
+    ascribe("WeightAge"           , &DBDictionary::WeightAge           );
+    ascribe("WeightSpecAmt"       , &DBDictionary::WeightSpecAmt       );
+    ascribe("WeightState"         , &DBDictionary::WeightState         );
+    ascribe("FullExpPol"          , &DBDictionary::FullExpPol          );
+    ascribe("FullExpPrem"         , &DBDictionary::FullExpPrem         );
+    ascribe("FullExpDumpin"       , &DBDictionary::FullExpDumpin       );
+    ascribe("FullExpSpecAmt"      , &DBDictionary::FullExpSpecAmt      );
+    ascribe("VarExpPol"           , &DBDictionary::VarExpPol           );
+    ascribe("VarExpPrem"          , &DBDictionary::VarExpPrem          );
+    ascribe("VarExpDumpin"        , &DBDictionary::VarExpDumpin        );
+    ascribe("VarExpSpecAmt"       , &DBDictionary::VarExpSpecAmt       );
+    ascribe("ExpSpecAmtLimit"     , &DBDictionary::ExpSpecAmtLimit     );
+    ascribe("MedicalProportion"   , &DBDictionary::MedicalProportion   );
+    ascribe("UwTestCost"          , &DBDictionary::UwTestCost          );
+    ascribe("VxBasicQTable"       , &DBDictionary::VxBasicQTable       );
+    ascribe("VxDeficQTable"       , &DBDictionary::VxDeficQTable       );
+    ascribe("VxTaxQTable"         , &DBDictionary::VxTaxQTable         );
+    ascribe("StatVxInt"           , &DBDictionary::StatVxInt           );
+    ascribe("TaxVxInt"            , &DBDictionary::TaxVxInt            );
+    ascribe("StatVxQ"             , &DBDictionary::StatVxQ             );
+    ascribe("TaxVxQ"              , &DBDictionary::TaxVxQ              );
+    ascribe("DefVxQ"              , &DBDictionary::DefVxQ              );
+    ascribe("SnflQ"               , &DBDictionary::SnflQ               );
+    ascribe("LapseRate"           , &DBDictionary::LapseRate           );
+    ascribe("ReqSurpNaar"         , &DBDictionary::ReqSurpNaar         );
+    ascribe("ReqSurpVx"           , &DBDictionary::ReqSurpVx           );
+    ascribe("LicFitRate"          , &DBDictionary::LicFitRate          );
+    ascribe("LicDacTaxRate"       , &DBDictionary::LicDacTaxRate       );
+    ascribe("GdbVxMethod"         , &DBDictionary::GdbVxMethod         );
+    ascribe("PrimaryHurdle"       , &DBDictionary::PrimaryHurdle       );
+    ascribe("SecondaryHurdle"     , &DBDictionary::SecondaryHurdle     );
+}
+
 namespace
 {
 std::string xml_root_name()
@@ -139,11 +399,6 @@
 }
 } // Unnamed namespace.
 
-dict_map const& DBDictionary::GetDictionary() const
-{
-    return dictionary_;
-}
-
 /// Read and cache a database file.
 ///
 /// Perform the expensive operation of reading the dictionary from
@@ -172,21 +427,10 @@
 
     xml_lmi::dom_parser parser(filename);
     xml::element const& root = parser.root_node(xml_root_name());
-
-    xml_serialize::from_xml(root, dictionary_);
-
-    if(NumberOfLeaves != dictionary_.size())
+    typedef std::vector<std::string>::const_iterator svci;
+    for(svci i = member_names().begin(); i != member_names().end(); ++i)
         {
-        InvalidateCache();
-        fatal_error()
-            << "File '"
-            << filename
-            << "' is not up to date or is corrupted."
-            << " It should contain " << NumberOfLeaves
-            << " elements, but it actually contains " << dictionary_.size()
-            << " elements."
-            << LMI_FLUSH
-            ;
+        xml_serialize::get_element(root, *i, datum(*i));
         }
 }
 
@@ -204,31 +448,16 @@
 void DBDictionary::WriteDB(std::string const& filename)
 {
     InvalidateCache();
-    // When the GUI product editor loads a file and later saves it,
-    // its database contains only leaf entries.
-    if(NumberOfLeaves != dictionary_.size() && NumberOfEntries != 
dictionary_.size())
-        {
-        fatal_error()
-            << "Error writing database '"
-            << filename
-            << "': the database has " << dictionary_.size()
-            << " entries, but should have " << NumberOfEntries << '.'
-            ;
-        for(unsigned int j = 0; j < NumberOfEntries; j++)
-            {
-            if(!dictionary_.count(j))
-                {
-                fatal_error() << " Key " << j << " not found.";
-                }
-            }
-        fatal_error() << LMI_FLUSH;
-        }
 
     xml_lmi::xml_document document(xml_root_name());
     xml::element& root = document.root_node();
 
     xml_lmi::set_attr(root, "version", "0");
-    xml_serialize::to_xml(root, dictionary_);
+    typedef std::vector<std::string>::const_iterator svci;
+    for(svci i = member_names().begin(); i != member_names().end(); ++i)
+        {
+        xml_serialize::set_element(root, *i, datum(*i));
+        }
 
     // Instead of this:
 //    document.save(filename);
@@ -239,11 +468,11 @@
     document.save(path.string());
 }
 
-/// Add an entry to the dictionary.
+/// Set a value. (The historical name "Add" is now misleading.)
 
 void DBDictionary::Add(database_entity const& e)
 {
-    dictionary_[e.key()] = e;
+    datum(db_name_from_key(e.key())) = e;
 }
 
 /// Initialize all database entities to not-necessarily-plausible values.
@@ -252,10 +481,10 @@
 {
     static double const bignum = std::numeric_limits<double>::max();
 
-    dictionary_.clear();
-    for(int j = DB_FIRST; j < DB_LAST; ++j)
+    typedef std::vector<std::string>::const_iterator svci;
+    for(svci i = member_names().begin(); i != member_names().end(); ++i)
         {
-        Add(database_entity(j, 0.0));
+        Add(database_entity(db_key_from_name(*i), 0.0));
         }
 
     // It would be dangerous to set these to zero.
@@ -682,14 +911,13 @@
 
 void DBDictionary::InitAntediluvian()
 {
-    dictionary_.clear();
-
     // Zero is inappropriate for some entities ("DB_CurrCoiMultiplier",
     // e.g.), but the antediluvian branch doesn't actually use most
     // database entities.
-    for(int j = DB_FIRST; j < DB_LAST; ++j)
+    typedef std::vector<std::string>::const_iterator svci;
+    for(svci i = member_names().begin(); i != member_names().end(); ++i)
         {
-        Add(database_entity(j, 0.0));
+        Add(database_entity(db_key_from_name(*i), 0.0));
         }
 
     Add(database_entity(DB_GuarInt, 0.03));
@@ -806,13 +1034,11 @@
             }
         fs::path out_file = fs::change_extension(*i, ".dbt");
         fs::ofstream os(out_file, ios_out_trunc_binary());
-        dict_map const& dictionary = DBDictionary::instance().GetDictionary();
-        // std::ostream_iterator not used because it doesn't work
-        // nicely with std::map (a name-lookup issue).
-        typedef dict_map::const_iterator dmci;
-        for(dmci i = dictionary.begin(); i != dictionary.end(); ++i)
+        DBDictionary const& z = DBDictionary::instance();
+        typedef std::vector<std::string>::const_iterator svci;
+        for(svci i = z.member_names().begin(); i != z.member_names().end(); 
++i)
             {
-            i->second.write(os);
+            z.datum(*i).write(os);
             }
         }
 }

Modified: lmi/trunk/dbdict.hpp
===================================================================
--- lmi/trunk/dbdict.hpp        2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/dbdict.hpp        2010-06-06 23:21:21 UTC (rev 4976)
@@ -26,22 +26,21 @@
 
 #include "config.hpp"
 
-#include "dbvalue.hpp" // Needed here for map declaration.
+#include "any_member.hpp"
+#include "dbvalue.hpp"
 #include "obstruct_slicing.hpp"
 #include "so_attributes.hpp"
 
 #include <boost/utility.hpp>
 
-#include <map>
 #include <string>
 
-typedef std::map<int, database_entity> dict_map;
-
 /// Cached product database.
 
 class LMI_SO DBDictionary
-    :private boost::noncopyable
-    ,virtual private obstruct_slicing<DBDictionary>
+    :        private boost::noncopyable
+    ,virtual private obstruct_slicing  <DBDictionary>
+    ,        public  MemberSymbolTable <DBDictionary>
 {
     friend class DatabaseDocument;
     friend class input_test;
@@ -51,7 +50,7 @@
     static DBDictionary& instance();
     ~DBDictionary();
 
-    dict_map const& GetDictionary() const;
+    database_entity const& datum(std::string const&) const;
 
     void Init(std::string const& filename);
     void WriteSampleDBFile();
@@ -62,6 +61,10 @@
   private:
     DBDictionary();
 
+    void ascribe_members();
+
+    database_entity& datum(std::string const&);
+
     void WriteDB(std::string const& filename);
     void Add(database_entity const&);
     void InitDB();
@@ -70,7 +73,285 @@
 
     static std::string cached_filename_;
 
-    dict_map dictionary_;
+    database_entity MinIssAge           ;
+    database_entity MaxIssAge           ;
+    database_entity MaxIncrAge          ;
+    database_entity AllowFullUw         ;
+    database_entity AllowSimpUw         ;
+    database_entity AllowGuarUw         ;
+    database_entity SmokeOrTobacco      ;
+    database_entity PrefOrSelect        ;
+    database_entity AllowPreferredClass ;
+    database_entity AllowUltraPrefClass ;
+    database_entity AllowSubstdTable    ;
+    database_entity AllowFlatExtras     ;
+    database_entity AllowRatedWp        ;
+    database_entity AllowRatedAdb       ;
+    database_entity AllowRatedTerm      ;
+    database_entity AllowRetirees       ;
+    database_entity AllowUnisex         ;
+    database_entity AllowSexDistinct    ;
+    database_entity AllowUnismoke       ;
+    database_entity AllowSmokeDistinct  ;
+    database_entity StateApproved       ;
+    database_entity AllowStateXX        ;
+    database_entity AllowForeign        ;
+    database_entity Allowable           ;
+    database_entity AllowCvat           ;
+    database_entity AllowGpt            ;
+    database_entity AllowNo7702         ;
+    database_entity CorridorTable       ;
+    database_entity SevenPayTable       ;
+    database_entity Irc7702QTable       ;
+    database_entity PremLoad7702        ;
+    database_entity Equiv7702Dbo3       ;
+    database_entity GuarCoiTable        ;
+    database_entity GuarCoiIsAnnual     ;
+    database_entity GuarCoiMultiplier   ;
+    database_entity CurrCoiTable        ;
+    database_entity CurrCoiIsAnnual     ;
+    database_entity CurrCoiMultiplier   ;
+    database_entity UnusualCoiBanding   ;
+    database_entity CurrCoiTable0Limit  ;
+    database_entity CurrCoiTable1       ;
+    database_entity CurrCoiTable1Limit  ;
+    database_entity CurrCoiTable2       ;
+    database_entity MdptCoiTable        ;
+    database_entity MdptCoiIsAnnual     ;
+    database_entity CoiNyMinTable       ;
+    database_entity UseNyCoiFloor       ;
+    database_entity MaxMonthlyCoiRate   ;
+    database_entity GuarCoiCeiling      ;
+    database_entity CoiGuarIsMin        ;
+    database_entity SubstdTableMult     ;
+    database_entity SubstdTableMultTable;
+    database_entity CoiUpper12Method    ;
+    database_entity CoiInforceReentry   ;
+    database_entity AllowMortBlendSex   ;
+    database_entity AllowMortBlendSmoke ;
+    database_entity GuarInt             ;
+    database_entity NaarDiscount        ;
+    database_entity GuarIntSpread       ;
+    database_entity GuarMandE           ;
+    database_entity CurrIntSpread       ;
+    database_entity CurrMandE           ;
+    database_entity GenAcctIntBonus     ;
+    database_entity BonusInt            ;
+    database_entity IntFloor            ;
+    database_entity MaxGenAcctRate      ;
+    database_entity MaxSepAcctRate      ;
+    database_entity SepAcctSpreadMethod ;
+    database_entity IntSpreadMode       ;
+    database_entity DynamicMandE        ;
+    database_entity AllowAmortPremLoad  ;
+    database_entity LoadAmortFundCharge ;
+    database_entity AllowImfOverride    ;
+    database_entity AssetChargeType     ;
+    database_entity StableValFundCharge ;
+    database_entity GuarFundAdminChg    ;
+    database_entity CurrFundAdminChg    ;
+    database_entity FundCharge          ;
+    database_entity GuarMonthlyPolFee   ;
+    database_entity GuarAnnualPolFee    ;
+    database_entity GuarPremLoadTgt     ;
+    database_entity GuarPremLoadExc     ;
+    database_entity GuarPremLoadTgtRfd  ;
+    database_entity GuarPremLoadExcRfd  ;
+    database_entity GuarSpecAmtLoad     ;
+    database_entity GuarSpecAmtLoadTable;
+    database_entity GuarAcctValLoad     ;
+    database_entity CurrMonthlyPolFee   ;
+    database_entity CurrAnnualPolFee    ;
+    database_entity CurrPremLoadTgt     ;
+    database_entity CurrPremLoadExc     ;
+    database_entity CurrPremLoadTgtRfd  ;
+    database_entity CurrPremLoadExcRfd  ;
+    database_entity CurrSpecAmtLoad     ;
+    database_entity CurrSpecAmtLoadTable;
+    database_entity CurrAcctValLoad     ;
+    database_entity TgtPremMonthlyPolFee;
+    database_entity LoadRfdProportion   ;
+    database_entity SpecAmtLoadLimit    ;
+    database_entity DynamicSepAcctLoad  ;
+    database_entity DynSepAcctLoadLimit ;
+    database_entity DacTaxFundCharge    ;
+    database_entity DacTaxPremLoad      ;
+    database_entity PremTaxFundCharge   ;
+    database_entity PremTaxLoad         ;
+    database_entity WaivePremTaxInt1035 ;
+    database_entity PremTaxRetalLimit   ;
+    database_entity PremTaxTierGroup    ;
+    database_entity PremTaxTierPeriod   ;
+    database_entity PremTaxTierNonDecr  ;
+    database_entity PremTaxAmortPeriod  ;
+    database_entity PremTaxAmortIntRate ;
+    database_entity PremTaxRate         ;
+    database_entity PremTaxState        ;
+    database_entity PremTaxTable        ;
+    database_entity SurrChgAcctValMult  ;
+    database_entity SurrChgAcctValSlope ;
+    database_entity SurrChgSpecAmtMult  ;
+    database_entity SurrChgSpecAmtSlope ;
+    database_entity SurrChgPremMult     ;
+    database_entity SurrChgOnIncr       ;
+    database_entity SurrChgOnDecr       ;
+    database_entity Has1035ExchCharge   ;
+    database_entity SnflQTable          ;
+    database_entity CoiSnflIsGuar       ;
+    database_entity SurrChgByFormula    ;
+    database_entity SurrChgPeriod       ;
+    database_entity SurrChgZeroDur      ;
+    database_entity SurrChgNlpMult      ;
+    database_entity SurrChgNlpMax       ;
+    database_entity SurrChgEaMax        ;
+    database_entity SurrChgAmort        ;
+    database_entity AllowSpecAmtIncr    ;
+    database_entity MinSpecAmtIncr      ;
+    database_entity EnforceNaarLimit    ;
+    database_entity MinSpecAmt          ;
+    database_entity MinIssSpecAmt       ;
+    database_entity MinRenlSpecAmt      ;
+    database_entity MinRenlBaseSpecAmt  ;
+    database_entity MaxIssSpecAmt       ;
+    database_entity MaxRenlSpecAmt      ;
+    database_entity AllowDbo1           ;
+    database_entity AllowDbo2           ;
+    database_entity AllowDbo3           ;
+    database_entity AllowChangeToDbo2   ;
+    database_entity DboChgCanIncrSpecAmt;
+    database_entity DboChgCanDecrSpecAmt;
+    database_entity AllowExtEndt        ;
+    database_entity AllowTerm           ;
+    database_entity GuarTermTable       ;
+    database_entity TermTable           ;
+    database_entity TermMinIssAge       ;
+    database_entity TermMaxIssAge       ;
+    database_entity TermForcedConvAge   ;
+    database_entity MaxTermProportion   ;
+    database_entity TermCoiRate         ;
+    database_entity TermPremRate        ;
+    database_entity AllowWp             ;
+    database_entity WpTable             ;
+    database_entity WpMinIssAge         ;
+    database_entity WpMaxIssAge         ;
+    database_entity WpMax               ;
+    database_entity WpCoiRate           ;
+    database_entity WpPremRate          ;
+    database_entity WpChargeMethod      ;
+    database_entity AllowAdb            ;
+    database_entity AdbTable            ;
+    database_entity AdbMinIssAge        ;
+    database_entity AdbMaxIssAge        ;
+    database_entity AdbLimit            ;
+    database_entity AdbCoiRate          ;
+    database_entity AdbPremRate         ;
+    database_entity AllowSpouseRider    ;
+    database_entity SpouseRiderGuarTable;
+    database_entity SpouseRiderTable    ;
+    database_entity AllowChildRider     ;
+    database_entity ChildRiderTable     ;
+    database_entity AllowWd             ;
+    database_entity WdFee               ;
+    database_entity WdFeeRate           ;
+    database_entity FreeWdProportion    ;
+    database_entity MinWd               ;
+    database_entity MaxWdAcctValMult    ;
+    database_entity MaxWdDed            ;
+    database_entity WdCanDecrSpecAmtDbo1;
+    database_entity WdCanDecrSpecAmtDbo2;
+    database_entity WdCanDecrSpecAmtDbo3;
+    database_entity FirstWdYear         ;
+    database_entity AllowLoan           ;
+    database_entity AllowPrefLoan       ;
+    database_entity AllowFixedLoan      ;
+    database_entity AllowVlr            ;
+    database_entity FixedLoanRate       ;
+    database_entity MaxVlrRate          ;
+    database_entity MaxLoanAcctValMult  ;
+    database_entity MaxLoanDed          ;
+    database_entity GuarPrefLoanSpread  ;
+    database_entity GuarRegLoanSpread   ;
+    database_entity CurrPrefLoanSpread  ;
+    database_entity CurrRegLoanSpread   ;
+    database_entity FirstLoanYear       ;
+    database_entity MinPremType         ;
+    database_entity MinPremIntSpread    ;
+    database_entity TgtPremType         ;
+    database_entity TgtPremTable        ;
+    database_entity TgtPremFixedAtIssue ;
+    database_entity TgtPremIgnoreSubstd ;
+    database_entity MinPmt              ;
+    database_entity NoLapseMinDur       ;
+    database_entity NoLapseMinAge       ;
+    database_entity NoLapseUnratedOnly  ;
+    database_entity NoLapseDbo1Only     ;
+    database_entity NoLapseAlwaysActive ;
+    database_entity AllowHoneymoon      ;
+    database_entity AllowGenAcct        ;
+    database_entity AllowSepAcct        ;
+    database_entity DeductionMethod     ;
+    database_entity DeductionAcct       ;
+    database_entity DistributionMethod  ;
+    database_entity DistributionAcct    ;
+    database_entity EePremMethod        ;
+    database_entity EePremAcct          ;
+    database_entity ErPremMethod        ;
+    database_entity ErPremAcct          ;
+    database_entity CompTarget          ;
+    database_entity CompExcess          ;
+    database_entity CompChargeBack      ;
+    database_entity AssetComp           ;
+    database_entity AllowExtraAssetComp ;
+    database_entity AllowExtraPremComp  ;
+    database_entity AllowExpRating      ;
+    database_entity ExpRatStdDevMult    ;
+    database_entity ExpRatIbnrMult      ;
+    database_entity ExpRatCoiRetention  ;
+    database_entity ExpRatRiskCoiMult   ;
+    database_entity ExpRatAmortPeriod   ;
+    database_entity LedgerType          ;
+    database_entity AgeLastOrNearest    ;
+    database_entity MaxIllusAge         ;
+    database_entity MaturityAge         ;
+    database_entity LapseIgnoresSurrChg ;
+    database_entity DefaultProcessOrder ;
+    database_entity NominallyPar        ;
+    database_entity TableYTable         ;
+    database_entity Gam83Table          ;
+    database_entity WeightClass         ;
+    database_entity WeightGender        ;
+    database_entity WeightSmoking       ;
+    database_entity WeightAge           ;
+    database_entity WeightSpecAmt       ;
+    database_entity WeightState         ;
+    database_entity FullExpPol          ;
+    database_entity FullExpPrem         ;
+    database_entity FullExpDumpin       ;
+    database_entity FullExpSpecAmt      ;
+    database_entity VarExpPol           ;
+    database_entity VarExpPrem          ;
+    database_entity VarExpDumpin        ;
+    database_entity VarExpSpecAmt       ;
+    database_entity ExpSpecAmtLimit     ;
+    database_entity MedicalProportion   ;
+    database_entity UwTestCost          ;
+    database_entity VxBasicQTable       ;
+    database_entity VxDeficQTable       ;
+    database_entity VxTaxQTable         ;
+    database_entity StatVxInt           ;
+    database_entity TaxVxInt            ;
+    database_entity StatVxQ             ;
+    database_entity TaxVxQ              ;
+    database_entity DefVxQ              ;
+    database_entity SnflQ               ;
+    database_entity LapseRate           ;
+    database_entity ReqSurpNaar         ;
+    database_entity ReqSurpVx           ;
+    database_entity LicFitRate          ;
+    database_entity LicDacTaxRate       ;
+    database_entity GdbVxMethod         ;
+    database_entity PrimaryHurdle       ;
+    database_entity SecondaryHurdle     ;
 };
 
 void LMI_SO print_databases();

Modified: lmi/trunk/input_test.cpp
===================================================================
--- lmi/trunk/input_test.cpp    2010-06-04 22:21:19 UTC (rev 4975)
+++ lmi/trunk/input_test.cpp    2010-06-06 23:21:21 UTC (rev 4976)
@@ -101,7 +101,7 @@
     // This vector's last element must be replicated.
     int dims_stat[e_number_of_axes] = {1, 1, 1, 1, 1, 1, 10};
     double stat[10] = {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.05};
-    DBDictionary::instance().dictionary_[DB_StatVxQ] = database_entity
+    DBDictionary::instance().datum("StatVxQ") = database_entity
         (DB_StatVxQ
         ,e_number_of_axes
         ,dims_stat
@@ -126,7 +126,7 @@
         ,0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8, 0.8
         ,0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9
         };
-    DBDictionary::instance().dictionary_[DB_TaxVxQ] = database_entity
+    DBDictionary::instance().datum("TaxVxQ") = database_entity
         (DB_TaxVxQ
         ,e_number_of_axes
         ,dims_tax
@@ -155,7 +155,7 @@
     database_entity const maturity = db.entity_from_key(DB_MaturityAge);
 
     // Maturity age must not vary by duration.
-    DBDictionary::instance().dictionary_[DB_MaturityAge] = database_entity
+    DBDictionary::instance().datum("MaturityAge") = database_entity
         (DB_StatVxQ
         ,e_number_of_axes
         ,dims_stat
@@ -166,15 +166,7 @@
         ,std::runtime_error
         ,"Assertion '1 == v.extent()' failed."
         );
-    DBDictionary::instance().dictionary_[DB_MaturityAge] = maturity;
-
-    DBDictionary::instance().dictionary_[1 + DB_LAST] = maturity;
-    DBDictionary::instance().dictionary_.erase(DB_MaturityAge);
-    BOOST_TEST_THROW
-        (db.entity_from_key(DB_MaturityAge)
-        ,std::runtime_error
-        ,"map_lookup: key '258' not found."
-        );
+    DBDictionary::instance().datum("MaturityAge") = maturity;
 }
 
 void input_test::test_input_class()




reply via email to

[Prev in Thread] Current Thread [Next in Thread]