lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4930] Document preparations for merging '*database.cpp'


From: Greg Chicares
Subject: [lmi-commits] [4930] Document preparations for merging '*database.cpp'
Date: Sat, 08 May 2010 23:00:20 +0000

Revision: 4930
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4930
Author:   chicares
Date:     2010-05-08 23:00:20 +0000 (Sat, 08 May 2010)
Log Message:
-----------
Document preparations for merging '*database.cpp'

Modified Paths:
--------------
    lmi/trunk/Makefile.am
    lmi/trunk/antediluvian_stubs.cpp
    lmi/trunk/database.cpp
    lmi/trunk/ihs_database.cpp
    lmi/trunk/objects.make

Modified: lmi/trunk/Makefile.am
===================================================================
--- lmi/trunk/Makefile.am       2010-05-08 19:27:20 UTC (rev 4929)
+++ lmi/trunk/Makefile.am       2010-05-08 23:00:20 UTC (rev 4930)
@@ -583,6 +583,7 @@
 
 test_input_SOURCES =    \
   $(common_test_objects) \
+  antediluvian_stubs.cpp \
   calendar_date.cpp \
   ce_product_name.cpp \
   configurable_settings.cpp \

Modified: lmi/trunk/antediluvian_stubs.cpp
===================================================================
--- lmi/trunk/antediluvian_stubs.cpp    2010-05-08 19:27:20 UTC (rev 4929)
+++ lmi/trunk/antediluvian_stubs.cpp    2010-05-08 23:00:20 UTC (rev 4930)
@@ -29,6 +29,7 @@
 #include "lmi.hpp"          // is_antediluvian_fork()
 #include "mec_server.hpp"
 #include "product_data.hpp"
+#include "xml_lmi.hpp"
 #include "xml_serializable.tpp"
 
 namespace
@@ -39,6 +40,12 @@
 void authenticate_system()
 {}
 
+glossed_string::glossed_string()
+{}
+
+glossed_string::~glossed_string()
+{}
+
 bool is_antediluvian_fork()
 {
     return true;
@@ -84,6 +91,40 @@
     return false;
 }
 
+product_data::product_data(std::string const&)
+{}
+
+product_data::~product_data()
+{}
+
+int product_data::class_version() const
+{
+    return 0;
+}
+
+std::string product_data::xml_root_name() const
+{
+    return empty_string;
+}
+
+void product_data::read_element
+    (xml::element const&
+    ,std::string const&
+    ,int
+    )
+{}
+
+void product_data::write_element
+    (xml::element&
+    ,std::string const&
+    ) const
+{}
+
+bool product_data::is_detritus(std::string const&) const
+{
+    return false;
+}
+
 std::string const& product_data::datum(std::string const&) const
 {
     return empty_string;

Modified: lmi/trunk/database.cpp
===================================================================
--- lmi/trunk/database.cpp      2010-05-08 19:27:20 UTC (rev 4929)
+++ lmi/trunk/database.cpp      2010-05-08 23:00:20 UTC (rev 4930)
@@ -1,6 +1,10 @@
+#include "ihs_database.cpp"
+#if 0
 // Product database.
 //
 // Copyright (C) 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 
2010 Gregory W. Chicares.
+// [merged file will inherit 'ihs_database.cpp' copyright:]
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 
2008, 2009, 2010 Gregory W. Chicares.
 //
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License version 2 as
@@ -48,7 +52,7 @@
     ,mcenum_uw_basis    a_UWBasis
     ,mcenum_state       a_State
     )
-    :length_  (0)
+    :length_  (0) // Undesirable: set to a nonzero value by initialize().
     ,Gender   (a_Gender)
     ,Class    (a_Class)
     ,Smoker   (a_Smoker)
@@ -138,4 +142,5 @@
     LMI_ASSERT(i != d.end());
     return i->second;
 }
+#endif // 0
 

Modified: lmi/trunk/ihs_database.cpp
===================================================================
--- lmi/trunk/ihs_database.cpp  2010-05-08 19:27:20 UTC (rev 4929)
+++ lmi/trunk/ihs_database.cpp  2010-05-08 23:00:20 UTC (rev 4930)
@@ -21,8 +21,9 @@
 
 // $Id$
 
-// TODO ?? Should length_ be dynamically reset when IssueAge is?
-// TODO ?? Should State be dynamically reset?
+// Should length_ be dynamically reset when IssueAge is?
+// Should State be dynamically reset?
+// Answer: 'no' to both. Axes are set upon construction and are immutable.
 
 #ifdef __BORLANDC__
 #   include "pchfile.hpp"
@@ -37,13 +38,15 @@
 #include "dbdict.hpp"
 #include "dbnames.hpp"
 #include "dbvalue.hpp"
