lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master f066478 7/8: Use query<T> with database entit


From: Greg Chicares
Subject: [lmi-commits] [lmi] master f066478 7/8: Use query<T> with database entities that are inherently enumerative
Date: Wed, 7 Nov 2018 17:11:11 -0500 (EST)

branch: master
commit f066478bd5b75af335b02143a68abe3dabd76eea
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Use query<T> with database entities that are inherently enumerative
    
    Incidentally changed an enumerative data member to its proper type.
---
 ihs_avmly.cpp             | 4 ++--
 input_harmonization.cpp   | 2 +-
 interest_rates.cpp        | 2 +-
 loads.cpp                 | 3 ++-
 loads_impl.hpp            | 5 +++--
 loads_test.cpp            | 1 +
 mortality_rates_fetch.cpp | 2 +-
 7 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/ihs_avmly.cpp b/ihs_avmly.cpp
index 3781049..bad87ac 100644
--- a/ihs_avmly.cpp
+++ b/ihs_avmly.cpp
@@ -1979,7 +1979,7 @@ void AccountValue::TxTakeSepAcctLoad()
             );
 
         double tiered_comp = 0.0;
-        if(oe_asset_charge_load == database().Query(DB_AssetChargeType))
+        if(oe_asset_charge_load == 
database().query<oenum_asset_charge_type>(DB_AssetChargeType))
             {
             tiered_comp = 
StratifiedCharges_->tiered_asset_based_compensation(AssetsPostBom);
             }
@@ -2059,7 +2059,7 @@ void AccountValue::ApplyDynamicMandE(double assets)
             ;
         }
     double asset_comp_rate =
-        (oe_asset_charge_spread == database().Query(DB_AssetChargeType))
+        (oe_asset_charge_spread == 
database().query<oenum_asset_charge_type>(DB_AssetChargeType))
             ? StratifiedCharges_->tiered_asset_based_compensation(assets)
             : 0.0
             ;
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index 0657fe1..2bcc74b 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -378,7 +378,7 @@ void Input::DoHarmonize()
         {
         LastCoiReentryDate.minimum_and_maximum(reset_min, reset_max);
         }
-    LastCoiReentryDate.enable(e_reenter_upon_rate_reset == 
database_->Query(DB_CoiInforceReentry));
+    LastCoiReentryDate.enable(e_reenter_upon_rate_reset == 
database_->query<e_actuarial_table_method>(DB_CoiInforceReentry));
 
     BlendGender.enable(database_->query<bool>(DB_AllowMortBlendSex));
     bool blend_mortality_by_gender = mce_yes == BlendGender;
diff --git a/interest_rates.cpp b/interest_rates.cpp
index f91a6d4..238f4f8 100644
--- a/interest_rates.cpp
+++ b/interest_rates.cpp
@@ -330,7 +330,7 @@ void InterestRates::Initialize(BasicValues const& v)
     // the same way as M&E, iff database entity DB_AssetChargeType has
     // the value 'oe_asset_charge_spread'; otherwise, reflect them
     // elsewhere as an account-value load.
-    if(oe_asset_charge_spread == v.database().Query(DB_AssetChargeType))
+    if(oe_asset_charge_spread == 
v.database().query<oenum_asset_charge_type>(DB_AssetChargeType))
         {
         // TODO ?? At least for the antediluvian branch, the vector in
         // the input class has an inappropriate size. Truncating it
diff --git a/loads.cpp b/loads.cpp
index 3766f13..c670965 100644
--- a/loads.cpp
+++ b/loads.cpp
@@ -32,6 +32,7 @@
 #include "et_vector.hpp"
 #include "math_functions.hpp"           // assign_midpoint()
 #include "mc_enum_types_aux.hpp"        // mc_n_ enumerators
+#include "oecumenic_enumerations.hpp"
 #include "premium_tax.hpp"
 
 /// Ctor for production branch.
@@ -50,7 +51,7 @@ Loads::Loads(BasicValues& V)
         ,V.PremiumTax_->levy_rate()
         ,V.database().Query(DB_PremTaxAmortIntRate)
         ,V.database().Query(DB_PremTaxAmortPeriod)
-        ,V.database().Query(DB_AssetChargeType)
+        ,V.database().query<oenum_asset_charge_type>(DB_AssetChargeType)
         ,V.IsSubjectToIllustrationReg()
         ,V.round_interest_rate()
         ,V.yare_input_.ExtraCompensationOnPremium
diff --git a/loads_impl.hpp b/loads_impl.hpp
index 00bc3de..5147ea3 100644
--- a/loads_impl.hpp
+++ b/loads_impl.hpp
@@ -24,6 +24,7 @@
 
 #include "config.hpp"
 
+#include "oecumenic_enumerations.hpp"
 #include "round_to.hpp"
 
 #include <vector>
@@ -89,7 +90,7 @@ struct load_details
         ,double                     premium_tax_rate
         ,double                     premium_tax_amortization_rate
         ,double                     premium_tax_amortization_period
-        ,double                     asset_charge_type
+        ,oenum_asset_charge_type    asset_charge_type
         ,bool                       NeedMidpointRates
         ,round_to<double>    const& round_interest_rate
         ,std::vector<double> const& VectorExtraCompLoad
@@ -124,7 +125,7 @@ struct load_details
     double                     premium_tax_rate_;
     double                     premium_tax_amortization_rate_;
     double                     premium_tax_amortization_period_;
-    double                     asset_charge_type_;
+    oenum_asset_charge_type    asset_charge_type_;
     bool                       NeedMidpointRates_;
     round_to<double>    const& round_interest_rate_;
     std::vector<double> const& VectorExtraCompLoad_;
diff --git a/loads_test.cpp b/loads_test.cpp
index 7e975c9..71887ed 100644
--- a/loads_test.cpp
+++ b/loads_test.cpp
@@ -52,6 +52,7 @@ product_database::product_database(int length) 
:length_(length) {}
 int product_database::length() const {return length_;}
 void product_database::query_into(e_database_key, std::vector<double>& v) 
const {v.resize(length_);}
 double product_database::Query(e_database_key) const {return 0.0;}
+double product_database::Query(e_database_key, database_index const&) const 
{return 0.0;}
 
 #include "premium_tax.hpp"
 double premium_tax::levy_rate        () const {return 0.0;}
diff --git a/mortality_rates_fetch.cpp b/mortality_rates_fetch.cpp
index 9a5fbad..53660df 100644
--- a/mortality_rates_fetch.cpp
+++ b/mortality_rates_fetch.cpp
@@ -54,7 +54,7 @@ void MortalityRates::fetch_parameters(BasicValues const& 
basic_values)
     basic_values.database().query_into(DB_CurrCoiIsAnnual  , CCoiIsAnnual_);
     basic_values.database().query_into(DB_GuarCoiIsAnnual  , GCoiIsAnnual_);
     IsTgtPremTabular_ =
-        oe_modal_table == basic_values.database().Query(DB_TgtPremType)
+        oe_modal_table == 
basic_values.database().query<oenum_modal_prem_type>(DB_TgtPremType)
         ;
 
     double max_coi_rate = basic_values.database().Query(DB_MaxMonthlyCoiRate);



reply via email to

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