lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 4b2a5d7 5/6: Use query_into() wherever it fit


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4b2a5d7 5/6: Use query_into() wherever it fits
Date: Wed, 7 Nov 2018 02:40:35 -0500 (EST)

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

    Use query_into() wherever it fits
    
    Reason: it's the most typesafe "query" overload.
---
 basicvalues.cpp           |  8 ++---
 ihs_acctval.cpp           | 12 ++++----
 ihs_basicval.cpp          | 74 +++++++++++++++++++++++------------------------
 ledger_invariant_init.cpp | 14 ++++-----
 mortality_rates_fetch.cpp | 18 ++++++------
 5 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/basicvalues.cpp b/basicvalues.cpp
index 53617cc..50e5f64 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -118,10 +118,10 @@ void BasicValues::Init()
     PremiumTax_    .reset(new premium_tax    (PremiumTaxState_, database()));
     Loads_         .reset(new Loads(database(), IsSubjectToIllustrationReg()));
 
-    MinSpecAmt = database().Query(DB_MinSpecAmt);
-    MinWD      = database().Query(DB_MinWd     );
-    WDFee      = database().Query(DB_WdFee     );
-    WDFeeRate  = database().Query(DB_WdFeeRate );
+    database().query_into(DB_MinSpecAmt, MinSpecAmt);
+    database().query_into(DB_MinWd     , MinWD     );
+    database().query_into(DB_WdFee     , WDFee     );
+    database().query_into(DB_WdFeeRate , WDFeeRate );
 
 // The antediluvian branch leaves FundData_, StratifiedCharges_, and
 // ProductData initialized to null pointers.
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index 46fe9d2..75d37dc 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -641,10 +641,10 @@ void AccountValue::SetInitialValues()
         NoLapseActive           = false;
         }
 
-    SplitMinPrem                = database().Query(DB_SplitMinPrem);
-    UnsplitSplitMinPrem         = database().Query(DB_UnsplitSplitMinPrem);
+    database().query_into(DB_SplitMinPrem       , SplitMinPrem);
+    database().query_into(DB_UnsplitSplitMinPrem, UnsplitSplitMinPrem);
 
-    TermCanLapse                = database().Query(DB_TermCanLapse);
+    database().query_into(DB_TermCanLapse       , TermCanLapse);
     TermRiderActive             = true;
     TermDB                      = 0.0;
 
@@ -690,9 +690,9 @@ void AccountValue::SetInitialValues()
     MlyDed                      = 0.0;
     CumulativeSalesLoad         = yare_input_.InforceCumulativeSalesLoad;
 
