lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4939] Augment and relocate enumerations


From: Greg Chicares
Subject: [lmi-commits] [4939] Augment and relocate enumerations
Date: Mon, 10 May 2010 01:17:15 +0000

Revision: 4939
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4939
Author:   chicares
Date:     2010-05-10 01:17:14 +0000 (Mon, 10 May 2010)
Log Message:
-----------
Augment and relocate enumerations

Modified Paths:
--------------
    lmi/trunk/database_view_editor.cpp
    lmi/trunk/database_view_editor.hpp
    lmi/trunk/dbdict.cpp
    lmi/trunk/dbvalue.cpp
    lmi/trunk/dbvalue.hpp
    lmi/trunk/input_test.cpp

Modified: lmi/trunk/database_view_editor.cpp
===================================================================
--- lmi/trunk/database_view_editor.cpp  2010-05-10 00:48:39 UTC (rev 4938)
+++ lmi/trunk/database_view_editor.cpp  2010-05-10 01:17:14 UTC (rev 4939)
@@ -95,7 +95,7 @@
   :public AdjustableMaxBoundAxis<int>
 {
     typedef AdjustableMaxBoundAxis<int> BaseClass;
-    static const int max_bound_duration = database_entity::e_max_dim_duration 
- 1;
+    static const int max_bound_duration = e_max_dim_duration - 1;
 
   public:
     DatabaseDurationAxis()

Modified: lmi/trunk/database_view_editor.hpp
===================================================================
--- lmi/trunk/database_view_editor.hpp  2010-05-10 00:48:39 UTC (rev 4938)
+++ lmi/trunk/database_view_editor.hpp  2010-05-10 01:17:14 UTC (rev 4939)
@@ -69,7 +69,7 @@
     BOOST_STATIC_ASSERT
         (
            static_cast<int>(DatabaseTableAdapter::eda_max)
-        == static_cast<int>(database_entity::e_number_of_axes)
+        == static_cast<int>(e_number_of_axes)
         );
   public:
     DatabaseTableAdapter(database_entity* db_value = NULL);

Modified: lmi/trunk/dbdict.cpp
===================================================================
--- lmi/trunk/dbdict.cpp        2010-05-10 00:48:39 UTC (rev 4938)
+++ lmi/trunk/dbdict.cpp        2010-05-10 01:17:14 UTC (rev 4939)
@@ -265,7 +265,7 @@
     // TODO ?? For now, only the threshold here is changed. Much
     // complex code elsewhere can be removed when time permits.
 
-    int premium_tax_dimensions[database_entity::e_number_of_axes] = {1, 1, 1, 
1, 1, 53, 1};
+    int premium_tax_dimensions[e_number_of_axes] = {1, 1, 1, 1, 1, 53, 1};
     double premium_tax_retaliation_threshold[53] =
         {
     //  AL      AK      AZ      AR      CA      CO      CT
@@ -288,7 +288,7 @@
     Add
         (database_entity
             (DB_PremTaxRetalLimit
-            ,database_entity::e_number_of_axes
+            ,e_number_of_axes
             ,premium_tax_dimensions
             ,premium_tax_retaliation_threshold
             )
@@ -354,7 +354,7 @@
     Add(database_entity(DB_DynamicMandE        , false));
 
     // gender, smoker
-    int dims313[database_entity::e_number_of_axes] = {3, 1, 3, 1, 1, 1, 1};
+    int dims313[e_number_of_axes] = {3, 1, 3, 1, 1, 1, 1};
 
     // US 1980 CSO age last; unisex = table D.
     // Male uses table E, which is correct, as opposed to table F,
@@ -368,8 +368,8 @@
 
     // For now at least, just use (a multiple of) guaranteed COI rates
     // as current.
-    Add(database_entity(DB_CurrCOITable, database_entity::e_number_of_axes, 
dims313, TgCOI));
-    Add(database_entity(DB_GuarCOITable, database_entity::e_number_of_axes, 
dims313, TgCOI));
+    Add(database_entity(DB_CurrCOITable, e_number_of_axes, dims313, TgCOI));
+    Add(database_entity(DB_GuarCOITable, e_number_of_axes, dims313, TgCOI));
 
     Add(database_entity(DB_COINYMinTable       , 0.0));
 
@@ -379,7 +379,7 @@
         0.60, 0.50, 0.55, // male:   sm ns us
         0.50, 0.40, 0.45, // unisex: sm ns us
         };
-    Add(database_entity(DB_CCOIMultiplier, database_entity::e_number_of_axes, 
dims313, coimult));
+    Add(database_entity(DB_CCOIMultiplier, e_number_of_axes, dims313, 
coimult));
 
     Add(database_entity(DB_UseNYCOIFloor       , 0.0));
     Add(database_entity(DB_GuarCOICeiling      , 0.0));
@@ -434,9 +434,9 @@
     // US 1980 CSO age last, not smoker distinct. Unisex = table D.
     // Male uses table E, which is correct, as opposed to table F,
     // which contains a numerical error but was adopted by NAIC.
-    int dims311[database_entity::e_number_of_axes] = {3, 1, 1, 1, 1, 1, 1}; // 
gender
+    int dims311[e_number_of_axes] = {3, 1, 1, 1, 1, 1, 1}; // gender
     double T7702q[9] = {35, 41, 107,}; // Female, male, unisex.
-    Add(database_entity(DB_IRC7702QTable, database_entity::e_number_of_axes, 
dims311, T7702q));
+    Add(database_entity(DB_IRC7702QTable, e_number_of_axes, dims311, T7702q));
 
     Add(database_entity(DB_PremLoad7702        , 0.02));
     Add(database_entity(DB_AllowDBO1           , true));
@@ -464,7 +464,7 @@
     // be used where no premium tax applies, as for offshore business.
     // DE has a tiered premium tax that this program cannot yet
     // handle, so we punt and use two percent in DE.
-    int premium_tax_dimensions[database_entity::e_number_of_axes] = {1, 1, 1, 
1, 1, 53, 1};
+    int premium_tax_dimensions[e_number_of_axes] = {1, 1, 1, 1, 1, 53, 1};
     double const tiered = 0.0;
     double premium_tax_rates[53] =
         {
@@ -488,7 +488,7 @@
     Add
         (database_entity
             (DB_PremTaxRate
-            ,database_entity::e_number_of_axes
+            ,e_number_of_axes
             ,premium_tax_dimensions
             ,premium_tax_rates
             )
@@ -509,8 +509,8 @@
     Add(database_entity(DB_NoLapseOpt1Only     , false));
     Add(database_entity(DB_PremRefund          , 0.0));
     // Reuse current COI rates as current and guaranteed term rates.
-    Add(database_entity(DB_TermTable, database_entity::e_number_of_axes, 
dims313, TgCOI));
-    Add(database_entity(DB_GuarTermTable, database_entity::e_number_of_axes, 
dims313, TgCOI));
+    Add(database_entity(DB_TermTable, e_number_of_axes, dims313, TgCOI));
+    Add(database_entity(DB_GuarTermTable, e_number_of_axes, dims313, TgCOI));
     Add(database_entity(DB_AllowTerm           , true));
     Add(database_entity(DB_TermMinIssAge       , 0.0));
     Add(database_entity(DB_TermMaxIssAge       , 0.0));
@@ -589,7 +589,7 @@
 
     // Use male rates for unisex--1983 GAM seems to have no unisex version.
     double T83Gam[3] = {825, 826, 826,};
-    Add(database_entity(DB_83GamTable, database_entity::e_number_of_axes, 
dims311, T83Gam, "Use male rates for unisex--1983 GAM seems to have no unisex 
version."));
+    Add(database_entity(DB_83GamTable, e_number_of_axes, dims311, T83Gam, "Use 
male rates for unisex--1983 GAM seems to have no unisex version."));
 
     Add(database_entity(DB_AllowWD             , true));
     Add(database_entity(DB_AllowLoan           , true));
@@ -609,7 +609,7 @@
     Add
         (database_entity
             (DB_PremTaxLoad
-            ,database_entity::e_number_of_axes
+            ,e_number_of_axes
             ,premium_tax_dimensions
             ,premium_tax_rates
             )
@@ -697,12 +697,12 @@
     Add(database_entity(DB_WDFee, 5.0));
     Add(database_entity(DB_WDFeeRate, 0.01));
 
-    int guar_coi_dims[database_entity::e_number_of_axes] = {1, 1, 3, 1, 1, 1, 
1};
+    int guar_coi_dims[e_number_of_axes] = {1, 1, 3, 1, 1, 1, 1};
     // smoker, nonsmoker, unismoke
     double guar_coi_tables[3] = {111, 109, 107};
-    Add(database_entity(DB_GuarCOITable, database_entity::e_number_of_axes, 
guar_coi_dims, guar_coi_tables));
+    Add(database_entity(DB_GuarCOITable, e_number_of_axes, guar_coi_dims, 
guar_coi_tables));
 
-    int curr_coi_dims[database_entity::e_number_of_axes] = {1, 4, 3, 1, 1, 1, 
1};
+    int curr_coi_dims[e_number_of_axes] = {1, 4, 3, 1, 1, 1, 1};
     // preferred, standard, rated, ultrapreferred by smoker, nonsmoker, 
unismoke
     double curr_coi_tables[] =
         {
@@ -711,7 +711,7 @@
         5, 6, 4, // rated sm ns us
         0, 0, 0, // ultra sm ns us
         };
-    Add(database_entity(DB_CurrCOITable, database_entity::e_number_of_axes, 
curr_coi_dims, curr_coi_tables));
+    Add(database_entity(DB_CurrCOITable, e_number_of_axes, curr_coi_dims, 
curr_coi_tables));
 
     Add(database_entity(DB_CorridorTable, 7));
     Add(database_entity(DB_WPTable, 8));

Modified: lmi/trunk/dbvalue.cpp
===================================================================
--- lmi/trunk/dbvalue.cpp       2010-05-10 00:48:39 UTC (rev 4938)
+++ lmi/trunk/dbvalue.cpp       2010-05-10 01:17:14 UTC (rev 4939)
@@ -43,7 +43,7 @@
 #include <numeric>
 #include <ostream>
 
-static int const ScalarDims[database_entity::e_number_of_axes] = {1, 1, 1, 1, 
1, 1, 1};
+static int const ScalarDims[e_number_of_axes] = {1, 1, 1, 1, 1, 1, 1};
 static int const MaxPossibleElements = std::numeric_limits<int>::max();
 
 /// Ascertain whether two database entities are equivalent.

Modified: lmi/trunk/dbvalue.hpp
===================================================================
--- lmi/trunk/dbvalue.hpp       2010-05-10 00:48:39 UTC (rev 4938)
+++ lmi/trunk/dbvalue.hpp       2010-05-10 01:17:14 UTC (rev 4939)
@@ -37,6 +37,31 @@
 
 namespace xml_serialize {template<typename T> struct xml_io;}
 
+enum
+    {e_axis_gender    = 0
+    ,e_axis_class     = 1
+    ,e_axis_smoking   = 2
+    ,e_axis_issue_age = 3
+    ,e_axis_uw_basis  = 4
+    ,e_axis_state     = 5
+    ,e_axis_duration  = 6
+    };
+
+/// These enumerators facilitate compile-time assertions in the
+/// product-database GUI, q.v.: an array cannot be indexed to
+/// produce an arithmetic constant expression [5.19/3].
+
+enum enum_database_dimensions
+    {e_number_of_axes    = 1 + database_index::number_of_indices
+    ,e_max_dim_gender    =   3
+    ,e_max_dim_class     =   4
+    ,e_max_dim_smoking   =   3
+    ,e_max_dim_issue_age = 100
+    ,e_max_dim_uw_basis  =   5
+    ,e_max_dim_state     =  53
+    ,e_max_dim_duration  = 100
+    };
+
 /// Product-database entity.
 ///
 /// Each entity varies across zero or more of the following axes:
@@ -62,18 +87,6 @@
     friend struct xml_serialize::xml_io<database_entity>;
 
   public:
-    // Separate enumerators here facilitate compile-time assertions
-    // in the database GUI, q.v.--an array could not be indexed to
-    // produce an arithmetic constant expression [5.19/3].
-    enum {e_number_of_axes    = 1 + database_index::number_of_indices};
-    enum {e_max_dim_gender    =   3};
-    enum {e_max_dim_class     =   4};
-    enum {e_max_dim_smoking   =   3};
-    enum {e_max_dim_issue_age = 100};
-    enum {e_max_dim_uw_basis  =   5};
-    enum {e_max_dim_state     =  53};
-    enum {e_max_dim_duration  = 100};
-
     database_entity();
     database_entity
         (int                key

Modified: lmi/trunk/input_test.cpp
===================================================================
--- lmi/trunk/input_test.cpp    2010-05-10 00:48:39 UTC (rev 4938)
+++ lmi/trunk/input_test.cpp    2010-05-10 01:17:14 UTC (rev 4939)
@@ -99,11 +99,11 @@
     std::vector<double> w;
 
     // This vector's last element must be replicated.
-    int dims_stat[database_entity::e_number_of_axes] = {1, 1, 1, 1, 1, 1, 10};
+    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
         (DB_StatVxQ
-        ,database_entity::e_number_of_axes
+        ,e_number_of_axes
         ,dims_stat
         ,stat
         );
@@ -113,7 +113,7 @@
     BOOST_TEST(v == w);
 
     // This vector must be truncated.
-    int dims_tax[database_entity::e_number_of_axes] = {1, 1, 1, 1, 1, 1, 100};
+    int dims_tax[e_number_of_axes] = {1, 1, 1, 1, 1, 1, 100};
     double tax[100] =
         {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0
         ,0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1
@@ -128,7 +128,7 @@
         };
     DBDictionary::instance().dictionary_[DB_TaxVxQ] = database_entity
         (DB_TaxVxQ
-        ,database_entity::e_number_of_axes
+        ,e_number_of_axes
         ,dims_tax
         ,tax
         );
@@ -157,7 +157,7 @@
     // Maturity age must not vary by duration.
     DBDictionary::instance().dictionary_[DB_EndtAge] = database_entity
         (DB_StatVxQ
-        ,database_entity::e_number_of_axes
+        ,e_number_of_axes
         ,dims_stat
         ,stat
         );





reply via email to

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