+#include "lmi.hpp"                    // is_antediluvian_fork()
 #include "oecumenic_enumerations.hpp" // methuselah
 #include "product_data.hpp"
 #include "yare_input.hpp"
 
 #include <algorithm> // std::min()
 
-//============================================================================
+/// Construct from essential input (product and axes).
+
 product_database::product_database
     (std::string const& a_ProductName
     ,mcenum_gender      a_Gender
@@ -60,15 +63,50 @@
     ,UWBasis  (a_UWBasis)
     ,State    (a_State)
 {
-    std::string 
filename(product_data(a_ProductName).datum("DatabaseFilename"));
-    DBDictionary::instance().Init(AddDataDir(filename));
+    if(is_antediluvian_fork())
+        {
+        DBDictionary::instance().InitAntediluvian();
+        }
+    else
+        {
+        std::string 
filename(product_data(a_ProductName).datum("DatabaseFilename"));
+        DBDictionary::instance().Init(AddDataDir(filename));
+        }
     initialize();
 }
 
-//============================================================================
+/// Construct from normal illustration input.
+///
+/// For the nonce, this ctor determines "state of jurisdiction"
+/// dynamically, and other code uses that state for multiple purposes.
+/// That is a mistake--two states are required:
+///   - FilingApprovalState: the state that must approve a policy-form
+///     filing (whether affirmatively or by deemer) before a contract
+///     can be written; and
+///   - PremiumTaxState: the state to which premium tax must be paid,
+///     which is crucial for products that pass premium tax through as
+///     a load.
+/// Those two states can differ, e.g. on cases with more than five
+/// hundred lives with a common (employer) issue state: the employer's
+/// state approves the policy form, but premium tax follows employee
+/// residence. See:
+///   http://www.naic.org/documents/frs_summit_presentations_03.pdf
+///   
http://www.naic.org/documents/committees_e_app_blanks_adopted_2007-42BWG_Modified.pdf
+///
+/// Soon, both states will be input fields, and these members will be
+/// expunged:
+///   GetStateOfJurisdiction()
+///   Gender
+///   Class
+///   Smoker
+///   IssueAge
+///   UWBasis
+///   State
+/// Database entity DB_PremTaxState will become obsolete, but must be
+/// retained (with a different name) for backward compatibility.
+
 product_database::product_database(yare_input const& input)
 {
-// GET RID OF Gender, Class, Smoker, etc.
     Gender      = input.Gender;
     Class       = input.UnderwritingClass;
     Smoker      = input.Smoking;
@@ -76,15 +114,17 @@
     UWBasis     = input.GroupUnderwritingType;
     State       = mce_s_CT; // Dummy initialization.
 
-    std::string 
filename(product_data(input.ProductName).datum("DatabaseFilename"));
-    DBDictionary::instance().Init(AddDataDir(filename));
+    if(is_antediluvian_fork())
+        {
+        DBDictionary::instance().InitAntediluvian();
+        }
+    else
+        {
+        std::string 
filename(product_data(input.ProductName).datum("DatabaseFilename"));
+        DBDictionary::instance().Init(AddDataDir(filename));
+        }
     initialize();
 
-    // State of jurisdiction is governed by database item DB_PremTaxState.
-    // (TODO ?? misnamed--rename it when we rebuild)
-    // This must be determined by a database lookup, during construction
-    // of the database object.
-
     // State of jurisdiction must not depend on itself
     database_entity const& StateEntry = GetEntry(DB_PremTaxState);
     if(1 != StateEntry.GetLength(5))
@@ -94,7 +134,8 @@
             << " State of jurisdiction depends on itself."
             << LMI_FLUSH
             ;
-        // TODO ?? We should test this in the write() method.
+        // Should we test this in write()?
+        // Answer: 'no'. This code will soon be expunged.
         }
     switch(static_cast<int>(Query(DB_PremTaxState)))
         {

Modified: lmi/trunk/objects.make
===================================================================
--- lmi/trunk/objects.make      2010-05-08 19:27:20 UTC (rev 4929)
+++ lmi/trunk/objects.make      2010-05-08 23:00:20 UTC (rev 4930)
@@ -395,6 +395,7 @@
   input_sequence.o \
   input_xml_io.o \
   interest_rates.o \
+  lmi.o \
   loads.o \
   mc_enum.o \
   mc_enum_types.o \
@@ -634,6 +635,7 @@
   $(boost_filesystem_objects) \
   $(common_test_objects) \
   $(xmlwrapp_objects) \
+  antediluvian_stubs.o \
   calendar_date.o \
   ce_product_name.o \
   configurable_settings.o \





reply via email to

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