-    CoiRetentionRate                  = 
database().Query(DB_ExpRatCoiRetention);
-    ExperienceRatingAmortizationYears = database().Query(DB_ExpRatAmortPeriod);
-    IbnrAsMonthsOfMortalityCharges    = database().Query(DB_ExpRatIbnrMult);
+    database().query_into(DB_ExpRatCoiRetention, CoiRetentionRate);
+    database().query_into(DB_ExpRatAmortPeriod , 
ExperienceRatingAmortizationYears);
+    database().query_into(DB_ExpRatIbnrMult    , 
IbnrAsMonthsOfMortalityCharges);
 
     Dumpin             = Outlay_->dumpin();
     External1035Amount = Outlay_->external_1035_amount();
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index bbebf6f..c10e2ef 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -606,60 +606,60 @@ double BasicValues::GetAnnualTgtPrem(int a_year, double 
a_specamt) const
 
 void BasicValues::SetPermanentInvariants()
 {
-    MinIssSpecAmt       = database().Query(DB_MinIssSpecAmt        );
-    MinIssBaseSpecAmt   = database().Query(DB_MinIssBaseSpecAmt    );
-    MinRenlSpecAmt      = database().Query(DB_MinRenlSpecAmt       );
-    MinRenlBaseSpecAmt  = database().Query(DB_MinRenlBaseSpecAmt   );
-    NoLapseOpt1Only     = database().Query(DB_NoLapseDbo1Only      );
-    NoLapseUnratedOnly  = database().Query(DB_NoLapseUnratedOnly   );
-    OptChgCanIncrSA     = database().Query(DB_DboChgCanIncrSpecAmt );
-    OptChgCanDecrSA     = database().Query(DB_DboChgCanDecrSpecAmt );
-    WDCanDecrSADBO1     = database().Query(DB_WdCanDecrSpecAmtDbo1 );
-    WDCanDecrSADBO2     = database().Query(DB_WdCanDecrSpecAmtDbo2 );
-    WDCanDecrSADBO3     = database().Query(DB_WdCanDecrSpecAmtDbo3 );
+    database().query_into(DB_MinIssSpecAmt        , MinIssSpecAmt);
+    database().query_into(DB_MinIssBaseSpecAmt    , MinIssBaseSpecAmt);
+    database().query_into(DB_MinRenlSpecAmt       , MinRenlSpecAmt);
+    database().query_into(DB_MinRenlBaseSpecAmt   , MinRenlBaseSpecAmt);
+    database().query_into(DB_NoLapseDbo1Only      , NoLapseOpt1Only);
+    database().query_into(DB_NoLapseUnratedOnly   , NoLapseUnratedOnly);
+    database().query_into(DB_DboChgCanIncrSpecAmt , OptChgCanIncrSA);
+    database().query_into(DB_DboChgCanDecrSpecAmt , OptChgCanDecrSA);
+    database().query_into(DB_WdCanDecrSpecAmtDbo1 , WDCanDecrSADBO1);
+    database().query_into(DB_WdCanDecrSpecAmtDbo2 , WDCanDecrSADBO2);
+    database().query_into(DB_WdCanDecrSpecAmtDbo3 , WDCanDecrSADBO3);
     database().query_into(DB_MaxIncrAge       , MaxIncrAge);
-    WaivePmTxInt1035    = database().Query(DB_WaivePremTaxInt1035  );
-    TermIsNotRider      = database().Query(DB_TermIsNotRider       );
+    database().query_into(DB_WaivePremTaxInt1035  , WaivePmTxInt1035);
+    database().query_into(DB_TermIsNotRider       , TermIsNotRider);
     database().query_into(DB_TermForcedConvAge, TermForcedConvAge);
     database().query_into(DB_TermForcedConvDur, TermForcedConvDur);
-    ExpPerKLimit        = database().Query(DB_ExpSpecAmtLimit      );
+    database().query_into(DB_ExpSpecAmtLimit      , ExpPerKLimit);
     database().query_into(DB_MinPremType, MinPremType);
     database().query_into(DB_TgtPremType, TgtPremType);
-    TgtPremFixedAtIssue = database().Query(DB_TgtPremFixedAtIssue  );
-    TgtPremMonthlyPolFee= database().Query(DB_TgtPremMonthlyPolFee );
+    database().query_into(DB_TgtPremFixedAtIssue  , TgtPremFixedAtIssue);
+    database().query_into(DB_TgtPremMonthlyPolFee , TgtPremMonthlyPolFee);
     // Assertion: see comments on GetModalPremTgtFromTable().
     LMI_ASSERT
         (  0.0 == TgtPremMonthlyPolFee
         || (oe_modal_table == TgtPremType && oe_modal_table != MinPremType)
         );
-    CurrCoiTable0Limit  = database().Query(DB_CurrCoiTable0Limit   );
-    CurrCoiTable1Limit  = database().Query(DB_CurrCoiTable1Limit   );
+    database().query_into(DB_CurrCoiTable0Limit   , CurrCoiTable0Limit);
+    database().query_into(DB_CurrCoiTable1Limit   , CurrCoiTable1Limit);
     LMI_ASSERT(0.0                <= CurrCoiTable0Limit);
     LMI_ASSERT(CurrCoiTable0Limit <= CurrCoiTable1Limit);
     database().query_into(DB_CoiInforceReentry, CoiInforceReentry);
     database().query_into(DB_MaxWdDed         , MaxWDDed_        );
-    MaxWdGenAcctValMult = database().Query(DB_MaxWdGenAcctValMult  );
-    MaxWdSepAcctValMult = database().Query(DB_MaxWdSepAcctValMult  );
+    database().query_into(DB_MaxWdGenAcctValMult  , MaxWdGenAcctValMult);
+    database().query_into(DB_MaxWdSepAcctValMult  , MaxWdSepAcctValMult);
     database().query_into(DB_AllowPrefLoan    , AllowPrefLoan);
     database().query_into(DB_MaxLoanDed       , MaxLoanDed_);
-    MaxLoanAVMult       = database().Query(DB_MaxLoanAcctValMult   );
+    database().query_into(DB_MaxLoanAcctValMult   , MaxLoanAVMult);
     database().query_into(DB_FirstPrefLoanYear, FirstPrefLoanYear);
     database().query_into(DB_NoLapseMinDur    , NoLapseMinDur);
     database().query_into(DB_NoLapseMinAge    , NoLapseMinAge);
-    AdbLimit            = database().Query(DB_AdbLimit             );
-    WpLimit             = database().Query(DB_WpLimit              );
-    SpecAmtLoadLimit    = database().Query(DB_SpecAmtLoadLimit     );
-    MinWD               = database().Query(DB_MinWd                );
-    WDFee               = database().Query(DB_WdFee                );
-    WDFeeRate           = database().Query(DB_WdFeeRate            );
-    AllowChangeToDBO2   = database().Query(DB_AllowChangeToDbo2    );
-    AllowSAIncr         = database().Query(DB_AllowSpecAmtIncr     );
-    NoLapseAlwaysActive = database().Query(DB_NoLapseAlwaysActive  );
+    database().query_into(DB_AdbLimit             , AdbLimit);
+    database().query_into(DB_WpLimit              , WpLimit);
+    database().query_into(DB_SpecAmtLoadLimit     , SpecAmtLoadLimit);
+    database().query_into(DB_MinWd                , MinWD);
+    database().query_into(DB_WdFee                , WDFee);
+    database().query_into(DB_WdFeeRate            , WDFeeRate);
+    database().query_into(DB_AllowChangeToDbo2    , AllowChangeToDBO2);
+    database().query_into(DB_AllowSpecAmtIncr     , AllowSAIncr);
+    database().query_into(DB_NoLapseAlwaysActive  , NoLapseAlwaysActive);
     database().query_into(DB_WpChargeMethod  , WaiverChargeMethod);
     database().query_into(DB_CashValueEnhMult, CashValueEnhMult  );
-    LapseIgnoresSurrChg = database().Query(DB_LapseIgnoresSurrChg  );
-    SurrChgOnIncr       = database().Query(DB_SurrChgOnIncr        );
-    SurrChgOnDecr       = database().Query(DB_SurrChgOnDecr        );
+    database().query_into(DB_LapseIgnoresSurrChg  , LapseIgnoresSurrChg);
+    database().query_into(DB_SurrChgOnIncr        , SurrChgOnIncr);
+    database().query_into(DB_SurrChgOnDecr        , SurrChgOnDecr);
     LMI_ASSERT(!SurrChgOnIncr); // Surrchg change on increase not supported.
     LMI_ASSERT(!SurrChgOnDecr); // Surrchg change on decrease not supported.
 
@@ -673,15 +673,15 @@ void BasicValues::SetPermanentInvariants()
     assign(DBDiscountRate, 1.0 + DBDiscountRate);
     assign(DBDiscountRate, 1.0 / DBDiscountRate);
 
-    CalculateComp       = database().Query(DB_CalculateComp        );
+    database().query_into(DB_CalculateComp        , CalculateComp);
     database().query_into(DB_AssetComp , AssetComp );
     database().query_into(DB_CompTarget, CompTarget);
     database().query_into(DB_CompExcess, CompExcess);
 
-    MandEIsDynamic      = database().Query(DB_DynamicMandE         );
-    SepAcctLoadIsDynamic= database().Query(DB_DynamicSepAcctLoad   );
+    database().query_into(DB_DynamicMandE         , MandEIsDynamic);
+    database().query_into(DB_DynamicSepAcctLoad   , SepAcctLoadIsDynamic);
 
-    UseUnusualCOIBanding= database().Query(DB_UnusualCoiBanding    );
+    database().query_into(DB_UnusualCoiBanding    , UseUnusualCOIBanding);
 
     // 'Unusual' COI banding accommodates a particular idiosyncratic
     // product which has no term rider and doesn't permit experience
diff --git a/ledger_invariant_init.cpp b/ledger_invariant_init.cpp
index f97f16a..ad06bd7 100644
--- a/ledger_invariant_init.cpp
+++ b/ledger_invariant_init.cpp
@@ -204,10 +204,10 @@ void LedgerInvariant::Init(BasicValues const* b)
             )
         ;
 
