[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [5323] Refactor, caching database values more extensively
From: |
Greg Chicares |
Subject: |
[lmi-commits] [5323] Refactor, caching database values more extensively |
Date: |
Sat, 03 Dec 2011 17:46:19 +0000 |
Revision: 5323
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5323
Author: chicares
Date: 2011-12-03 17:46:18 +0000 (Sat, 03 Dec 2011)
Log Message:
-----------
Refactor, caching database values more extensively
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/basic_values.hpp
lmi/trunk/ihs_acctval.cpp
lmi/trunk/ihs_avstrtgy.cpp
lmi/trunk/ihs_basicval.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2011-12-03 15:12:32 UTC (rev 5322)
+++ lmi/trunk/ChangeLog 2011-12-03 17:46:18 UTC (rev 5323)
@@ -28719,3 +28719,21 @@
objects.make
Refactor.
+20111201T1302Z <address@hidden> [603]
+
+ ihs_basicval.cpp
+Improve documentation, adumbrating some planned changes.
+
+20111203T1512Z <address@hidden> [603]
+
+ ihs_basicval.cpp
+Refactor to support more extensive caching of database values.
+
+20111203T1746Z <address@hidden> [603]
+
+ basic_values.hpp
+ ihs_acctval.cpp
+ ihs_avstrtgy.cpp
+ ihs_basicval.cpp
+Refactor, caching database values more extensively.
+
Modified: lmi/trunk/basic_values.hpp
===================================================================
--- lmi/trunk/basic_values.hpp 2011-12-03 15:12:32 UTC (rev 5322)
+++ lmi/trunk/basic_values.hpp 2011-12-03 17:46:18 UTC (rev 5323)
@@ -26,7 +26,8 @@
#include "config.hpp"
-#include "dbnames.hpp" // e_database_key
+#include "actuarial_table.hpp" // e_actuarial_table_method
+#include "dbnames.hpp" // e_database_key
#include "mc_enum_type_enums.hpp"
#include "oecumenic_enumerations.hpp"
#include "round_to.hpp"
@@ -326,6 +327,13 @@
bool TermIsDbFor7702;
bool TermIsDbFor7702A;
double ExpPerKLimit;
+ oenum_modal_prem_type MinPremType;
+ oenum_modal_prem_type TgtPremType;
+ bool TgtPremFixedAtIssue;
+ double TgtPremMonthlyPolFee;
+ double CurrCoiTable0Limit;
+ double CurrCoiTable1Limit;
+ e_actuarial_table_method CoiInforceReentry;
mcenum_anticipated_deduction MaxWDDed_;
double MaxWDAVMult;
mcenum_anticipated_deduction MaxLoanDed_;
Modified: lmi/trunk/ihs_acctval.cpp
===================================================================
--- lmi/trunk/ihs_acctval.cpp 2011-12-03 15:12:32 UTC (rev 5322)
+++ lmi/trunk/ihs_acctval.cpp 2011-12-03 17:46:18 UTC (rev 5323)
@@ -955,11 +955,7 @@
// that's done, such changes affect these premiums only at the
// next anniversary. Minimum no-lapse premium is likely to require
// recalculation even if target is set immutably at issue.
- int target_year = Year;
- if(Database_->Query(DB_TgtPremFixedAtIssue))
- {
- target_year = 0;
- }
+ int const target_year = TgtPremFixedAtIssue ? 0 : Year;
MlyNoLapsePrem = GetModalMinPrem
(target_year
,mce_monthly
Modified: lmi/trunk/ihs_avstrtgy.cpp
===================================================================
--- lmi/trunk/ihs_avstrtgy.cpp 2011-12-03 15:12:32 UTC (rev 5322)
+++ lmi/trunk/ihs_avstrtgy.cpp 2011-12-03 17:46:18 UTC (rev 5323)
@@ -228,9 +228,7 @@
// TODO ?? Shouldn't a modalized version of something like
// InitialTargetPremium
// AnnualTargetPrem
-// be used instead, at least in the
-// if(Database_->Query(DB_TgtPremFixedAtIssue))
-// case?
+// be used instead, at least in the 'TgtPremFixedAtIssue' case?
return GetModalTgtPrem(Year, a_CurrentMode, ActualSpecAmt);
}
case mce_pmt_mep:
Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp 2011-12-03 15:12:32 UTC (rev 5322)
+++ lmi/trunk/ihs_basicval.cpp 2011-12-03 17:46:18 UTC (rev 5323)
@@ -28,7 +28,6 @@
#include "basic_values.hpp"
-#include "actuarial_table.hpp"
#include "alert.hpp"
#include "assert_lmi.hpp"
#include "calendar_date.hpp"
@@ -685,7 +684,7 @@
) const
{
LMI_ASSERT(0 == a_year); // As noted above.
- if(Database_->Query(DB_TgtPremFixedAtIssue))
+ if(TgtPremFixedAtIssue)
{
if(0 == a_year)
{
@@ -732,6 +731,15 @@
TermIsDbFor7702 = Database_->Query(DB_TermIsDbFor7702 );
TermIsDbFor7702A = Database_->Query(DB_TermIsDbFor7702A );
ExpPerKLimit = Database_->Query(DB_ExpSpecAmtLimit );
+ MinPremType =
static_cast<oenum_modal_prem_type>(static_cast<int>(Database_->Query(DB_MinPremType)));
+ TgtPremType =
static_cast<oenum_modal_prem_type>(static_cast<int>(Database_->Query(DB_TgtPremType)));
+ TgtPremFixedAtIssue = Database_->Query(DB_TgtPremFixedAtIssue );
+ TgtPremMonthlyPolFee= Database_->Query(DB_TgtPremMonthlyPolFee );
+ CurrCoiTable0Limit = Database_->Query(DB_CurrCoiTable0Limit );
+ CurrCoiTable1Limit = Database_->Query(DB_CurrCoiTable1Limit );
+ LMI_ASSERT(0.0 <= CurrCoiTable0Limit);
+ LMI_ASSERT(CurrCoiTable0Limit <= CurrCoiTable1Limit);
+ CoiInforceReentry =
static_cast<e_actuarial_table_method>(static_cast<int>(Database_->Query(DB_CoiInforceReentry)));
MaxWDDed_ =
static_cast<mcenum_anticipated_deduction>(static_cast<int>(Database_->Query(DB_MaxWdDed)));
MaxWDAVMult = Database_->Query(DB_MaxWdAcctValMult );
MaxLoanDed_ =
static_cast<mcenum_anticipated_deduction>(static_cast<int>(Database_->Query(DB_MaxLoanDed)));
@@ -910,9 +918,7 @@
,double a_specamt
) const
{
- oenum_modal_prem_type const PremType =
-
static_cast<oenum_modal_prem_type>(static_cast<int>(Database_->Query(DB_MinPremType)));
- return GetModalPrem(a_year, a_mode, a_specamt, PremType);
+ return GetModalPrem(a_year, a_mode, a_specamt, MinPremType);
}
//============================================================================
@@ -922,9 +928,7 @@
,double a_specamt
) const
{
- oenum_modal_prem_type const PremType =
-
static_cast<oenum_modal_prem_type>(static_cast<int>(Database_->Query(DB_TgtPremType)));
- double modal_prem = GetModalPrem(a_year, a_mode, a_specamt, PremType);
+ double modal_prem = GetModalPrem(a_year, a_mode, a_specamt, TgtPremType);
// TODO ?? Probably this should reflect policy fee. Some products
// define only an annual target premium, and don't specify how to
@@ -998,7 +1002,7 @@
{
return round_max_premium()
(
- ( Database_->Query(DB_TgtPremMonthlyPolFee)
+ ( TgtPremMonthlyPolFee
+ a_specamt
* ldbl_eps_plus_one()
* MortalityRates_->TargetPremiumRates()[0]
@@ -1155,15 +1159,12 @@
,double a_er_pmt
) const
{
- oenum_modal_prem_type const prem_type = static_cast<oenum_modal_prem_type>
- (static_cast<int>(Database_->Query(DB_MinPremType))
- );
return GetModalSpecAmt
(a_ee_mode
,a_ee_pmt
,a_er_mode
,a_er_pmt
- ,prem_type
+ ,MinPremType
);
}
@@ -1175,15 +1176,12 @@
,double a_er_pmt
) const
{
- oenum_modal_prem_type const prem_type = static_cast<oenum_modal_prem_type>
- (static_cast<int>(Database_->Query(DB_TgtPremType))
- );
return GetModalSpecAmt
(a_ee_mode
,a_ee_pmt
,a_er_mode
,a_er_pmt
- ,prem_type
+ ,TgtPremType
);
}
@@ -1402,15 +1400,11 @@
{
if(UseUnusualCOIBanding && mce_gen_guar != rate_basis)
{
- double band_0_limit = Database_->Query(DB_CurrCoiTable0Limit);
- double band_1_limit = Database_->Query(DB_CurrCoiTable1Limit);
- LMI_ASSERT(0.0 <= band_0_limit);
- LMI_ASSERT(band_0_limit <= band_1_limit);
- if(band_0_limit <= a_specamt && a_specamt < band_1_limit)
+ if(CurrCoiTable0Limit <= a_specamt && a_specamt < CurrCoiTable1Limit)
{
return MortalityRates_->MonthlyCoiRatesBand1(rate_basis);
}
- else if(band_1_limit <= a_specamt)
+ else if(CurrCoiTable1Limit <= a_specamt)
{
return MortalityRates_->MonthlyCoiRatesBand2(rate_basis);
}
@@ -1475,19 +1469,14 @@
,long int TableNumber
) const
{
- e_actuarial_table_method const method =
- static_cast<e_actuarial_table_method>
- (static_cast<int>(Database_->Query(DB_CoiInforceReentry))
- );
-
- if(DB_CurrCoiTable == TableID && e_reenter_never != method)
+ if(DB_CurrCoiTable == TableID && e_reenter_never != CoiInforceReentry)
{
return actuarial_table_rates_elaborated
(TableFile
,TableNumber
,GetIssueAge()
,GetLength()
- ,method
+ ,CoiInforceReentry
,yare_input_.InforceYear
,duration_ceiling(yare_input_.EffectiveDate,
yare_input_.LastCoiReentryDate)
);
@@ -1865,10 +1854,7 @@
std::vector<double> BasicValues::GetCurrCOIRates1() const
{
- if
- ( Database_->Query(DB_CurrCoiTable0Limit)
- < std::numeric_limits<double>::max()
- )
+ if(CurrCoiTable0Limit < std::numeric_limits<double>::max())
{
return GetTable
(ProductData_->datum("CurrCOIFilename")
@@ -1886,10 +1872,7 @@
std::vector<double> BasicValues::GetCurrCOIRates2() const
{
- if
- ( Database_->Query(DB_CurrCoiTable1Limit)
- < std::numeric_limits<double>::max()
- )
+ if(CurrCoiTable1Limit < std::numeric_limits<double>::max())
{
return GetTable
(ProductData_->datum("CurrCOIFilename")
@@ -2028,7 +2011,7 @@
return GetTable
(ProductData_->datum("TgtPremFilename")
,DB_TgtPremTable
- ,oe_modal_table == Database_->Query(DB_TgtPremType)
+ ,oe_modal_table == TgtPremType
);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [5323] Refactor, caching database values more extensively,
Greg Chicares <=