[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [4835] Refactor read-only access to class product_data
From: |
Greg Chicares |
Subject: |
[lmi-commits] [4835] Refactor read-only access to class product_data |
Date: |
Sun, 11 Apr 2010 20:37:23 +0000 |
Revision: 4835
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4835
Author: chicares
Date: 2010-04-11 20:37:23 +0000 (Sun, 11 Apr 2010)
Log Message:
-----------
Refactor read-only access to class product_data
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/antediluvian_stubs.cpp
lmi/trunk/ihs_basicval.cpp
lmi/trunk/ihs_database.cpp
lmi/trunk/ledger_invariant.cpp
lmi/trunk/mec_server.cpp
lmi/trunk/product_data.cpp
lmi/trunk/product_data.hpp
lmi/trunk/product_file_test.cpp
Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/ChangeLog 2010-04-11 20:37:23 UTC (rev 4835)
@@ -24823,3 +24823,15 @@
workhorse.make
Include new product files in fardels.
+20100411T2037Z <address@hidden> [760]
+
+ antediluvian_stubs.cpp
+ ihs_basicval.cpp
+ ihs_database.cpp
+ ledger_invariant.cpp
+ mec_server.cpp
+ product_data.cpp
+ product_data.hpp
+ product_file_test.cpp
+Refactor read-only access to class product_data.
+
Modified: lmi/trunk/antediluvian_stubs.cpp
===================================================================
--- lmi/trunk/antediluvian_stubs.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/antediluvian_stubs.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -28,15 +28,20 @@
#include "authenticity.hpp"
#include "mec_server.hpp"
+#include "product_data.hpp"
#include "xml_serializable.tpp"
+namespace
+{
+ std::string const empty_string("");
+} // Unnamed namespace.
+
void authenticate_system()
{}
std::string const& timestamp_of_production_release()
{
- static std::string const s("");
- return s;
+ return empty_string;
}
mec_server::mec_server(mcenum_emission)
@@ -71,8 +76,7 @@
std::string mec_state::xml_root_name() const
{
- static std::string const s("");
- return s;
+ return empty_string;
}
bool mec_state::is_detritus(std::string const&) const
@@ -86,8 +90,7 @@
,std::string const&
) const
{
- static std::string const s("");
- return s;
+ return empty_string;
}
void mec_state::redintegrate_ex_post
@@ -100,3 +103,8 @@
void mec_state::redintegrate_ad_terminum()
{}
+std::string const& product_data::datum(std::string const&) const
+{
+ return empty_string;
+}
+
Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/ihs_basicval.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -244,16 +244,16 @@
std::string("Issue age greater than maximum")
);
}
- FundData_.reset(new
FundData(AddDataDir((*ProductData_)["FundFilename"].str())));
+ FundData_.reset(new
FundData(AddDataDir(ProductData_->datum("FundFilename"))));
RoundingRules_.reset
(new rounding_rules
(StreamableRoundingRules
- (AddDataDir((*ProductData_)["RoundingFilename"].str())
+ (AddDataDir(ProductData_->datum("RoundingFilename"))
).get_rounding_rules()
)
);
StratifiedCharges_.reset
- (new
stratified_charges(AddDataDir((*ProductData_)["TierFilename"].str()))
+ (new
stratified_charges(AddDataDir(ProductData_->datum("TierFilename")))
);
SpreadFor7702_.assign
(Length
@@ -329,17 +329,17 @@
);
}
// FundData_ = new FundData
-// (AddDataDir((*ProductData_)["FundFilename"].str())
+// (AddDataDir(ProductData_->datum("FundFilename"))
// );
RoundingRules_.reset
(new rounding_rules
(StreamableRoundingRules
- (AddDataDir((*ProductData_)["RoundingFilename"].str())
+ (AddDataDir(ProductData_->datum("RoundingFilename"))
).get_rounding_rules()
)
);
StratifiedCharges_.reset
- (new
stratified_charges(AddDataDir((*ProductData_)["TierFilename"].str()))
+ (new
stratified_charges(AddDataDir(ProductData_->datum("TierFilename")))
);
// Requires database.
@@ -728,7 +728,7 @@
{
// TODO ?? It would be better not to constrain so many things
// not to vary by duration by using Query(enumerator).
- StateOfDomicile_ =
mc_state_from_string((*ProductData_)["InsCoDomicile"].str());
+ StateOfDomicile_ =
mc_state_from_string(ProductData_->datum("InsCoDomicile"));
// TODO ?? Perhaps we want the premium-tax load instead of the
// premium-tax rate here; or maybe we want neither as a member
@@ -2019,14 +2019,14 @@
std::vector<double> BasicValues::GetCvatCorridorFactors() const
{
return GetTable
- ((*ProductData_)["CorridorFilename"].str()
+ (ProductData_->datum("CorridorFilename")
,DB_CorridorTable
);
}
std::vector<double> BasicValues::GetCurrCOIRates0() const
{
return GetTable
- ((*ProductData_)["CurrCOIFilename"].str()
+ (ProductData_->datum("CurrCOIFilename")
,DB_CurrCOITable
,true
,CanBlend
@@ -2041,7 +2041,7 @@
)
{
return GetTable
- ((*ProductData_)["CurrCOIFilename"].str()
+ (ProductData_->datum("CurrCOIFilename")
,DB_CurrCOITable1
,true
,CanBlend
@@ -2061,7 +2061,7 @@
)
{
return GetTable
- ((*ProductData_)["CurrCOIFilename"].str()
+ (ProductData_->datum("CurrCOIFilename")
,DB_CurrCOITable2
,true
,CanBlend
@@ -2076,14 +2076,14 @@
std::vector<double> BasicValues::GetGuarCOIRates() const
{
return GetTable
- ((*ProductData_)["GuarCOIFilename"].str()
+ (ProductData_->datum("GuarCOIFilename")
,DB_GuarCOITable
);
}
std::vector<double> BasicValues::GetSmokerBlendedGuarCOIRates() const
{
return GetTable
- ((*ProductData_)["GuarCOIFilename"].str()
+ (ProductData_->datum("GuarCOIFilename")
,DB_GuarCOITable
,true
,CanBlend
@@ -2093,7 +2093,7 @@
std::vector<double> BasicValues::GetWpRates() const
{
return GetTable
- ((*ProductData_)["WPFilename"].str()
+ (ProductData_->datum("WPFilename")
,DB_WPTable
,Database_->Query(DB_AllowWP)
);
@@ -2101,7 +2101,7 @@
std::vector<double> BasicValues::GetAdbRates() const
{
return GetTable
- ((*ProductData_)["ADDFilename"].str()
+ (ProductData_->datum("ADDFilename")
,DB_ADDTable
,Database_->Query(DB_AllowADD)
);
@@ -2109,7 +2109,7 @@
std::vector<double> BasicValues::GetChildRiderRates() const
{
return GetTable
- ((*ProductData_)["ChildRiderFilename"].str()
+ (ProductData_->datum("ChildRiderFilename")
,DB_ChildRiderTable
,Database_->Query(DB_AllowChild)
);
@@ -2122,7 +2122,7 @@
}
std::vector<double> z = actuarial_table_rates
- (AddDataDir((*ProductData_)["CurrSpouseRiderFilename"].str())
+ (AddDataDir(ProductData_->datum("CurrSpouseRiderFilename"))
,static_cast<long int>(Database_->Query(DB_SpouseRiderTable))
,yare_input_.SpouseIssueAge
,EndtAge - yare_input_.SpouseIssueAge
@@ -2138,7 +2138,7 @@
}
std::vector<double> z = actuarial_table_rates
- (AddDataDir((*ProductData_)["GuarSpouseRiderFilename"].str())
+ (AddDataDir(ProductData_->datum("GuarSpouseRiderFilename"))
,static_cast<long int>(Database_->Query(DB_SpouseRiderGuarTable))
,yare_input_.SpouseIssueAge
,EndtAge - yare_input_.SpouseIssueAge
@@ -2149,7 +2149,7 @@
std::vector<double> BasicValues::GetCurrentTermRates() const
{
return GetTable
- ((*ProductData_)["CurrTermFilename"].str()
+ (ProductData_->datum("CurrTermFilename")
,DB_TermTable
,Database_->Query(DB_AllowTerm)
,CanBlend
@@ -2159,7 +2159,7 @@
std::vector<double> BasicValues::GetGuaranteedTermRates() const
{
return GetTable
- ((*ProductData_)["GuarTermFilename"].str()
+ (ProductData_->datum("GuarTermFilename")
,DB_GuarTermTable
,Database_->Query(DB_AllowTerm)
,CanBlend
@@ -2169,21 +2169,21 @@
std::vector<double> BasicValues::GetTableYRates() const
{
return GetTable
- ((*ProductData_)["TableYFilename"].str()
+ (ProductData_->datum("TableYFilename")
,DB_TableYTable
);
}
std::vector<double> BasicValues::GetTAMRA7PayRates() const
{
return GetTable
- ((*ProductData_)["TAMRA7PayFilename"].str()
+ (ProductData_->datum("TAMRA7PayFilename")
,DB_TAMRA7PayTable
);
}
std::vector<double> BasicValues::GetTgtPremRates() const
{
return GetTable
- ((*ProductData_)["TgtPremFilename"].str()
+ (ProductData_->datum("TgtPremFilename")
,DB_TgtPremTable
,oe_modal_table == Database_->Query(DB_TgtPremType)
);
@@ -2191,14 +2191,14 @@
std::vector<double> BasicValues::GetIRC7702Rates() const
{
return GetTable
- ((*ProductData_)["IRC7702Filename"].str()
+ (ProductData_->datum("IRC7702Filename")
,DB_IRC7702QTable
);
}
std::vector<double> BasicValues::Get83GamRates() const
{
return GetTable
- ((*ProductData_)["Gam83Filename"].str()
+ (ProductData_->datum("Gam83Filename")
,DB_83GamTable
,true
,CannotBlend
@@ -2213,7 +2213,7 @@
}
return GetTable
- ((*ProductData_)["SubstdTblMultFilename"].str()
+ (ProductData_->datum("SubstdTblMultFilename")
,DB_SubstdTblMultTable
);
}
@@ -2225,7 +2225,7 @@
}
return GetTable
- ((*ProductData_)["CurrSpecAmtLoadFilename"].str()
+ (ProductData_->datum("CurrSpecAmtLoadFilename")
,DB_CurrSpecAmtLoadTable
);
}
@@ -2237,7 +2237,7 @@
}
return GetTable
- ((*ProductData_)["GuarSpecAmtLoadFilename"].str()
+ (ProductData_->datum("GuarSpecAmtLoadFilename")
,DB_GuarSpecAmtLoadTable
);
}
Modified: lmi/trunk/ihs_database.cpp
===================================================================
--- lmi/trunk/ihs_database.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/ihs_database.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -58,7 +58,7 @@
,mcenum_uw_basis a_UWBasis
,mcenum_state a_State
)
- :Filename
(AddDataDir(product_data(a_ProductName)["DatabaseFilename"].str()))
+ :Filename
(AddDataDir(product_data(a_ProductName).datum("DatabaseFilename")))
,Gender (a_Gender)
,Class (a_Class)
,Smoker (a_Smoker)
@@ -72,7 +72,7 @@
//============================================================================
TDatabase::TDatabase(yare_input const& input)
-
:Filename(AddDataDir(product_data(input.ProductName)["DatabaseFilename"].str()))
+
:Filename(AddDataDir(product_data(input.ProductName).datum("DatabaseFilename")))
{
// GET RID OF Gender, Class, Smoker, etc.
Gender = input.Gender;
Modified: lmi/trunk/ledger_invariant.cpp
===================================================================
--- lmi/trunk/ledger_invariant.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/ledger_invariant.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -585,87 +585,87 @@
if(b->ProductData_)
{
product_data const& p = *b->ProductData_;
- PolicyMktgName = p["PolicyMktgName"
].str();
- PolicyLegalName = p["PolicyLegalName"
].str();
- PolicyForm = p["PolicyForm"
].str();
- InsCoShortName = p["InsCoShortName"
].str();
- InsCoName = p["InsCoName"
].str();
- InsCoAddr = p["InsCoAddr"
].str();
- InsCoStreet = p["InsCoStreet"
].str();
- InsCoPhone = p["InsCoPhone"
].str();
- MainUnderwriter = p["MainUnderwriter"
].str();
- MainUnderwriterAddress = p["MainUnderwriterAddress"
].str();
- CoUnderwriter = p["CoUnderwriter"
].str();
- CoUnderwriterAddress = p["CoUnderwriterAddress"
].str();
+ PolicyMktgName = p.datum("PolicyMktgName"
);
+ PolicyLegalName = p.datum("PolicyLegalName"
);
+ PolicyForm = p.datum("PolicyForm"
);
+ InsCoShortName = p.datum("InsCoShortName"
);
+ InsCoName = p.datum("InsCoName"
);
+ InsCoAddr = p.datum("InsCoAddr"
);
+ InsCoStreet = p.datum("InsCoStreet"
);
+ InsCoPhone = p.datum("InsCoPhone"
);
+ MainUnderwriter = p.datum("MainUnderwriter"
);
+ MainUnderwriterAddress = p.datum("MainUnderwriterAddress"
);
+ CoUnderwriter = p.datum("CoUnderwriter"
);
+ CoUnderwriterAddress = p.datum("CoUnderwriterAddress"
);
- AvName = p["AvName"
].str();
- CsvName = p["CsvName"
].str();
- CsvHeaderName = p["CsvHeaderName"
].str();
- NoLapseProvisionName = p["NoLapseProvisionName"
].str();
- InterestDisclaimer = p["InterestDisclaimer"
].str();
- GuarMortalityFootnote = p["GuarMortalityFootnote"
].str();
+ AvName = p.datum("AvName"
);
+ CsvName = p.datum("CsvName"
);
+ CsvHeaderName = p.datum("CsvHeaderName"
);
+ NoLapseProvisionName = p.datum("NoLapseProvisionName"
);
+ InterestDisclaimer = p.datum("InterestDisclaimer"
);
+ GuarMortalityFootnote = p.datum("GuarMortalityFootnote"
);
- AccountValueFootnote = p["AccountValueFootnote"
].str();
- AttainedAgeFootnote = p["AttainedAgeFootnote"
].str();
- CashSurrValueFootnote = p["CashSurrValueFootnote"
].str();
- DeathBenefitFootnote = p["DeathBenefitFootnote"
].str();
- InitialPremiumFootnote = p["InitialPremiumFootnote"
].str();
- NetPremiumFootnote = p["NetPremiumFootnote"
].str();
- OutlayFootnote = p["OutlayFootnote"
].str();
- PolicyYearFootnote = p["PolicyYearFootnote"
].str();
+ AccountValueFootnote = p.datum("AccountValueFootnote"
);
+ AttainedAgeFootnote = p.datum("AttainedAgeFootnote"
);
+ CashSurrValueFootnote = p.datum("CashSurrValueFootnote"
);
+ DeathBenefitFootnote = p.datum("DeathBenefitFootnote"
);
+ InitialPremiumFootnote = p.datum("InitialPremiumFootnote"
);
+ NetPremiumFootnote = p.datum("NetPremiumFootnote"
);
+ OutlayFootnote = p.datum("OutlayFootnote"
);
+ PolicyYearFootnote = p.datum("PolicyYearFootnote"
);
- ADDFootnote = p["ADDFootnote"
].str();
- ChildFootnote = p["ChildFootnote"
].str();
- SpouseFootnote = p["SpouseFootnote"
].str();
- TermFootnote = p["TermFootnote"
].str();
- WaiverFootnote = p["WaiverFootnote"
].str();
+ ADDFootnote = p.datum("ADDFootnote"
);
+ ChildFootnote = p.datum("ChildFootnote"
);
+ SpouseFootnote = p.datum("SpouseFootnote"
);
+ TermFootnote = p.datum("TermFootnote"
);
+ WaiverFootnote = p.datum("WaiverFootnote"
);
- MinimumPremiumFootnote = p["MinimumPremiumFootnote"
].str();
- PremAllocationFootnote = p["PremAllocationFootnote"
].str();
+ MinimumPremiumFootnote = p.datum("MinimumPremiumFootnote"
);
+ PremAllocationFootnote = p.datum("PremAllocationFootnote"
);
- ProductDescription = p["ProductDescription"
].str();
- StableValueFootnote = p["StableValueFootnote"
].str();
- NoVanishPremiumFootnote = p["NoVanishPremiumFootnote"
].str();
- RejectPremiumFootnote = p["RejectPremiumFootnote"
].str();
- ExpRatingFootnote = p["ExpRatingFootnote"
].str();
- MortalityBlendFootnote = p["MortalityBlendFootnote"
].str();
- HypotheticalRatesFootnote = p["HypotheticalRatesFootnote"
].str();
- SalesLoadRefundFootnote = p["SalesLoadRefundFootnote"
].str();
- NoLapseFootnote = p["NoLapseFootnote"
].str();
- MarketValueAdjFootnote = p["MarketValueAdjFootnote"
].str();
- ExchangeChargeFootnote0 = p["ExchangeChargeFootnote0"
].str();
- CurrentValuesFootnote = p["CurrentValuesFootnote"
].str();
- DBOption1Footnote = p["DBOption1Footnote"
].str();
- DBOption2Footnote = p["DBOption2Footnote"
].str();
- ExpRatRiskChargeFootnote = p["ExpRatRiskChargeFootnote"
].str();
- ExchangeChargeFootnote1 = p["ExchangeChargeFootnote1"
].str();
- FlexiblePremiumFootnote = p["FlexiblePremiumFootnote"
].str();
- GuaranteedValuesFootnote = p["GuaranteedValuesFootnote"
].str();
- CreditingRateFootnote = p["CreditingRateFootnote"
].str();
- MecFootnote = p["MecFootnote"
].str();
- MidpointValuesFootnote = p["MidpointValuesFootnote"
].str();
- SinglePremiumFootnote = p["SinglePremiumFootnote"
].str();
- MonthlyChargesFootnote = p["MonthlyChargesFootnote"
].str();
- UltCreditingRateFootnote = p["UltCreditingRateFootnote"
].str();
- MaxNaarFootnote = p["MaxNaarFootnote"
].str();
- PremTaxSurrChgFootnote = p["PremTaxSurrChgFootnote"
].str();
- PolicyFeeFootnote = p["PolicyFeeFootnote"
].str();
- AssetChargeFootnote = p["AssetChargeFootnote"
].str();
- InvestmentIncomeFootnote = p["InvestmentIncomeFootnote"
].str();
- IrrDbFootnote = p["IrrDbFootnote"
].str();
- IrrCsvFootnote = p["IrrCsvFootnote"
].str();
- MortalityChargesFootnote = p["MortalityChargesFootnote"
].str();
- LoanAndWithdrawalFootnote = p["LoanAndWithdrawalFootnote"
].str();
- PresaleTrackingNumber = p["PresaleTrackingNumber"
].str();
- CompositeTrackingNumber = p["CompositeTrackingNumber"
].str();
- InforceTrackingNumber = p["InforceTrackingNumber"
].str();
- InforceCompositeTrackingNumber = p["InforceCompositeTrackingNumber"
].str();
- InforceNonGuaranteedFootnote0 = p["InforceNonGuaranteedFootnote0"
].str();
- InforceNonGuaranteedFootnote1 = p["InforceNonGuaranteedFootnote1"
].str();
- InforceNonGuaranteedFootnote2 = p["InforceNonGuaranteedFootnote2"
].str();
- InforceNonGuaranteedFootnote3 = p["InforceNonGuaranteedFootnote3"
].str();
- NonGuaranteedFootnote = p["NonGuaranteedFootnote"
].str();
- MonthlyChargesPaymentFootnote = p["MonthlyChargesPaymentFootnote"
].str();
+ ProductDescription = p.datum("ProductDescription"
);
+ StableValueFootnote = p.datum("StableValueFootnote"
);
+ NoVanishPremiumFootnote = p.datum("NoVanishPremiumFootnote"
);
+ RejectPremiumFootnote = p.datum("RejectPremiumFootnote"
);
+ ExpRatingFootnote = p.datum("ExpRatingFootnote"
);
+ MortalityBlendFootnote = p.datum("MortalityBlendFootnote"
);
+ HypotheticalRatesFootnote = p.datum("HypotheticalRatesFootnote"
);
+ SalesLoadRefundFootnote = p.datum("SalesLoadRefundFootnote"
);
+ NoLapseFootnote = p.datum("NoLapseFootnote"
);
+ MarketValueAdjFootnote = p.datum("MarketValueAdjFootnote"
);
+ ExchangeChargeFootnote0 = p.datum("ExchangeChargeFootnote0"
);
+ CurrentValuesFootnote = p.datum("CurrentValuesFootnote"
);
+ DBOption1Footnote = p.datum("DBOption1Footnote"
);
+ DBOption2Footnote = p.datum("DBOption2Footnote"
);
+ ExpRatRiskChargeFootnote = p.datum("ExpRatRiskChargeFootnote"
);
+ ExchangeChargeFootnote1 = p.datum("ExchangeChargeFootnote1"
);
+ FlexiblePremiumFootnote = p.datum("FlexiblePremiumFootnote"
);
+ GuaranteedValuesFootnote = p.datum("GuaranteedValuesFootnote"
);
+ CreditingRateFootnote = p.datum("CreditingRateFootnote"
);
+ MecFootnote = p.datum("MecFootnote"
);
+ MidpointValuesFootnote = p.datum("MidpointValuesFootnote"
);
+ SinglePremiumFootnote = p.datum("SinglePremiumFootnote"
);
+ MonthlyChargesFootnote = p.datum("MonthlyChargesFootnote"
);
+ UltCreditingRateFootnote = p.datum("UltCreditingRateFootnote"
);
+ MaxNaarFootnote = p.datum("MaxNaarFootnote"
);
+ PremTaxSurrChgFootnote = p.datum("PremTaxSurrChgFootnote"
);
+ PolicyFeeFootnote = p.datum("PolicyFeeFootnote"
);
+ AssetChargeFootnote = p.datum("AssetChargeFootnote"
);
+ InvestmentIncomeFootnote = p.datum("InvestmentIncomeFootnote"
);
+ IrrDbFootnote = p.datum("IrrDbFootnote"
);
+ IrrCsvFootnote = p.datum("IrrCsvFootnote"
);
+ MortalityChargesFootnote = p.datum("MortalityChargesFootnote"
);
+ LoanAndWithdrawalFootnote = p.datum("LoanAndWithdrawalFootnote"
);
+ PresaleTrackingNumber = p.datum("PresaleTrackingNumber"
);
+ CompositeTrackingNumber = p.datum("CompositeTrackingNumber"
);
+ InforceTrackingNumber = p.datum("InforceTrackingNumber"
);
+ InforceCompositeTrackingNumber =
p.datum("InforceCompositeTrackingNumber" );
+ InforceNonGuaranteedFootnote0 =
p.datum("InforceNonGuaranteedFootnote0" );
+ InforceNonGuaranteedFootnote1 =
p.datum("InforceNonGuaranteedFootnote1" );
+ InforceNonGuaranteedFootnote2 =
p.datum("InforceNonGuaranteedFootnote2" );
+ InforceNonGuaranteedFootnote3 =
p.datum("InforceNonGuaranteedFootnote3" );
+ NonGuaranteedFootnote = p.datum("NonGuaranteedFootnote"
);
+ MonthlyChargesPaymentFootnote =
p.datum("MonthlyChargesPaymentFootnote" );
}
ProducerName = (*b->Input_)["AgentName"].str();
Modified: lmi/trunk/mec_server.cpp
===================================================================
--- lmi/trunk/mec_server.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/mec_server.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -117,7 +117,7 @@
,StateOfJurisdiction
);
- stratified_charges
stratified(AddDataDir(product_filenames["TierFilename"].str()));
+ stratified_charges
stratified(AddDataDir(product_filenames.datum("TierFilename")));
// SOMEDAY !! Ideally these would be in the GUI (or read from product
files).
round_to<double> const RoundNonMecPrem(2, r_downward);
@@ -129,7 +129,7 @@
if(oe_modal_table == target_premium_type)
{
TargetPremiumRates = actuarial_table_rates
- (AddDataDir(product_filenames["TgtPremFilename"].str())
+ (AddDataDir(product_filenames.datum("TgtPremFilename"))
,static_cast<long int>(database.Query(DB_TgtPremTable))
,input.issue_age()
,input.years_to_maturity()
@@ -141,7 +141,7 @@
}
std::vector<double> const CvatCorridorFactors = actuarial_table_rates
- (AddDataDir(product_filenames["CorridorFilename"].str())
+ (AddDataDir(product_filenames.datum("CorridorFilename"))
,static_cast<long int>(database.Query(DB_CorridorTable))
,input.issue_age()
,input.years_to_maturity()
@@ -156,14 +156,14 @@
tabular_Ax.push_back(1.0);
std::vector<double> const tabular_7Px = actuarial_table_rates
- (AddDataDir(product_filenames["TAMRA7PayFilename"].str())
+ (AddDataDir(product_filenames.datum("TAMRA7PayFilename"))
,static_cast<long int>(database.Query(DB_TAMRA7PayTable))
,input.issue_age()
,input.years_to_maturity()
);
std::vector<double> Mly7702qc = actuarial_table_rates
- (AddDataDir(product_filenames["IRC7702Filename"].str())
+ (AddDataDir(product_filenames.datum("IRC7702Filename"))
,static_cast<long int>(database.Query(DB_IRC7702QTable))
,input.issue_age()
,input.years_to_maturity()
Modified: lmi/trunk/product_data.cpp
===================================================================
--- lmi/trunk/product_data.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/product_data.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -71,6 +71,13 @@
{
}
+/// Get string datum (without annotation) for named member.
+
+std::string const& product_data::datum(std::string const& name) const
+{
+ return *member_cast<std::string>(operator[](name));
+}
+
/// Enregister certain data members for access via any_member<>[].
void product_data::ascribe_members()
Modified: lmi/trunk/product_data.hpp
===================================================================
--- lmi/trunk/product_data.hpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/product_data.hpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -54,6 +54,8 @@
explicit product_data(std::string const& product_name);
~product_data();
+ std::string const& datum(std::string const& name) const;
+
// Legacy functions to support creating product files programmatically.
static void WritePolFiles();
static void WriteProprietaryPolFiles();
Modified: lmi/trunk/product_file_test.cpp
===================================================================
--- lmi/trunk/product_file_test.cpp 2010-04-07 12:06:44 UTC (rev 4834)
+++ lmi/trunk/product_file_test.cpp 2010-04-11 20:37:23 UTC (rev 4835)
@@ -80,10 +80,10 @@
policy_filename_ = "sample";
product_data p(policy_filename_);
- database_filename_ = p["DatabaseFilename"].str();
- fund_filename_ = p["FundFilename" ].str();
- rounding_filename_ = p["RoundingFilename"].str();
- stratified_filename_ = p["TierFilename" ].str();
+ database_filename_ = p.datum("DatabaseFilename");
+ fund_filename_ = p.datum("FundFilename" );
+ rounding_filename_ = p.datum("RoundingFilename");
+ stratified_filename_ = p.datum("TierFilename" );
}
void product_file_test::read_database_file()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [4835] Refactor read-only access to class product_data,
Greg Chicares <=