[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 5c7ffa9 3/3: Transpose query_into() arguments
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 5c7ffa9 3/3: Transpose query_into() arguments |
Date: |
Tue, 6 Nov 2018 08:48:53 -0500 (EST) |
branch: master
commit 5c7ffa968cd0d7a01fa107299f6c25774e0d7dd3
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Transpose query_into() arguments
All "query" functions take an e_database_key argument; as a general
rule, that argument should be the first.
---
basicvalues.cpp | 2 +-
database.hpp | 4 ++--
ihs_acctval.cpp | 16 ++++++++--------
ihs_basicval.cpp | 18 +++++++++---------
input_harmonization.cpp | 2 +-
input_test.cpp | 6 +++---
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/basicvalues.cpp b/basicvalues.cpp
index ca24b8a..04bc09b 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -100,7 +100,7 @@ void BasicValues::Init()
EndtAge = static_cast<int>(database().Query(DB_MaturityAge));
Length = EndtAge - IssueAge;
- database().query_into(ledger_type_, DB_LedgerType);
+ database().query_into(DB_LedgerType, ledger_type_);
nonillustrated_ =
static_cast<bool>(database().Query(DB_Nonillustrated));
bool no_longer_issued =
static_cast<bool>(database().Query(DB_NoLongerIssued));
bool is_new_business = yare_input_.EffectiveDate ==
yare_input_.InforceAsOfDate;
diff --git a/database.hpp b/database.hpp
index 902d105..b5ec9d8 100644
--- a/database.hpp
+++ b/database.hpp
@@ -80,7 +80,7 @@ class LMI_SO product_database final
T query(e_database_key) const;
template<typename T>
- void query_into(T&, e_database_key) const;
+ void query_into(e_database_key, T&) const;
bool are_equivalent(e_database_key, e_database_key) const;
bool varies_by_state(e_database_key) const;
@@ -131,7 +131,7 @@ T product_database::query(e_database_key k) const
/// result cannot be represented exactly in type T).
template<typename T>
-void product_database::query_into(T& dst, e_database_key k) const
+void product_database::query_into(e_database_key k, T& dst) const
{
dst = query<T>(k);
}
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index 03e8c1b..46fe9d2 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -698,14 +698,14 @@ void AccountValue::SetInitialValues()
External1035Amount = Outlay_->external_1035_amount();
Internal1035Amount = Outlay_->internal_1035_amount();
- database().query_into(ee_premium_allocation_method , DB_EePremMethod);
- database().query_into(ee_premium_preferred_account , DB_EePremAcct);
- database().query_into(er_premium_allocation_method , DB_ErPremMethod);
- database().query_into(er_premium_preferred_account , DB_ErPremAcct);
- database().query_into(deduction_method , DB_DeductionMethod);
- database().query_into(deduction_preferred_account , DB_DeductionAcct);
- database().query_into(distribution_method ,
DB_DistributionMethod);
- database().query_into(distribution_preferred_account, DB_DistributionAcct);
+ database().query_into(DB_EePremMethod , ee_premium_allocation_method
);
+ database().query_into(DB_EePremAcct , ee_premium_preferred_account
);
+ database().query_into(DB_ErPremMethod , er_premium_allocation_method
);
+ database().query_into(DB_ErPremAcct , er_premium_preferred_account
);
+ database().query_into(DB_DeductionMethod , deduction_method
);
+ database().query_into(DB_DeductionAcct , deduction_preferred_account
);
+ database().query_into(DB_DistributionMethod, distribution_method
);
+ database().query_into(DB_DistributionAcct ,
distribution_preferred_account);
// If any account preference is the separate account, then a
// separate account must be available.
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 86d0ad7..3bebd6e 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -176,7 +176,7 @@ void BasicValues::Init()
EndtAge = static_cast<int>(database().Query(DB_MaturityAge));
Length = EndtAge - IssueAge;
- database().query_into(ledger_type_, DB_LedgerType);
+ database().query_into(DB_LedgerType, ledger_type_);
nonillustrated_ =
static_cast<bool>(database().Query(DB_Nonillustrated));
bool no_longer_issued =
static_cast<bool>(database().Query(DB_NoLongerIssued));
bool is_new_business = yare_input_.EffectiveDate ==
yare_input_.InforceAsOfDate;
@@ -272,7 +272,7 @@ void BasicValues::GPTServerInit()
yare_input_.DeathBenefitOption .assign(Length,
yare_input_.DeathBenefitOption[0]);
yare_input_.FlatExtra .resize(Length);
- database().query_into(ledger_type_, DB_LedgerType);
+ database().query_into(DB_LedgerType, ledger_type_);
nonillustrated_ =
static_cast<bool>(database().Query(DB_Nonillustrated));
bool no_longer_issued =
static_cast<bool>(database().Query(DB_NoLongerIssued));
bool is_new_business = yare_input_.EffectiveDate ==
yare_input_.InforceAsOfDate;
@@ -623,8 +623,8 @@ void BasicValues::SetPermanentInvariants()
TermForcedConvAge =
static_cast<int>(database().Query(DB_TermForcedConvAge));
TermForcedConvDur =
static_cast<int>(database().Query(DB_TermForcedConvDur));
ExpPerKLimit = database().Query(DB_ExpSpecAmtLimit );
- database().query_into(MinPremType, DB_MinPremType);
- database().query_into(TgtPremType, DB_TgtPremType);
+ database().query_into(DB_MinPremType, MinPremType);
+ database().query_into(DB_TgtPremType, TgtPremType);
TgtPremFixedAtIssue = database().Query(DB_TgtPremFixedAtIssue );
TgtPremMonthlyPolFee= database().Query(DB_TgtPremMonthlyPolFee );
// Assertion: see comments on GetModalPremTgtFromTable().
@@ -636,12 +636,12 @@ void BasicValues::SetPermanentInvariants()
CurrCoiTable1Limit = database().Query(DB_CurrCoiTable1Limit );
LMI_ASSERT(0.0 <= CurrCoiTable0Limit);
LMI_ASSERT(CurrCoiTable0Limit <= CurrCoiTable1Limit);
- database().query_into(CoiInforceReentry, DB_CoiInforceReentry);
- database().query_into(MaxWDDed_ , DB_MaxWdDed);
+ database().query_into(DB_CoiInforceReentry, CoiInforceReentry);
+ database().query_into(DB_MaxWdDed , MaxWDDed_ );
MaxWdGenAcctValMult = database().Query(DB_MaxWdGenAcctValMult );
MaxWdSepAcctValMult = database().Query(DB_MaxWdSepAcctValMult );
AllowPrefLoan =
static_cast<bool>(database().Query(DB_AllowPrefLoan));
- database().query_into(MaxLoanDed_, DB_MaxLoanDed);
+ database().query_into(DB_MaxLoanDed ,MaxLoanDed_);
MaxLoanAVMult = database().Query(DB_MaxLoanAcctValMult );
FirstPrefLoanYear =
static_cast<int>(database().Query(DB_FirstPrefLoanYear));
NoLapseMinDur = static_cast<int>(database().Query(DB_NoLapseMinDur));
@@ -655,7 +655,7 @@ void BasicValues::SetPermanentInvariants()
AllowChangeToDBO2 = database().Query(DB_AllowChangeToDbo2 );
AllowSAIncr = database().Query(DB_AllowSpecAmtIncr );
NoLapseAlwaysActive = database().Query(DB_NoLapseAlwaysActive );
- database().query_into(WaiverChargeMethod, DB_WpChargeMethod);
+ database().query_into(DB_WpChargeMethod, WaiverChargeMethod);
database().Query(CashValueEnhMult, DB_CashValueEnhMult);
LapseIgnoresSurrChg = database().Query(DB_LapseIgnoresSurrChg );
SurrChgOnIncr = database().Query(DB_SurrChgOnIncr );
@@ -760,7 +760,7 @@ void BasicValues::SetPermanentInvariants()
auto const z =
database().query<mcenum_defn_material_change>(DB_CvatMatChangeDefn);
DefnMaterialChange_ = (mce_gpt == DefnLifeIns_) ? mce_adjustment_event
: z;
}
- database().query_into(Equiv7702DBO3, DB_Equiv7702Dbo3);
+ database().query_into(DB_Equiv7702Dbo3, Equiv7702DBO3);
TermIsDbFor7702 = 1.0 == database().Query(DB_TermIsQABOrDb7702 );
TermIsDbFor7702A = 1.0 == database().Query(DB_TermIsQABOrDb7702A);
MaxNAAR = yare_input_.MaximumNaar;
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index b4f978f..a3ed03a 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -95,7 +95,7 @@ void Input::DoAdaptExternalities()
GleanedMaturityAge_ = static_cast<int>(database_->Query(DB_MaturityAge));
- database_->query_into(GleanedLedgerType_, DB_LedgerType);
+ database_->query_into(DB_LedgerType, GleanedLedgerType_);
}
void Input::DoCustomizeInitialValues()
diff --git a/input_test.cpp b/input_test.cpp
index 24e09cb..a6fa16e 100644
--- a/input_test.cpp
+++ b/input_test.cpp
@@ -154,14 +154,14 @@ void input_test::test_product_database()
oenum_alb_or_anb a;
// This value corresponds to no enumerator, but C++ allows that.
- db.query_into(a, DB_MaturityAge);
+ db.query_into(DB_MaturityAge, a);
BOOST_TEST_EQUAL(100, a);
auto const b {db.query<oenum_alb_or_anb>(DB_MaturityAge)};
BOOST_TEST_EQUAL(100, b);
// This value is not integral, so bourn_cast rejects it.
BOOST_TEST_THROW
- (db.query_into(a, DB_NaarDiscount)
+ (db.query_into(DB_NaarDiscount, a)
,std::runtime_error
,"Cast would not preserve value."
);
@@ -170,7 +170,7 @@ void input_test::test_product_database()
auto f1 = [&db, &v] {db.Query(v, DB_MaturityAge);};
auto f2 = [&db] {db.Query(DB_MaturityAge);};
auto f3 = [&db] {db.query<oenum_alb_or_anb>(DB_AgeLastOrNearest);};
- auto f4 = [&db, &a] {db.query_into(a, DB_AgeLastOrNearest);};
+ auto f4 = [&db, &a] {db.query_into(DB_AgeLastOrNearest, a);};
auto f5 = [&db] {db.entity_from_key(DB_MaturityAge);};
std::cout
<< "\n Database speed tests..."