-    NoLapseAlwaysActive     = b->database().Query(DB_NoLapseAlwaysActive);
-    NoLapseMinDur           = b->database().Query(DB_NoLapseMinDur);
-    NoLapseMinAge           = b->database().Query(DB_NoLapseMinAge);
-    Has1035ExchCharge       = b->database().Query(DB_Has1035ExchCharge);
+    b->database().query_into(DB_NoLapseAlwaysActive, NoLapseAlwaysActive);
+    b->database().query_into(DB_NoLapseMinDur      , NoLapseMinDur);
+    b->database().query_into(DB_NoLapseMinAge      , NoLapseMinAge);
+    b->database().query_into(DB_Has1035ExchCharge  , Has1035ExchCharge);
 
     // SOMEDAY !! Things indexed with '[0]' should probably use inforce year 
instead.
     InitBaseSpecAmt         = b->DeathBfts_->specamt()[0];
@@ -248,7 +248,7 @@ void LedgerInvariant::Init(BasicValues const* b)
     Age                     = b->yare_input_.IssueAge;
     RetAge                  = b->yare_input_.RetirementAge;
     EndtAge                 = b->yare_input_.IssueAge + b->GetLength();
-    GroupIndivSelection     = b->database().Query(DB_GroupIndivSelection);
+    b->database().query_into(DB_GroupIndivSelection, GroupIndivSelection);
     UseExperienceRating     = b->yare_input_.UseExperienceRating;
     UsePartialMort          = b->yare_input_.UsePartialMortality;
     AvgFund                 = b->yare_input_.UseAverageOfAllFunds;
