[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 28105c5 5/8: Use query<int> with database ent
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 28105c5 5/8: Use query<int> with database entities that are inherently int |
Date: |
Wed, 7 Nov 2018 17:11:10 -0500 (EST) |
branch: master
commit 28105c520c8d338f15423b08f6542c9f685adf7b
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Use query<int> with database entities that are inherently int
---
ihs_basicval.cpp | 20 ++++++++++----------
input_harmonization.cpp | 16 ++++++++--------
product_file_test.cpp | 8 ++++----
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 82be30e..cef5119 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -183,24 +183,24 @@ void BasicValues::Init()
no_can_issue_ = no_longer_issued && is_new_business;
IsSubjectToIllustrationReg_ = is_subject_to_ill_reg(ledger_type());
- if(IssueAge < database().Query(DB_MinIssAge))
+ if(IssueAge < database().query<int>(DB_MinIssAge))
{
alarum()
<< "Issue age "
<< IssueAge
<< " less than minimum "
- << database().Query(DB_MinIssAge)
+ << database().query<int>(DB_MinIssAge)
<< '.'
<< LMI_FLUSH
;
}
- if(database().Query(DB_MaxIssAge) < IssueAge)
+ if(database().query<int>(DB_MaxIssAge) < IssueAge)
{
alarum()
<< "Issue age "
<< IssueAge
<< " greater than maximum "
- << database().Query(DB_MaxIssAge)
+ << database().query<int>(DB_MaxIssAge)
<< '.'
<< LMI_FLUSH
;
@@ -279,14 +279,14 @@ void BasicValues::GPTServerInit()
no_can_issue_ = no_longer_issued && is_new_business;
IsSubjectToIllustrationReg_ = is_subject_to_ill_reg(ledger_type());
- if(IssueAge < database().Query(DB_MinIssAge))
+ if(IssueAge < database().query<int>(DB_MinIssAge))
{
throw x_product_rule_violated
(
std::string("Issue age less than minimum")
);
}
- if(database().Query(DB_MaxIssAge) < IssueAge)
+ if(database().query<int>(DB_MaxIssAge) < IssueAge)
{
throw x_product_rule_violated
(
@@ -1563,7 +1563,7 @@ std::vector<double> BasicValues::GetUnblendedTable
return GetActuarialTable
(TableFile
,TableID
- ,bourn_cast<int>(database().Query(TableID))
+ ,bourn_cast<int>(database().query<int>(TableID))
);
}
@@ -2073,7 +2073,7 @@ std::vector<double>
BasicValues::GetPartialMortalityRates() const
std::vector<double> BasicValues::GetSubstdTblMultTable() const
{
- if(0 == database().Query(DB_SubstdTableMultTable))
+ if(0 == database().query<int>(DB_SubstdTableMultTable))
{
return std::vector<double>(GetLength(), 1.0);
}
@@ -2089,7 +2089,7 @@ std::vector<double>
BasicValues::GetCurrSpecAmtLoadTable() const
return GetTable
(product().datum("CurrSpecAmtLoadFilename")
,DB_CurrSpecAmtLoadTable
- ,0 != database().Query(DB_CurrSpecAmtLoadTable)
+ ,0 != database().query<int>(DB_CurrSpecAmtLoadTable)
);
}
@@ -2098,7 +2098,7 @@ std::vector<double>
BasicValues::GetGuarSpecAmtLoadTable() const
return GetTable
(product().datum("GuarSpecAmtLoadFilename")
,DB_GuarSpecAmtLoadTable
- ,0 != database().Query(DB_GuarSpecAmtLoadTable)
+ ,0 != database().query<int>(DB_GuarSpecAmtLoadTable)
);
}
diff --git a/input_harmonization.cpp b/input_harmonization.cpp
index ca5f374..0657fe1 100644
--- a/input_harmonization.cpp
+++ b/input_harmonization.cpp
@@ -319,8 +319,8 @@ void Input::DoHarmonize()
InforceContractMonth.enable(false);
bool no_lapse_offered =
- 0 != database_->Query(DB_NoLapseMinDur)
- || 0 != database_->Query(DB_NoLapseMinAge)
+ 0 != database_->query<int>(DB_NoLapseMinDur)
+ || 0 != database_->query<int>(DB_NoLapseMinAge)
;
InforceNoLapseActive .enable(no_lapse_offered);
InforceMonthlyNoLapsePremium .enable(no_lapse_offered && mce_yes ==
InforceNoLapseActive);
@@ -415,8 +415,8 @@ void Input::DoHarmonize()
bool allow_term =
database_->query<bool>(DB_AllowTerm)
&& (database_->query<bool>(DB_AllowRatedTerm) || !contract_is_rated)
- && database_->Query(DB_TermMinIssAge) <= IssueAge.value()
- && IssueAge.value() <=
database_->Query(DB_TermMaxIssAge)
+ && database_->query<int>(DB_TermMinIssAge) <= IssueAge.value()
+ && IssueAge.value() <=
database_->query<int>(DB_TermMaxIssAge)
;
bool term_is_a_rider = !database_->query<bool>(DB_TermIsNotRider);
bool allow_term_rider = allow_term && term_is_a_rider;
@@ -443,16 +443,16 @@ void Input::DoHarmonize()
bool allow_wp =
database_->query<bool>(DB_AllowWp)
&& (database_->query<bool>(DB_AllowRatedWp) || !contract_is_rated)
- && database_->Query(DB_WpMinIssAge) <= IssueAge.value()
- && IssueAge.value() <=
database_->Query(DB_WpMaxIssAge)
+ && database_->query<int>(DB_WpMinIssAge) <= IssueAge.value()
+ && IssueAge.value() <=
database_->query<int>(DB_WpMaxIssAge)
;
WaiverOfPremiumBenefit.enable( allow_wp);
WaiverOfPremiumBenefit.allow(mce_yes, allow_wp);
bool allow_adb =
database_->query<bool>(DB_AllowAdb)
&& (database_->query<bool>(DB_AllowRatedAdb) || !contract_is_rated)
- && database_->Query(DB_AdbMinIssAge) <= IssueAge.value()
- && IssueAge.value() <=
database_->Query(DB_AdbMaxIssAge)
+ && database_->query<int>(DB_AdbMinIssAge) <= IssueAge.value()
+ && IssueAge.value() <=
database_->query<int>(DB_AdbMaxIssAge)
;
AccidentalDeathBenefit.enable( allow_adb);
AccidentalDeathBenefit.allow(mce_yes, allow_adb);
diff --git a/product_file_test.cpp b/product_file_test.cpp
index 30423b4..a267b75 100644
--- a/product_file_test.cpp
+++ b/product_file_test.cpp
@@ -105,11 +105,11 @@ void product_file_test::test_copying()
);
BOOST_TEST(mce_s_CT == d.index().index_vector()[5]);
BOOST_TEST( 55 == d.length());
- BOOST_TEST( 99 == d.Query(DB_MaxIncrAge));
+ BOOST_TEST( 99 == d.query<int>(DB_MaxIncrAge));
product_database e(std::move(d));
BOOST_TEST(mce_s_CT == e.index().index_vector()[5]);
BOOST_TEST( 55 == e.length());
- BOOST_TEST( 99 == e.Query(DB_MaxIncrAge));
+ BOOST_TEST( 99 == e.query<int>(DB_MaxIncrAge));
// Test product_database copy ctor.
product_database f
@@ -124,10 +124,10 @@ void product_file_test::test_copying()
product_database g(f);
BOOST_TEST(mce_s_CT == f.index().index_vector()[5]);
BOOST_TEST( 41 == f.length());
- BOOST_TEST( 99 == f.Query(DB_MaxIncrAge));
+ BOOST_TEST( 99 == f.query<int>(DB_MaxIncrAge));
BOOST_TEST(mce_s_CT == g.index().index_vector()[5]);
BOOST_TEST( 41 == g.length());
- BOOST_TEST( 99 == g.Query(DB_MaxIncrAge));
+ BOOST_TEST( 99 == g.query<int>(DB_MaxIncrAge));
}
void product_file_test::read_database_file()
- [lmi-commits] [lmi] master updated (259f97c -> 6c72fcf), Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 284339d 1/8: Document boolean database entities more uniformly, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master e4a6ba2 6/8: Use query<bool> with database entities that are inherently boolean, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 39f76e4 4/8: Make a deliberate mistake more obvious in a unit test, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master f066478 7/8: Use query<T> with database entities that are inherently enumerative, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 6c72fcf 8/8: Use query<double> with database entities that are inherently floating, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 5e009d6 3/8: Adjust whitespace to improve vertical alignment, Greg Chicares, 2018/11/07
- [lmi-commits] [lmi] master 28105c5 5/8: Use query<int> with database entities that are inherently int,
Greg Chicares <=
- [lmi-commits] [lmi] master 9490b4c 2/8: Avoid using floating-point constants for boolean values, Greg Chicares, 2018/11/07