@@ -263,8 +263,8 @@ void LedgerInvariant::Init(BasicValues const* b)
 
     HasHoneymoon            = b->yare_input_.HoneymoonEndorsement;
     PostHoneymoonSpread     = b->yare_input_.PostHoneymoonSpread;
-    SplitMinPrem            = b->database().Query(DB_SplitMinPrem);
-    AllowDbo3               = b->database().Query(DB_AllowDbo3);
+    b->database().query_into(DB_SplitMinPrem       , SplitMinPrem);
+    b->database().query_into(DB_AllowDbo3          , AllowDbo3);
 
     // These are reassigned below based on product data if available.
     std::string dbo_name_option1 = mc_str(mce_option1);
diff --git a/mortality_rates_fetch.cpp b/mortality_rates_fetch.cpp
index 87d56d3..9a5fbad 100644
--- a/mortality_rates_fetch.cpp
+++ b/mortality_rates_fetch.cpp
@@ -44,15 +44,15 @@ void MortalityRates::fetch_parameters(BasicValues const& 
basic_values)
     // Some of these data members seem useless for now, but they will
     // become useful when mortality-table access is moved hither from
     // class BasicValues.
-    AllowAdb_          = basic_values.database().Query(DB_AllowAdb         );
-    AllowChild_        = basic_values.database().Query(DB_AllowChildRider  );
-    AllowFlatExtras_   = basic_values.database().Query(DB_AllowFlatExtras  );
-    AllowSpouse_       = basic_values.database().Query(DB_AllowSpouseRider );
-    AllowSubstdTable_  = basic_values.database().Query(DB_AllowSubstdTable );
-    AllowTerm_         = basic_values.database().Query(DB_AllowTerm        );
-    AllowWp_           = basic_values.database().Query(DB_AllowWp          );
-    CCoiIsAnnual_      = basic_values.database().Query(DB_CurrCoiIsAnnual  );
-    GCoiIsAnnual_      = basic_values.database().Query(DB_GuarCoiIsAnnual  );
+    basic_values.database().query_into(DB_AllowAdb         , AllowAdb_);
+    basic_values.database().query_into(DB_AllowChildRider  , AllowChild_);
+    basic_values.database().query_into(DB_AllowFlatExtras  , AllowFlatExtras_);
+    basic_values.database().query_into(DB_AllowSpouseRider , AllowSpouse_);
+    basic_values.database().query_into(DB_AllowSubstdTable , 
AllowSubstdTable_);
+    basic_values.database().query_into(DB_AllowTerm        , AllowTerm_);
+    basic_values.database().query_into(DB_AllowWp          , AllowWp_);
+    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)
         ;



reply via email to

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