[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [4825] Reimplement class product_data
From: |
Greg Chicares |
Subject: |
[lmi-commits] [4825] Reimplement class product_data |
Date: |
Fri, 02 Apr 2010 11:23:35 +0000 |
Revision: 4825
http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4825
Author: chicares
Date: 2010-04-02 11:23:35 +0000 (Fri, 02 Apr 2010)
Log Message:
-----------
Reimplement class product_data
Modified Paths:
--------------
lmi/trunk/ChangeLog
lmi/trunk/ihs_basicval.cpp
lmi/trunk/ihs_database.cpp
lmi/trunk/ledger_invariant.cpp
lmi/trunk/mec_server.cpp
lmi/trunk/policy_document.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-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/ChangeLog 2010-04-02 11:23:35 UTC (rev 4825)
@@ -24729,3 +24729,23 @@
product_file_test.cpp
Rename class 'TProductData' to 'product_data'.
+20100402T0154Z <address@hidden> [762]
+
+ generate_product_files.cpp
+ product_file_test.cpp
+ xml_serializable.hpp
+ xml_serializable.tpp
+Add file functions; set default name-check policy.
+
+20100402T1123Z <address@hidden> [762]
+
+ ihs_basicval.cpp
+ ihs_database.cpp
+ ledger_invariant.cpp
+ mec_server.cpp
+ policy_document.cpp
+ product_data.cpp
+ product_data.hpp
+ product_file_test.cpp
+Reimplement class product_data.
+
Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/ihs_basicval.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -238,16 +238,16 @@
std::string("Issue age greater than maximum")
);
}
- FundData_.reset(new FundData(AddDataDir(ProductData_->GetFundFilename())));
+ FundData_.reset(new
FundData(AddDataDir((*ProductData_)["FundFilename"].str())));
RoundingRules_.reset
(new rounding_rules
(StreamableRoundingRules
- (AddDataDir(ProductData_->GetRoundingFilename())
+ (AddDataDir((*ProductData_)["RoundingFilename"].str())
).get_rounding_rules()
)
);
StratifiedCharges_.reset
- (new stratified_charges(AddDataDir(ProductData_->GetTierFilename()))
+ (new
stratified_charges(AddDataDir((*ProductData_)["TierFilename"].str()))
);
SpreadFor7702_.assign
(Length
@@ -323,17 +323,17 @@
);
}
// FundData_ = new FundData
-// (AddDataDir(ProductData_->GetFundFilename())
+// (AddDataDir((*ProductData_)["FundFilename"].str())
// );
RoundingRules_.reset
(new rounding_rules
(StreamableRoundingRules
- (AddDataDir(ProductData_->GetRoundingFilename())
+ (AddDataDir((*ProductData_)["RoundingFilename"].str())
).get_rounding_rules()
)
);
StratifiedCharges_.reset
- (new stratified_charges(AddDataDir(ProductData_->GetTierFilename()))
+ (new
stratified_charges(AddDataDir((*ProductData_)["TierFilename"].str()))
);
// Requires database.
@@ -670,7 +670,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_->GetInsCoDomicile());
+ StateOfDomicile_ =
mc_state_from_string((*ProductData_)["InsCoDomicile"].str());
// TODO ?? Perhaps we want the premium-tax load instead of the
// premium-tax rate here; or maybe we want neither as a member
@@ -1956,14 +1956,14 @@
std::vector<double> BasicValues::GetCvatCorridorFactors() const
{
return GetTable
- (ProductData_->GetCorridorFilename()
+ ((*ProductData_)["CorridorFilename"].str()
,DB_CorridorTable
);
}
std::vector<double> BasicValues::GetCurrCOIRates0() const
{
return GetTable
- (ProductData_->GetCurrCOIFilename()
+ ((*ProductData_)["CurrCOIFilename"].str()
,DB_CurrCOITable
,true
,CanBlend
@@ -1978,7 +1978,7 @@
)
{
return GetTable
- (ProductData_->GetCurrCOIFilename()
+ ((*ProductData_)["CurrCOIFilename"].str()
,DB_CurrCOITable1
,true
,CanBlend
@@ -1998,7 +1998,7 @@
)
{
return GetTable
- (ProductData_->GetCurrCOIFilename()
+ ((*ProductData_)["CurrCOIFilename"].str()
,DB_CurrCOITable2
,true
,CanBlend
@@ -2013,14 +2013,14 @@
std::vector<double> BasicValues::GetGuarCOIRates() const
{
return GetTable
- (ProductData_->GetGuarCOIFilename()
+ ((*ProductData_)["GuarCOIFilename"].str()
,DB_GuarCOITable
);
}
std::vector<double> BasicValues::GetSmokerBlendedGuarCOIRates() const
{
return GetTable
- (ProductData_->GetGuarCOIFilename()
+ ((*ProductData_)["GuarCOIFilename"].str()
,DB_GuarCOITable
,true
,CanBlend
@@ -2030,7 +2030,7 @@
std::vector<double> BasicValues::GetWpRates() const
{
return GetTable
- (ProductData_->GetWPFilename()
+ ((*ProductData_)["WPFilename"].str()
,DB_WPTable
,Database_->Query(DB_AllowWP)
);
@@ -2038,7 +2038,7 @@
std::vector<double> BasicValues::GetAdbRates() const
{
return GetTable
- (ProductData_->GetADDFilename()
+ ((*ProductData_)["ADDFilename"].str()
,DB_ADDTable
,Database_->Query(DB_AllowADD)
);
@@ -2046,7 +2046,7 @@
std::vector<double> BasicValues::GetChildRiderRates() const
{
return GetTable
- (ProductData_->GetChildRiderFilename()
+ ((*ProductData_)["ChildRiderFilename"].str()
,DB_ChildRiderTable
,Database_->Query(DB_AllowChild)
);
@@ -2059,7 +2059,7 @@
}
std::vector<double> z = actuarial_table_rates
- (AddDataDir(ProductData_->GetCurrSpouseRiderFilename())
+ (AddDataDir((*ProductData_)["CurrSpouseRiderFilename"].str())
,static_cast<long int>(Database_->Query(DB_SpouseRiderTable))
,yare_input_.SpouseIssueAge
,EndtAge - yare_input_.SpouseIssueAge
@@ -2075,7 +2075,7 @@
}
std::vector<double> z = actuarial_table_rates
- (AddDataDir(ProductData_->GetGuarSpouseRiderFilename())
+ (AddDataDir((*ProductData_)["GuarSpouseRiderFilename"].str())
,static_cast<long int>(Database_->Query(DB_SpouseRiderGuarTable))
,yare_input_.SpouseIssueAge
,EndtAge - yare_input_.SpouseIssueAge
@@ -2086,7 +2086,7 @@
std::vector<double> BasicValues::GetCurrentTermRates() const
{
return GetTable
- (ProductData_->GetCurrTermFilename()
+ ((*ProductData_)["CurrTermFilename"].str()
,DB_TermTable
,Database_->Query(DB_AllowTerm)
,CanBlend
@@ -2096,7 +2096,7 @@
std::vector<double> BasicValues::GetGuaranteedTermRates() const
{
return GetTable
- (ProductData_->GetGuarTermFilename()
+ ((*ProductData_)["GuarTermFilename"].str()
,DB_GuarTermTable
,Database_->Query(DB_AllowTerm)
,CanBlend
@@ -2106,21 +2106,21 @@
std::vector<double> BasicValues::GetTableYRates() const
{
return GetTable
- (ProductData_->GetTableYFilename()
+ ((*ProductData_)["TableYFilename"].str()
,DB_TableYTable
);
}
std::vector<double> BasicValues::GetTAMRA7PayRates() const
{
return GetTable
- (ProductData_->GetTAMRA7PayFilename()
+ ((*ProductData_)["TAMRA7PayFilename"].str()
,DB_TAMRA7PayTable
);
}
std::vector<double> BasicValues::GetTgtPremRates() const
{
return GetTable
- (ProductData_->GetTgtPremFilename()
+ ((*ProductData_)["TgtPremFilename"].str()
,DB_TgtPremTable
,oe_modal_table == Database_->Query(DB_TgtPremType)
);
@@ -2128,14 +2128,14 @@
std::vector<double> BasicValues::GetIRC7702Rates() const
{
return GetTable
- (ProductData_->GetIRC7702Filename()
+ ((*ProductData_)["IRC7702Filename"].str()
,DB_IRC7702QTable
);
}
std::vector<double> BasicValues::Get83GamRates() const
{
return GetTable
- (ProductData_->GetGam83Filename()
+ ((*ProductData_)["Gam83Filename"].str()
,DB_83GamTable
,true
,CannotBlend
@@ -2150,7 +2150,7 @@
}
return GetTable
- (ProductData_->GetSubstdTblMultFilename()
+ ((*ProductData_)["SubstdTblMultFilename"].str()
,DB_SubstdTblMultTable
);
}
@@ -2162,7 +2162,7 @@
}
return GetTable
- (ProductData_->GetCurrSpecAmtLoadFilename()
+ ((*ProductData_)["CurrSpecAmtLoadFilename"].str()
,DB_CurrSpecAmtLoadTable
);
}
@@ -2174,7 +2174,7 @@
}
return GetTable
- (ProductData_->GetGuarSpecAmtLoadFilename()
+ ((*ProductData_)["GuarSpecAmtLoadFilename"].str()
,DB_GuarSpecAmtLoadTable
);
}
Modified: lmi/trunk/ihs_database.cpp
===================================================================
--- lmi/trunk/ihs_database.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/ihs_database.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -58,7 +58,7 @@
,mcenum_uw_basis a_UWBasis
,mcenum_state a_State
)
- :Filename (AddDataDir(product_data(a_ProductName).GetDatabaseFilename()))
+ :Filename
(AddDataDir(product_data(a_ProductName)["DatabaseFilename"].str()))
,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).GetDatabaseFilename()))
+
:Filename(AddDataDir(product_data(input.ProductName)["DatabaseFilename"].str()))
{
// GET RID OF Gender, Class, Smoker, etc.
Gender = input.Gender;
Modified: lmi/trunk/ledger_invariant.cpp
===================================================================
--- lmi/trunk/ledger_invariant.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/ledger_invariant.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -583,87 +583,88 @@
// The antediluvian branch has a null ProductData_ object.
if(b->ProductData_)
{
- PolicyMktgName = b->ProductData_->GetPolicyMktgName();
- PolicyLegalName = b->ProductData_->GetPolicyLegalName();
- PolicyForm = b->ProductData_->GetPolicyForm();
- InsCoShortName = b->ProductData_->GetInsCoShortName();
- InsCoName = b->ProductData_->GetInsCoName();
- InsCoAddr = b->ProductData_->GetInsCoAddr();
- InsCoStreet = b->ProductData_->GetInsCoStreet();
- InsCoPhone = b->ProductData_->GetInsCoPhone();
- MainUnderwriter = b->ProductData_->GetMainUnderwriter();
- MainUnderwriterAddress = b->ProductData_->GetMainUnderwriterAddress();
- CoUnderwriter = b->ProductData_->GetCoUnderwriter();
- CoUnderwriterAddress = b->ProductData_->GetCoUnderwriterAddress();
+ 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();
- AvName = b->ProductData_->GetAvName();
- CsvName = b->ProductData_->GetCsvName();
- CsvHeaderName = b->ProductData_->GetCsvHeaderName();
- NoLapseProvisionName = b->ProductData_->GetNoLapseProvisionName();
- InterestDisclaimer = b->ProductData_->GetInterestDisclaimer();
- GuarMortalityFootnote = b->ProductData_->GetGuarMortalityFootnote();
+ AvName = p["AvName"
].str();
+ CsvName = p["CsvName"
].str();
+ CsvHeaderName = p["CsvHeaderName"
].str();
+ NoLapseProvisionName = p["NoLapseProvisionName"
].str();
+ InterestDisclaimer = p["InterestDisclaimer"
].str();
+ GuarMortalityFootnote = p["GuarMortalityFootnote"
].str();
- AccountValueFootnote = b->ProductData_->GetAccountValueFootnote();
- AttainedAgeFootnote = b->ProductData_->GetAttainedAgeFootnote();
- CashSurrValueFootnote = b->ProductData_->GetCashSurrValueFootnote();
- DeathBenefitFootnote = b->ProductData_->GetDeathBenefitFootnote();
- InitialPremiumFootnote = b->ProductData_->GetInitialPremiumFootnote();
- NetPremiumFootnote = b->ProductData_->GetNetPremiumFootnote();
- OutlayFootnote = b->ProductData_->GetOutlayFootnote();
- PolicyYearFootnote = b->ProductData_->GetPolicyYearFootnote();
+ 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();
- ADDFootnote = b->ProductData_->GetADDFootnote();
- ChildFootnote = b->ProductData_->GetChildFootnote();
- SpouseFootnote = b->ProductData_->GetSpouseFootnote();
- TermFootnote = b->ProductData_->GetTermFootnote();
- WaiverFootnote = b->ProductData_->GetWaiverFootnote();
+ ADDFootnote = p["ADDFootnote"
].str();
+ ChildFootnote = p["ChildFootnote"
].str();
+ SpouseFootnote = p["SpouseFootnote"
].str();
+ TermFootnote = p["TermFootnote"
].str();
+ WaiverFootnote = p["WaiverFootnote"
].str();
- MinimumPremiumFootnote = b->ProductData_->GetMinimumPremiumFootnote();
- PremAllocationFootnote = b->ProductData_->GetPremAllocationFootnote();
+ MinimumPremiumFootnote = p["MinimumPremiumFootnote"
].str();
+ PremAllocationFootnote = p["PremAllocationFootnote"
].str();
- ProductDescription =
b->ProductData_->GetProductDescription();
- StableValueFootnote =
b->ProductData_->GetStableValueFootnote();
- NoVanishPremiumFootnote =
b->ProductData_->GetNoVanishPremiumFootnote();
- RejectPremiumFootnote =
b->ProductData_->GetRejectPremiumFootnote();
- ExpRatingFootnote =
b->ProductData_->GetExpRatingFootnote();
- MortalityBlendFootnote =
b->ProductData_->GetMortalityBlendFootnote();
- HypotheticalRatesFootnote =
b->ProductData_->GetHypotheticalRatesFootnote();
- SalesLoadRefundFootnote =
b->ProductData_->GetSalesLoadRefundFootnote();
- NoLapseFootnote = b->ProductData_->GetNoLapseFootnote();
- MarketValueAdjFootnote =
b->ProductData_->GetMarketValueAdjFootnote();
- ExchangeChargeFootnote0 =
b->ProductData_->GetExchangeChargeFootnote0();
- CurrentValuesFootnote =
b->ProductData_->GetCurrentValuesFootnote();
- DBOption1Footnote =
b->ProductData_->GetDBOption1Footnote();
- DBOption2Footnote =
b->ProductData_->GetDBOption2Footnote();
- ExpRatRiskChargeFootnote =
b->ProductData_->GetExpRatRiskChargeFootnote();
- ExchangeChargeFootnote1 =
b->ProductData_->GetExchangeChargeFootnote1();
- FlexiblePremiumFootnote =
b->ProductData_->GetFlexiblePremiumFootnote();
- GuaranteedValuesFootnote =
b->ProductData_->GetGuaranteedValuesFootnote();
- CreditingRateFootnote =
b->ProductData_->GetCreditingRateFootnote();
- MecFootnote = b->ProductData_->GetMecFootnote();
- MidpointValuesFootnote =
b->ProductData_->GetMidpointValuesFootnote();
- SinglePremiumFootnote =
b->ProductData_->GetSinglePremiumFootnote();
- MonthlyChargesFootnote =
b->ProductData_->GetMonthlyChargesFootnote();
- UltCreditingRateFootnote =
b->ProductData_->GetUltCreditingRateFootnote();
- MaxNaarFootnote = b->ProductData_->GetMaxNaarFootnote();
- PremTaxSurrChgFootnote =
b->ProductData_->GetPremTaxSurrChgFootnote();
- PolicyFeeFootnote =
b->ProductData_->GetPolicyFeeFootnote();
- AssetChargeFootnote =
b->ProductData_->GetAssetChargeFootnote();
- InvestmentIncomeFootnote =
b->ProductData_->GetInvestmentIncomeFootnote();
- IrrDbFootnote = b->ProductData_->GetIrrDbFootnote();
- IrrCsvFootnote = b->ProductData_->GetIrrCsvFootnote();
- MortalityChargesFootnote =
b->ProductData_->GetMortalityChargesFootnote();
- LoanAndWithdrawalFootnote =
b->ProductData_->GetLoanAndWithdrawalFootnote();
- PresaleTrackingNumber =
b->ProductData_->GetPresaleTrackingNumber();
- CompositeTrackingNumber =
b->ProductData_->GetCompositeTrackingNumber();
- InforceTrackingNumber =
b->ProductData_->GetInforceTrackingNumber();
- InforceCompositeTrackingNumber =
b->ProductData_->GetInforceCompositeTrackingNumber();
- InforceNonGuaranteedFootnote0 =
b->ProductData_->GetInforceNonGuaranteedFootnote0();
- InforceNonGuaranteedFootnote1 =
b->ProductData_->GetInforceNonGuaranteedFootnote1();
- InforceNonGuaranteedFootnote2 =
b->ProductData_->GetInforceNonGuaranteedFootnote2();
- InforceNonGuaranteedFootnote3 =
b->ProductData_->GetInforceNonGuaranteedFootnote3();
- NonGuaranteedFootnote =
b->ProductData_->GetNonGuaranteedFootnote();
- MonthlyChargesPaymentFootnote =
b->ProductData_->GetMonthlyChargesPaymentFootnote();
+ 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();
}
ProducerName = (*b->Input_)["AgentName"].str();
Modified: lmi/trunk/mec_server.cpp
===================================================================
--- lmi/trunk/mec_server.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/mec_server.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -117,7 +117,7 @@
,StateOfJurisdiction
);
- stratified_charges
stratified(AddDataDir(product_filenames.GetTierFilename()));
+ stratified_charges
stratified(AddDataDir(product_filenames["TierFilename"].str()));
// 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.GetTgtPremFilename())
+ (AddDataDir(product_filenames["TgtPremFilename"].str())
,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.GetCorridorFilename())
+ (AddDataDir(product_filenames["CorridorFilename"].str())
,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.GetTAMRA7PayFilename())
+ (AddDataDir(product_filenames["TAMRA7PayFilename"].str())
,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.GetIRC7702Filename())
+ (AddDataDir(product_filenames["IRC7702Filename"].str())
,static_cast<long int>(database.Query(DB_IRC7702QTable))
,input.issue_age()
,input.years_to_maturity()
Modified: lmi/trunk/policy_document.cpp
===================================================================
--- lmi/trunk/policy_document.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/policy_document.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -98,7 +98,7 @@
void PolicyDocument::ReadDocument(std::string const& filename)
{
- product_data_.Read(filename);
+ product_data_.load(filename);
if(!GetViews().empty())
{
PolicyView& view = PredominantView();
Modified: lmi/trunk/product_data.cpp
===================================================================
--- lmi/trunk/product_data.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/product_data.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -1,4 +1,4 @@
-// Product data.
+// Product data representable as strings.
//
// Copyright (C) 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010 Gregory W. Chicares.
//
@@ -21,418 +21,275 @@
// $Id$
-// This class contains names of files containing a product's tables as well
-// as strings that are the same for all instances of that product.
-
-// The tables are in SOA table manager binary format.
-
-// The (SOA) table numbers are in the database. To avoid circularity, first
-// instantiate this class, then instantiate the database before reading any
-// tables with the default methods that look to the database for table numbers.
-// This is handled automatically in class BasicValues, where those methods are.
-
#ifdef __BORLANDC__
# include "pchfile.hpp"
# pragma hdrstop
#endif // __BORLANDC__
#include "product_data.hpp"
+#include "xml_serializable.tpp"
#include "alert.hpp"
#include "assert_lmi.hpp"
-#include "data_directory.hpp"
-#include "platform_dependent.hpp" // access()
-#include "xml_serialize.hpp"
+#include "data_directory.hpp" // AddDataDir()
+#include "miscellany.hpp" // lmi_array_size()
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/path.hpp>
-#include <string>
+#include <algorithm> // std::find()
+#include <vector>
-//============================================================================
+template class xml_serializable<product_data>;
+
+/// Private default ctor.
+///
+/// Used only by friend class PolicyDocument and 'my_prod.cpp'.
+
product_data::product_data()
{
+ ascribe_members();
}
-//============================================================================
+product_data::product_data(std::string const& filename)
+{
+ ascribe_members();
+
+ fs::path path(filename);
+ LMI_ASSERT(filename == path.leaf());
+ path = fs::change_extension(path, ".policy");
+ load(AddDataDir(path.string()));
+}
+
product_data::~product_data()
{
}
-//============================================================================
-product_data::product_data(std::string const& a_Filename)
+void product_data::ascribe_members()
{
- Init(a_Filename);
+ ascribe("DatabaseFilename" , &product_data::DatabaseFilename
);
+ ascribe("FundFilename" , &product_data::FundFilename
);
+ ascribe("RoundingFilename" , &product_data::RoundingFilename
);
+ ascribe("TierFilename" , &product_data::TierFilename
);
+ ascribe("CorridorFilename" , &product_data::CorridorFilename
);
+ ascribe("CurrCOIFilename" , &product_data::CurrCOIFilename
);
+ ascribe("GuarCOIFilename" , &product_data::GuarCOIFilename
);
+ ascribe("WPFilename" , &product_data::WPFilename
);
+ ascribe("ADDFilename" , &product_data::ADDFilename
);
+ ascribe("ChildRiderFilename" ,
&product_data::ChildRiderFilename );
+ ascribe("CurrSpouseRiderFilename" ,
&product_data::CurrSpouseRiderFilename );
+ ascribe("GuarSpouseRiderFilename" ,
&product_data::GuarSpouseRiderFilename );
+ ascribe("CurrTermFilename" , &product_data::CurrTermFilename
);
+ ascribe("GuarTermFilename" , &product_data::GuarTermFilename
);
+ ascribe("TableYFilename" , &product_data::TableYFilename
);
+ ascribe("PremTaxFilename" , &product_data::PremTaxFilename
);
+ ascribe("TAMRA7PayFilename" , &product_data::TAMRA7PayFilename
);
+ ascribe("TgtPremFilename" , &product_data::TgtPremFilename
);
+ ascribe("IRC7702Filename" , &product_data::IRC7702Filename
);
+ ascribe("Gam83Filename" , &product_data::Gam83Filename
);
+ ascribe("SubstdTblMultFilename" ,
&product_data::SubstdTblMultFilename );
+ ascribe("CurrSpecAmtLoadFilename" ,
&product_data::CurrSpecAmtLoadFilename );
+ ascribe("GuarSpecAmtLoadFilename" ,
&product_data::GuarSpecAmtLoadFilename );
+ ascribe("PolicyForm" , &product_data::PolicyForm
);
+ ascribe("PolicyMktgName" , &product_data::PolicyMktgName
);
+ ascribe("PolicyLegalName" , &product_data::PolicyLegalName
);
+ ascribe("InsCoShortName" , &product_data::InsCoShortName
);
+ ascribe("InsCoName" , &product_data::InsCoName
);
+ ascribe("InsCoAddr" , &product_data::InsCoAddr
);
+ ascribe("InsCoStreet" , &product_data::InsCoStreet
);
+ ascribe("InsCoPhone" , &product_data::InsCoPhone
);
+ ascribe("InsCoDomicile" , &product_data::InsCoDomicile
);
+ ascribe("MainUnderwriter" , &product_data::MainUnderwriter
);
+ ascribe("MainUnderwriterAddress" ,
&product_data::MainUnderwriterAddress );
+ ascribe("CoUnderwriter" , &product_data::CoUnderwriter
);
+ ascribe("CoUnderwriterAddress" ,
&product_data::CoUnderwriterAddress );
+ ascribe("AvName" , &product_data::AvName
);
+ ascribe("CsvName" , &product_data::CsvName
);
+ ascribe("CsvHeaderName" , &product_data::CsvHeaderName
);
+ ascribe("NoLapseProvisionName" ,
&product_data::NoLapseProvisionName );
+ ascribe("AccountValueFootnote" ,
&product_data::AccountValueFootnote );
+ ascribe("AttainedAgeFootnote" ,
&product_data::AttainedAgeFootnote );
+ ascribe("CashSurrValueFootnote" ,
&product_data::CashSurrValueFootnote );
+ ascribe("DeathBenefitFootnote" ,
&product_data::DeathBenefitFootnote );
+ ascribe("InitialPremiumFootnote" ,
&product_data::InitialPremiumFootnote );
+ ascribe("NetPremiumFootnote" ,
&product_data::NetPremiumFootnote );
+ ascribe("OutlayFootnote" , &product_data::OutlayFootnote
);
+ ascribe("PolicyYearFootnote" ,
&product_data::PolicyYearFootnote );
+ ascribe("ADDFootnote" , &product_data::ADDFootnote
);
+ ascribe("ChildFootnote" , &product_data::ChildFootnote
);
+ ascribe("SpouseFootnote" , &product_data::SpouseFootnote
);
+ ascribe("TermFootnote" , &product_data::TermFootnote
);
+ ascribe("WaiverFootnote" , &product_data::WaiverFootnote
);
+ ascribe("MinimumPremiumFootnote" ,
&product_data::MinimumPremiumFootnote );
+ ascribe("PremAllocationFootnote" ,
&product_data::PremAllocationFootnote );
+ ascribe("InterestDisclaimer" ,
&product_data::InterestDisclaimer );
+ ascribe("GuarMortalityFootnote" ,
&product_data::GuarMortalityFootnote );
+ ascribe("ProductDescription" ,
&product_data::ProductDescription );
+ ascribe("StableValueFootnote" ,
&product_data::StableValueFootnote );
+ ascribe("NoVanishPremiumFootnote" ,
&product_data::NoVanishPremiumFootnote );
+ ascribe("RejectPremiumFootnote" ,
&product_data::RejectPremiumFootnote );
+ ascribe("ExpRatingFootnote" , &product_data::ExpRatingFootnote
);
+ ascribe("MortalityBlendFootnote" ,
&product_data::MortalityBlendFootnote );
+ ascribe("HypotheticalRatesFootnote" ,
&product_data::HypotheticalRatesFootnote );
+ ascribe("SalesLoadRefundFootnote" ,
&product_data::SalesLoadRefundFootnote );
+ ascribe("NoLapseFootnote" , &product_data::NoLapseFootnote
);
+ ascribe("MarketValueAdjFootnote" ,
&product_data::MarketValueAdjFootnote );
+ ascribe("ExchangeChargeFootnote0" ,
&product_data::ExchangeChargeFootnote0 );
+ ascribe("CurrentValuesFootnote" ,
&product_data::CurrentValuesFootnote );
+ ascribe("DBOption1Footnote" , &product_data::DBOption1Footnote
);
+ ascribe("DBOption2Footnote" , &product_data::DBOption2Footnote
);
+ ascribe("ExpRatRiskChargeFootnote" ,
&product_data::ExpRatRiskChargeFootnote );
+ ascribe("ExchangeChargeFootnote1" ,
&product_data::ExchangeChargeFootnote1 );
+ ascribe("FlexiblePremiumFootnote" ,
&product_data::FlexiblePremiumFootnote );
+ ascribe("GuaranteedValuesFootnote" ,
&product_data::GuaranteedValuesFootnote );
+ ascribe("CreditingRateFootnote" ,
&product_data::CreditingRateFootnote );
+ ascribe("MecFootnote" , &product_data::MecFootnote
);
+ ascribe("MidpointValuesFootnote" ,
&product_data::MidpointValuesFootnote );
+ ascribe("SinglePremiumFootnote" ,
&product_data::SinglePremiumFootnote );
+ ascribe("MonthlyChargesFootnote" ,
&product_data::MonthlyChargesFootnote );
+ ascribe("UltCreditingRateFootnote" ,
&product_data::UltCreditingRateFootnote );
+ ascribe("MaxNaarFootnote" , &product_data::MaxNaarFootnote
);
+ ascribe("PremTaxSurrChgFootnote" ,
&product_data::PremTaxSurrChgFootnote );
+ ascribe("PolicyFeeFootnote" , &product_data::PolicyFeeFootnote
);
+ ascribe("AssetChargeFootnote" ,
&product_data::AssetChargeFootnote );
+ ascribe("InvestmentIncomeFootnote" ,
&product_data::InvestmentIncomeFootnote );
+ ascribe("IrrDbFootnote" , &product_data::IrrDbFootnote
);
+ ascribe("IrrCsvFootnote" , &product_data::IrrCsvFootnote
);
+ ascribe("MortalityChargesFootnote" ,
&product_data::MortalityChargesFootnote );
+ ascribe("LoanAndWithdrawalFootnote" ,
&product_data::LoanAndWithdrawalFootnote );
+ ascribe("PresaleTrackingNumber" ,
&product_data::PresaleTrackingNumber );
+ ascribe("CompositeTrackingNumber" ,
&product_data::CompositeTrackingNumber );
+ ascribe("InforceTrackingNumber" ,
&product_data::InforceTrackingNumber );
+ ascribe("InforceCompositeTrackingNumber",
&product_data::InforceCompositeTrackingNumber);
+ ascribe("InforceNonGuaranteedFootnote0" ,
&product_data::InforceNonGuaranteedFootnote0 );
+ ascribe("InforceNonGuaranteedFootnote1" ,
&product_data::InforceNonGuaranteedFootnote1 );
+ ascribe("InforceNonGuaranteedFootnote2" ,
&product_data::InforceNonGuaranteedFootnote2 );
+ ascribe("InforceNonGuaranteedFootnote3" ,
&product_data::InforceNonGuaranteedFootnote3 );
+ ascribe("NonGuaranteedFootnote" ,
&product_data::NonGuaranteedFootnote );
+ ascribe("MonthlyChargesPaymentFootnote" ,
&product_data::MonthlyChargesPaymentFootnote );
}
-//============================================================================
-void product_data::Init(std::string const& a_Filename)
+void product_data::Read(std::string const& filename)
{
- fs::path path(a_Filename);
- LMI_ASSERT(a_Filename == path.leaf());
- path = fs::change_extension(path, ".policy");
- Read(AddDataDir(path.string()));
+ load(filename);
}
-namespace
+void product_data::Write(std::string const& filename) const
{
-std::string xml_root_name()
+ save(filename);
+}
+
+/// Serial number of this class's xml version.
+///
+/// version 0: 20100402T1123Z
+
+int product_data::class_version() const
{
+ return 0;
+}
+
+std::string product_data::xml_root_name() const
+{
return "policy";
}
-} // Unnamed namespace.
-//============================================================================
-void product_data::Read(std::string const& a_Filename)
+bool product_data::is_detritus(std::string const& s) const
{
- if(access(a_Filename.c_str(), R_OK))
+ static std::string const a[] =
+ {"Remove this string when adding the first removed entity."
+ };
+ static std::vector<std::string> const v(a, a + lmi_array_size(a));
+ return v.end() != std::find(v.begin(), v.end(), s);
+}
+
+std::string product_data::redintegrate_ex_ante
+ (int file_version
+ ,std::string const& // name
+ ,std::string const& value
+ ) const
+{
+ if(class_version() == file_version)
{
- fatal_error()
- << "File '"
- << a_Filename
- << "' is required but could not be found. Try reinstalling."
- << LMI_FLUSH
- ;
+ return value;
}
-
- xml_lmi::dom_parser parser(a_Filename);
- xml::element const& root = parser.root_node(xml_root_name());
-
-# define GET_ELEMENT(name) xml_serialize::get_element(root, #name, name)
-
- GET_ELEMENT(DatabaseFilename );
- GET_ELEMENT(FundFilename );
- GET_ELEMENT(CorridorFilename );
- GET_ELEMENT(CurrCOIFilename );
- GET_ELEMENT(GuarCOIFilename );
- GET_ELEMENT(WPFilename );
- GET_ELEMENT(ADDFilename );
- GET_ELEMENT(ChildRiderFilename );
- GET_ELEMENT(CurrSpouseRiderFilename );
- GET_ELEMENT(GuarSpouseRiderFilename );
- GET_ELEMENT(CurrTermFilename );
- GET_ELEMENT(GuarTermFilename );
- GET_ELEMENT(TableYFilename );
- GET_ELEMENT(PremTaxFilename );
- GET_ELEMENT(TAMRA7PayFilename );
- GET_ELEMENT(TgtPremFilename );
- GET_ELEMENT(IRC7702Filename );
- GET_ELEMENT(Gam83Filename );
- GET_ELEMENT(SubstdTblMultFilename );
- GET_ELEMENT(CurrSpecAmtLoadFilename );
- GET_ELEMENT(GuarSpecAmtLoadFilename );
- GET_ELEMENT(RoundingFilename );
- GET_ELEMENT(TierFilename );
- GET_ELEMENT(PolicyForm );
- GET_ELEMENT(PolicyMktgName );
- GET_ELEMENT(PolicyLegalName );
- GET_ELEMENT(InsCoShortName );
- GET_ELEMENT(InsCoName );
- GET_ELEMENT(InsCoAddr );
- GET_ELEMENT(InsCoStreet );
- GET_ELEMENT(InsCoPhone );
- GET_ELEMENT(InsCoDomicile );
- GET_ELEMENT(MainUnderwriter );
- GET_ELEMENT(MainUnderwriterAddress );
- GET_ELEMENT(CoUnderwriter );
- GET_ELEMENT(CoUnderwriterAddress );
- GET_ELEMENT(AvName );
- GET_ELEMENT(CsvName );
- GET_ELEMENT(CsvHeaderName );
- GET_ELEMENT(NoLapseProvisionName );
- GET_ELEMENT(InterestDisclaimer );
- GET_ELEMENT(GuarMortalityFootnote );
- GET_ELEMENT(AccountValueFootnote );
- GET_ELEMENT(AttainedAgeFootnote );
- GET_ELEMENT(CashSurrValueFootnote );
- GET_ELEMENT(DeathBenefitFootnote );
- GET_ELEMENT(InitialPremiumFootnote );
- GET_ELEMENT(NetPremiumFootnote );
- GET_ELEMENT(OutlayFootnote );
- GET_ELEMENT(PolicyYearFootnote );
- GET_ELEMENT(ADDFootnote );
- GET_ELEMENT(ChildFootnote );
- GET_ELEMENT(SpouseFootnote );
- GET_ELEMENT(TermFootnote );
- GET_ELEMENT(WaiverFootnote );
- GET_ELEMENT(MinimumPremiumFootnote );
- GET_ELEMENT(PremAllocationFootnote );
- GET_ELEMENT(ProductDescription );
- GET_ELEMENT(StableValueFootnote );
- GET_ELEMENT(NoVanishPremiumFootnote );
- GET_ELEMENT(RejectPremiumFootnote );
- GET_ELEMENT(ExpRatingFootnote );
- GET_ELEMENT(MortalityBlendFootnote );
- GET_ELEMENT(HypotheticalRatesFootnote );
- GET_ELEMENT(SalesLoadRefundFootnote );
- GET_ELEMENT(NoLapseFootnote );
- GET_ELEMENT(MarketValueAdjFootnote );
- GET_ELEMENT(ExchangeChargeFootnote0 );
- GET_ELEMENT(CurrentValuesFootnote );
- GET_ELEMENT(DBOption1Footnote );
- GET_ELEMENT(DBOption2Footnote );
- GET_ELEMENT(ExpRatRiskChargeFootnote );
- GET_ELEMENT(ExchangeChargeFootnote1 );
- GET_ELEMENT(FlexiblePremiumFootnote );
- GET_ELEMENT(GuaranteedValuesFootnote );
- GET_ELEMENT(CreditingRateFootnote );
- GET_ELEMENT(MecFootnote );
- GET_ELEMENT(MidpointValuesFootnote );
- GET_ELEMENT(SinglePremiumFootnote );
- GET_ELEMENT(MonthlyChargesFootnote );
- GET_ELEMENT(UltCreditingRateFootnote );
- GET_ELEMENT(MaxNaarFootnote );
- GET_ELEMENT(PremTaxSurrChgFootnote );
- GET_ELEMENT(PolicyFeeFootnote );
- GET_ELEMENT(AssetChargeFootnote );
- GET_ELEMENT(InvestmentIncomeFootnote );
- GET_ELEMENT(IrrDbFootnote );
- GET_ELEMENT(IrrCsvFootnote );
- GET_ELEMENT(MortalityChargesFootnote );
- GET_ELEMENT(LoanAndWithdrawalFootnote );
- GET_ELEMENT(PresaleTrackingNumber );
- GET_ELEMENT(CompositeTrackingNumber );
- GET_ELEMENT(InforceTrackingNumber );
- GET_ELEMENT(InforceCompositeTrackingNumber);
- GET_ELEMENT(InforceNonGuaranteedFootnote0 );
- GET_ELEMENT(InforceNonGuaranteedFootnote1 );
- GET_ELEMENT(InforceNonGuaranteedFootnote2 );
- GET_ELEMENT(InforceNonGuaranteedFootnote3 );
- GET_ELEMENT(NonGuaranteedFootnote );
- GET_ELEMENT(MonthlyChargesPaymentFootnote );
-
-# undef GET_ELEMENT
+ else
+ {
+ fatal_error() << "Incompatible file version." << LMI_FLUSH;
+ return value; // Stifle compiler warning.
+ }
}
-//============================================================================
-void product_data::Write(std::string const& a_Filename) const
+void product_data::redintegrate_ex_post
+ (int file_version
+ ,std::map<std::string, std::string> // detritus_map
+ ,std::list<std::string> // residuary_names
+ )
{
- xml_lmi::xml_document document(xml_root_name());
- xml::element& root = document.root_node();
+ if(class_version() == file_version)
+ {
+ return;
+ }
+ else
+ {
+ fatal_error() << "Incompatible file version." << LMI_FLUSH;
+ }
+}
- xml_lmi::set_attr(root, "version", "0");
-
-# define SET_ELEMENT(name) xml_serialize::set_element(root, #name, name)
-
- SET_ELEMENT(DatabaseFilename );
- SET_ELEMENT(FundFilename );
- SET_ELEMENT(CorridorFilename );
- SET_ELEMENT(CurrCOIFilename );
- SET_ELEMENT(GuarCOIFilename );
- SET_ELEMENT(WPFilename );
- SET_ELEMENT(ADDFilename );
- SET_ELEMENT(ChildRiderFilename );
- SET_ELEMENT(CurrSpouseRiderFilename );
- SET_ELEMENT(GuarSpouseRiderFilename );
- SET_ELEMENT(CurrTermFilename );
- SET_ELEMENT(GuarTermFilename );
- SET_ELEMENT(TableYFilename );
- SET_ELEMENT(PremTaxFilename );
- SET_ELEMENT(TAMRA7PayFilename );
- SET_ELEMENT(TgtPremFilename );
- SET_ELEMENT(IRC7702Filename );
- SET_ELEMENT(Gam83Filename );
- SET_ELEMENT(SubstdTblMultFilename );
- SET_ELEMENT(CurrSpecAmtLoadFilename );
- SET_ELEMENT(GuarSpecAmtLoadFilename );
- SET_ELEMENT(RoundingFilename );
- SET_ELEMENT(TierFilename );
- SET_ELEMENT(PolicyForm );
- SET_ELEMENT(PolicyMktgName );
- SET_ELEMENT(PolicyLegalName );
- SET_ELEMENT(InsCoShortName );
- SET_ELEMENT(InsCoName );
- SET_ELEMENT(InsCoAddr );
- SET_ELEMENT(InsCoStreet );
- SET_ELEMENT(InsCoPhone );
- SET_ELEMENT(InsCoDomicile );
- SET_ELEMENT(MainUnderwriter );
- SET_ELEMENT(MainUnderwriterAddress );
- SET_ELEMENT(CoUnderwriter );
- SET_ELEMENT(CoUnderwriterAddress );
- SET_ELEMENT(AvName );
- SET_ELEMENT(CsvName );
- SET_ELEMENT(CsvHeaderName );
- SET_ELEMENT(NoLapseProvisionName );
- SET_ELEMENT(InterestDisclaimer );
- SET_ELEMENT(GuarMortalityFootnote );
- SET_ELEMENT(AccountValueFootnote );
- SET_ELEMENT(AttainedAgeFootnote );
- SET_ELEMENT(CashSurrValueFootnote );
- SET_ELEMENT(DeathBenefitFootnote );
- SET_ELEMENT(InitialPremiumFootnote );
- SET_ELEMENT(NetPremiumFootnote );
- SET_ELEMENT(OutlayFootnote );
- SET_ELEMENT(PolicyYearFootnote );
- SET_ELEMENT(ADDFootnote );
- SET_ELEMENT(ChildFootnote );
- SET_ELEMENT(SpouseFootnote );
- SET_ELEMENT(TermFootnote );
- SET_ELEMENT(WaiverFootnote );
- SET_ELEMENT(MinimumPremiumFootnote );
- SET_ELEMENT(PremAllocationFootnote );
- SET_ELEMENT(ProductDescription );
- SET_ELEMENT(StableValueFootnote );
- SET_ELEMENT(NoVanishPremiumFootnote );
- SET_ELEMENT(RejectPremiumFootnote );
- SET_ELEMENT(ExpRatingFootnote );
- SET_ELEMENT(MortalityBlendFootnote );
- SET_ELEMENT(HypotheticalRatesFootnote );
- SET_ELEMENT(SalesLoadRefundFootnote );
- SET_ELEMENT(NoLapseFootnote );
- SET_ELEMENT(MarketValueAdjFootnote );
- SET_ELEMENT(ExchangeChargeFootnote0 );
- SET_ELEMENT(CurrentValuesFootnote );
- SET_ELEMENT(DBOption1Footnote );
- SET_ELEMENT(DBOption2Footnote );
- SET_ELEMENT(ExpRatRiskChargeFootnote );
- SET_ELEMENT(ExchangeChargeFootnote1 );
- SET_ELEMENT(FlexiblePremiumFootnote );
- SET_ELEMENT(GuaranteedValuesFootnote );
- SET_ELEMENT(CreditingRateFootnote );
- SET_ELEMENT(MecFootnote );
- SET_ELEMENT(MidpointValuesFootnote );
- SET_ELEMENT(SinglePremiumFootnote );
- SET_ELEMENT(MonthlyChargesFootnote );
- SET_ELEMENT(UltCreditingRateFootnote );
- SET_ELEMENT(MaxNaarFootnote );
- SET_ELEMENT(PremTaxSurrChgFootnote );
- SET_ELEMENT(PolicyFeeFootnote );
- SET_ELEMENT(AssetChargeFootnote );
- SET_ELEMENT(InvestmentIncomeFootnote );
- SET_ELEMENT(IrrDbFootnote );
- SET_ELEMENT(IrrCsvFootnote );
- SET_ELEMENT(MortalityChargesFootnote );
- SET_ELEMENT(LoanAndWithdrawalFootnote );
- SET_ELEMENT(PresaleTrackingNumber );
- SET_ELEMENT(CompositeTrackingNumber );
- SET_ELEMENT(InforceTrackingNumber );
- SET_ELEMENT(InforceCompositeTrackingNumber);
- SET_ELEMENT(InforceNonGuaranteedFootnote0 );
- SET_ELEMENT(InforceNonGuaranteedFootnote1 );
- SET_ELEMENT(InforceNonGuaranteedFootnote2 );
- SET_ELEMENT(InforceNonGuaranteedFootnote3 );
- SET_ELEMENT(NonGuaranteedFootnote );
- SET_ELEMENT(MonthlyChargesPaymentFootnote );
-
-# undef SET_ELEMENT
-
- // Instead of this:
-// document.save(a_Filename);
- // for the nonce, explicitly change the extension, in order to
- // force external product-file code to use the new extension.
- fs::path path(a_Filename, fs::native);
- path = fs::change_extension(path, ".policy");
- document.save(path.string());
+void product_data::redintegrate_ad_terminum()
+{
}
-//============================================================================
+/// Create a product file for the 'sample' product.
+///
+/// Only the most crucial members are explicitly initialized. For the
+/// rest, default (empty) strings are good enough.
+
void product_data::WritePolFiles()
{
- product_data foo;
+ product_data z;
- foo.CorridorFilename = "sample";
- foo.CurrCOIFilename = "qx_cso";
- foo.GuarCOIFilename = "qx_cso";
- foo.WPFilename = "sample";
- foo.ADDFilename = "qx_ins";
- foo.ChildRiderFilename = "qx_ins";
- foo.CurrSpouseRiderFilename = "qx_ins";
- foo.GuarSpouseRiderFilename = "qx_ins";
- foo.CurrTermFilename = "qx_cso";
- foo.GuarTermFilename = "qx_cso";
- foo.TableYFilename = "qx_ins";
- foo.PremTaxFilename = "sample";
- foo.TAMRA7PayFilename = "sample";
- foo.TgtPremFilename = "sample";
- foo.IRC7702Filename = "qx_cso";
- foo.Gam83Filename = "qx_ann";
- foo.SubstdTblMultFilename = "sample";
- foo.CurrSpecAmtLoadFilename = "sample";
- foo.GuarSpecAmtLoadFilename = "sample";
- foo.PolicyForm = "UL32768-NY";
- foo.PolicyMktgName = "UL Supreme";
- foo.PolicyLegalName = "Flexible Premium Adjustable Life Insurance Policy";
- foo.InsCoShortName = "Superior Life";
- foo.InsCoName = "Superior Life Insurance Company";
- foo.InsCoAddr = "Superior, WI 12345";
- foo.InsCoStreet = "246 Main Street";
- foo.InsCoPhone = "(800) 555-1212";
- foo.InsCoDomicile = "WI";
- foo.MainUnderwriter = "Superior Securities";
- foo.MainUnderwriterAddress = "246-M Main Street, Superior, WI
12345";
- foo.CoUnderwriter = "Superior Investors";
- foo.CoUnderwriterAddress = "246-C Main Street, Superior, WI
12345";
- foo.AvName = "Account";
- foo.CsvName = "Cash Surrender";
- foo.CsvHeaderName = "Cash Surr";
- foo.NoLapseProvisionName = "No-lapse Provision";
- foo.InterestDisclaimer = "";
- foo.GuarMortalityFootnote = "";
- foo.AccountValueFootnote = "";
- foo.AttainedAgeFootnote = "";
- foo.CashSurrValueFootnote = "";
- foo.DeathBenefitFootnote = "";
- foo.InitialPremiumFootnote = "";
- foo.NetPremiumFootnote = "";
- foo.OutlayFootnote = "";
- foo.PolicyYearFootnote = "";
- foo.ADDFootnote = "";
- foo.ChildFootnote = "";
- foo.SpouseFootnote = "";
- foo.TermFootnote = "";
- foo.WaiverFootnote = "";
- foo.MinimumPremiumFootnote = "";
- foo.PremAllocationFootnote = "";
- foo.ProductDescription = "";
- foo.StableValueFootnote = "";
- foo.NoVanishPremiumFootnote = "";
- foo.RejectPremiumFootnote = "";
- foo.ExpRatingFootnote = "";
- foo.MortalityBlendFootnote = "";
- foo.HypotheticalRatesFootnote = "";
- foo.SalesLoadRefundFootnote = "";
- foo.NoLapseFootnote = "";
- foo.MarketValueAdjFootnote = "";
- foo.ExchangeChargeFootnote0 = "";
- foo.CurrentValuesFootnote = "";
- foo.DBOption1Footnote = "";
- foo.DBOption2Footnote = "";
- foo.ExpRatRiskChargeFootnote = "";
- foo.ExchangeChargeFootnote1 = "";
- foo.FlexiblePremiumFootnote = "";
- foo.GuaranteedValuesFootnote = "";
- foo.CreditingRateFootnote = "";
- foo.MecFootnote = "";
- foo.MidpointValuesFootnote = "";
- foo.SinglePremiumFootnote = "";
- foo.MonthlyChargesFootnote = "";
- foo.UltCreditingRateFootnote = "";
- foo.MaxNaarFootnote = "";
- foo.PremTaxSurrChgFootnote = "";
- foo.PolicyFeeFootnote = "";
- foo.AssetChargeFootnote = "";
- foo.InvestmentIncomeFootnote = "";
- foo.IrrDbFootnote = "";
- foo.IrrCsvFootnote = "";
- foo.MortalityChargesFootnote = "";
- foo.LoanAndWithdrawalFootnote = "";
- foo.PresaleTrackingNumber = "";
- foo.CompositeTrackingNumber = "";
- foo.InforceTrackingNumber = "";
- foo.InforceCompositeTrackingNumber = "";
- foo.InforceNonGuaranteedFootnote0 = "";
- foo.InforceNonGuaranteedFootnote1 = "";
- foo.InforceNonGuaranteedFootnote2 = "";
- foo.InforceNonGuaranteedFootnote3 = "";
- foo.NonGuaranteedFootnote = "";
- foo.MonthlyChargesPaymentFootnote = "";
+ z.DatabaseFilename = "sample.db4";
+ z.FundFilename = "sample.fnd";
+ z.RoundingFilename = "sample.rnd";
+ z.TierFilename = "sample.tir";
- foo.DatabaseFilename = "sample.db4";
- foo.FundFilename = "sample.fnd";
- foo.RoundingFilename = "sample.rnd";
- foo.TierFilename = "sample.tir";
+ z.CorridorFilename = "sample";
+ z.CurrCOIFilename = "qx_cso";
+ z.GuarCOIFilename = "qx_cso";
+ z.WPFilename = "sample";
+ z.ADDFilename = "qx_ins";
+ z.ChildRiderFilename = "qx_ins";
+ z.CurrSpouseRiderFilename = "qx_ins";
+ z.GuarSpouseRiderFilename = "qx_ins";
+ z.CurrTermFilename = "qx_cso";
+ z.GuarTermFilename = "qx_cso";
+ z.TableYFilename = "qx_ins";
+ z.PremTaxFilename = "sample";
+ z.TAMRA7PayFilename = "sample";
+ z.TgtPremFilename = "sample";
+ z.IRC7702Filename = "qx_cso";
+ z.Gam83Filename = "qx_ann";
+ z.SubstdTblMultFilename = "sample";
+ z.CurrSpecAmtLoadFilename = "sample";
+ z.GuarSpecAmtLoadFilename = "sample";
+ z.PolicyForm = "UL32768-NY";
+ z.PolicyMktgName = "UL Supreme";
+ z.PolicyLegalName = "Flexible Premium Adjustable Life Insurance Policy";
+ z.InsCoShortName = "Superior Life";
+ z.InsCoName = "Superior Life Insurance Company";
+ z.InsCoAddr = "Superior, WI 12345";
+ z.InsCoStreet = "246 Main Street";
+ z.InsCoPhone = "(800) 555-1212";
+ z.InsCoDomicile = "WI";
+ z.MainUnderwriter = "Superior Securities";
+ z.MainUnderwriterAddress = "246-M Main Street, Superior, WI 12345";
+ z.CoUnderwriter = "Superior Investors";
+ z.CoUnderwriterAddress = "246-C Main Street, Superior, WI 12345";
+ z.AvName = "Account";
+ z.CsvName = "Cash Surrender";
+ z.CsvHeaderName = "Cash Surr";
+ z.NoLapseProvisionName = "No-lapse Provision";
- foo.Write(AddDataDir("sample.policy"));
+ z.Write(AddDataDir("sample.policy"));
}
Modified: lmi/trunk/product_data.hpp
===================================================================
--- lmi/trunk/product_data.hpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/product_data.hpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -1,4 +1,4 @@
-// Product data.
+// Product data representable as strings.
//
// Copyright (C) 1998, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
2010 Gregory W. Chicares.
//
@@ -26,135 +26,70 @@
#include "config.hpp"
+#include "any_member.hpp"
+#include "obstruct_slicing.hpp"
#include "so_attributes.hpp"
+#include "xml_serializable.hpp"
+#include <boost/utility.hpp>
+
#include <string>
-// Filenames and other free-form offline data that vary by product.
+/// Product data representable as strings, including filenames.
+///
+/// This is the "master" product file: it includes the filenames of
+/// all other product files.
+///
+/// Implicitly-declared special member functions do the right thing.
class LMI_SO product_data
+ : private boost::noncopyable
+ ,virtual public obstruct_slicing <product_data>
+ , public MemberSymbolTable <product_data>
+ , public xml_serializable <product_data>
{
friend class PolicyDocument;
- friend class PolicyView;
public:
- explicit product_data(std::string const& a_Filename);
+ explicit product_data(std::string const& filename);
~product_data();
+ // Legacy functions to support creating product files programmatically.
static void WritePolFiles();
static void WriteProprietaryPolFiles();
- std::string const& GetDatabaseFilename () const {return
DatabaseFilename; }
- std::string const& GetFundFilename () const {return
FundFilename; }
- std::string const& GetCorridorFilename () const {return
CorridorFilename; }
- std::string const& GetCurrCOIFilename () const {return
CurrCOIFilename; }
- std::string const& GetGuarCOIFilename () const {return
GuarCOIFilename; }
- std::string const& GetWPFilename () const {return WPFilename;
}
- std::string const& GetADDFilename () const {return ADDFilename;
}
- std::string const& GetChildRiderFilename () const {return
ChildRiderFilename; }
- std::string const& GetCurrSpouseRiderFilename() const {return
CurrSpouseRiderFilename;}
- std::string const& GetGuarSpouseRiderFilename() const {return
GuarSpouseRiderFilename;}
- std::string const& GetCurrTermFilename () const {return
CurrTermFilename; }
- std::string const& GetGuarTermFilename () const {return
GuarTermFilename; }
- std::string const& GetTableYFilename () const {return
TableYFilename; }
- std::string const& GetPremTaxFilename () const {return
PremTaxFilename; }
- std::string const& GetTAMRA7PayFilename () const {return
TAMRA7PayFilename; }
- std::string const& GetTgtPremFilename () const {return
TgtPremFilename; }
- std::string const& GetIRC7702Filename () const {return
IRC7702Filename; }
- std::string const& GetGam83Filename () const {return
Gam83Filename; }
- std::string const& GetSubstdTblMultFilename () const {return
SubstdTblMultFilename; }
- std::string const& GetCurrSpecAmtLoadFilename() const {return
CurrSpecAmtLoadFilename;}
- std::string const& GetGuarSpecAmtLoadFilename() const {return
GuarSpecAmtLoadFilename;}
- std::string const& GetRoundingFilename () const {return
RoundingFilename; }
- std::string const& GetTierFilename () const {return
TierFilename; }
-
- std::string const& GetPolicyForm () const {return
PolicyForm; }
- std::string const& GetPolicyMktgName () const {return
PolicyMktgName; }
- std::string const& GetPolicyLegalName () const {return
PolicyLegalName; }
- std::string const& GetInsCoShortName () const {return
InsCoShortName; }
- std::string const& GetInsCoName () const {return
InsCoName; }
- std::string const& GetInsCoAddr () const {return
InsCoAddr; }
- std::string const& GetInsCoStreet () const {return
InsCoStreet; }
- std::string const& GetInsCoPhone () const {return
InsCoPhone; }
- std::string const& GetInsCoDomicile () const {return
InsCoDomicile; }
- std::string const& GetMainUnderwriter () const {return
MainUnderwriter; }
- std::string const& GetMainUnderwriterAddress () const {return
MainUnderwriterAddress; }
- std::string const& GetCoUnderwriter () const {return
CoUnderwriter; }
- std::string const& GetCoUnderwriterAddress () const {return
CoUnderwriterAddress; }
- std::string const& GetAvName () const {return
AvName; }
- std::string const& GetCsvName () const {return
CsvName; }
- std::string const& GetCsvHeaderName () const {return
CsvHeaderName; }
- std::string const& GetNoLapseProvisionName () const {return
NoLapseProvisionName; }
- std::string const& GetInterestDisclaimer () const {return
InterestDisclaimer; }
- std::string const& GetGuarMortalityFootnote () const {return
GuarMortalityFootnote; }
- std::string const& GetAccountValueFootnote () const {return
AccountValueFootnote; }
- std::string const& GetAttainedAgeFootnote () const {return
AttainedAgeFootnote; }
- std::string const& GetCashSurrValueFootnote () const {return
CashSurrValueFootnote; }
- std::string const& GetDeathBenefitFootnote () const {return
DeathBenefitFootnote; }
- std::string const& GetInitialPremiumFootnote () const {return
InitialPremiumFootnote; }
- std::string const& GetNetPremiumFootnote () const {return
NetPremiumFootnote; }
- std::string const& GetOutlayFootnote () const {return
OutlayFootnote; }
- std::string const& GetPolicyYearFootnote () const {return
PolicyYearFootnote; }
- std::string const& GetADDFootnote () const {return
ADDFootnote; }
- std::string const& GetChildFootnote () const {return
ChildFootnote; }
- std::string const& GetSpouseFootnote () const {return
SpouseFootnote; }
- std::string const& GetTermFootnote () const {return
TermFootnote; }
- std::string const& GetWaiverFootnote () const {return
WaiverFootnote; }
- std::string const& GetMinimumPremiumFootnote () const {return
MinimumPremiumFootnote; }
- std::string const& GetPremAllocationFootnote () const {return
PremAllocationFootnote; }
- std::string const& GetProductDescription () const {return
ProductDescription; }
- std::string const& GetStableValueFootnote () const {return
StableValueFootnote; }
- std::string const& GetNoVanishPremiumFootnote () const {return
NoVanishPremiumFootnote; }
- std::string const& GetRejectPremiumFootnote () const {return
RejectPremiumFootnote; }
- std::string const& GetExpRatingFootnote () const {return
ExpRatingFootnote; }
- std::string const& GetMortalityBlendFootnote () const {return
MortalityBlendFootnote; }
- std::string const& GetHypotheticalRatesFootnote () const {return
HypotheticalRatesFootnote; }
- std::string const& GetSalesLoadRefundFootnote () const {return
SalesLoadRefundFootnote; }
- std::string const& GetNoLapseFootnote () const {return
NoLapseFootnote; }
- std::string const& GetMarketValueAdjFootnote () const {return
MarketValueAdjFootnote; }
- std::string const& GetExchangeChargeFootnote0 () const {return
ExchangeChargeFootnote0; }
- std::string const& GetCurrentValuesFootnote () const {return
CurrentValuesFootnote; }
- std::string const& GetDBOption1Footnote () const {return
DBOption1Footnote; }
- std::string const& GetDBOption2Footnote () const {return
DBOption2Footnote; }
- std::string const& GetExpRatRiskChargeFootnote () const {return
ExpRatRiskChargeFootnote; }
- std::string const& GetExchangeChargeFootnote1 () const {return
ExchangeChargeFootnote1; }
- std::string const& GetFlexiblePremiumFootnote () const {return
FlexiblePremiumFootnote; }
- std::string const& GetGuaranteedValuesFootnote () const {return
GuaranteedValuesFootnote; }
- std::string const& GetCreditingRateFootnote () const {return
CreditingRateFootnote; }
- std::string const& GetMecFootnote () const {return
MecFootnote; }
- std::string const& GetMidpointValuesFootnote () const {return
MidpointValuesFootnote; }
- std::string const& GetSinglePremiumFootnote () const {return
SinglePremiumFootnote; }
- std::string const& GetMonthlyChargesFootnote () const {return
MonthlyChargesFootnote; }
- std::string const& GetUltCreditingRateFootnote () const {return
UltCreditingRateFootnote; }
- std::string const& GetMaxNaarFootnote () const {return
MaxNaarFootnote; }
- std::string const& GetPremTaxSurrChgFootnote () const {return
PremTaxSurrChgFootnote; }
- std::string const& GetPolicyFeeFootnote () const {return
PolicyFeeFootnote; }
- std::string const& GetAssetChargeFootnote () const {return
AssetChargeFootnote; }
- std::string const& GetInvestmentIncomeFootnote () const {return
InvestmentIncomeFootnote; }
- std::string const& GetIrrDbFootnote () const {return
IrrDbFootnote; }
- std::string const& GetIrrCsvFootnote () const {return
IrrCsvFootnote; }
- std::string const& GetMortalityChargesFootnote () const {return
MortalityChargesFootnote; }
- std::string const& GetLoanAndWithdrawalFootnote () const {return
LoanAndWithdrawalFootnote; }
- std::string const& GetPresaleTrackingNumber () const {return
PresaleTrackingNumber; }
- std::string const& GetCompositeTrackingNumber () const {return
CompositeTrackingNumber; }
- std::string const& GetInforceTrackingNumber () const {return
InforceTrackingNumber; }
- std::string const& GetInforceCompositeTrackingNumber() const {return
InforceCompositeTrackingNumber;}
- std::string const& GetInforceNonGuaranteedFootnote0 () const {return
InforceNonGuaranteedFootnote0 ;}
- std::string const& GetInforceNonGuaranteedFootnote1 () const {return
InforceNonGuaranteedFootnote1 ;}
- std::string const& GetInforceNonGuaranteedFootnote2 () const {return
InforceNonGuaranteedFootnote2 ;}
- std::string const& GetInforceNonGuaranteedFootnote3 () const {return
InforceNonGuaranteedFootnote3 ;}
- std::string const& GetNonGuaranteedFootnote () const {return
NonGuaranteedFootnote ;}
- std::string const& GetMonthlyChargesPaymentFootnote () const {return
MonthlyChargesPaymentFootnote ;}
-
private:
product_data();
- void Init(std::string const& a_Filename);
- void Read(std::string const& a_Filename);
- void Write(std::string const& a_Filename) const;
+ void ascribe_members();
+ // Deprecated functions slated for elimination.
+ void Read(std::string const& filename);
+ void Write(std::string const& filename) const;
+
+ // xml_serializable required implementation.
+ virtual int class_version() const;
+ virtual std::string xml_root_name() const;
+ virtual bool is_detritus(std::string const&) const;
+ virtual std::string redintegrate_ex_ante
+ (int file_version
+ ,std::string const& name
+ ,std::string const& value
+ ) const;
+ virtual void redintegrate_ex_post
+ (int file_version
+ ,std::map<std::string, std::string> detritus_map
+ ,std::list<std::string> residuary_names
+ );
+ virtual void redintegrate_ad_terminum();
+
+ // Names of files that contain other product data.
std::string DatabaseFilename;
std::string FundFilename;
+ std::string RoundingFilename;
+ std::string TierFilename;
+
+ // Names of rate-table files.
std::string CorridorFilename;
std::string CurrCOIFilename;
std::string GuarCOIFilename;
@@ -174,9 +109,8 @@
std::string SubstdTblMultFilename;
std::string CurrSpecAmtLoadFilename;
std::string GuarSpecAmtLoadFilename;
- std::string RoundingFilename;
- std::string TierFilename;
+ // Essential strings describing the policy and company.
std::string PolicyForm;
std::string PolicyMktgName;
std::string PolicyLegalName;
@@ -191,16 +125,16 @@
std::string CoUnderwriter;
std::string CoUnderwriterAddress;
- // Illustration reg requires column headers to use names in
- // contract, e.g. for account and surrender values.
+ // Terms defined in the contract, which must be used for column
+ // headers according to the illustration reg.
std::string AvName;
std::string CsvName;
std::string CsvHeaderName;
std::string NoLapseProvisionName;
- std::string InterestDisclaimer;
- std::string GuarMortalityFootnote;
- // Ledger column definitions.
+ // Most of the following are missing from the GUI.
+
+ // Footnotes that describe various ledger columns.
std::string AccountValueFootnote;
std::string AttainedAgeFootnote;
std::string CashSurrValueFootnote;
@@ -221,6 +155,9 @@
std::string MinimumPremiumFootnote;
std::string PremAllocationFootnote;
+ // Miscellaneous other footnotes.
+ std::string InterestDisclaimer;
+ std::string GuarMortalityFootnote;
std::string ProductDescription;
std::string StableValueFootnote;
std::string NoVanishPremiumFootnote;
Modified: lmi/trunk/product_file_test.cpp
===================================================================
--- lmi/trunk/product_file_test.cpp 2010-04-02 01:54:18 UTC (rev 4824)
+++ lmi/trunk/product_file_test.cpp 2010-04-02 11:23:35 UTC (rev 4825)
@@ -80,10 +80,10 @@
policy_filename_ = "sample";
product_data p(policy_filename_);
- database_filename_ = p.GetDatabaseFilename ();
- fund_filename_ = p.GetFundFilename ();
- rounding_filename_ = p.GetRoundingFilename ();
- stratified_filename_ = p.GetTierFilename ();
+ database_filename_ = p["DatabaseFilename"].str();
+ fund_filename_ = p["FundFilename" ].str();
+ rounding_filename_ = p["RoundingFilename"].str();
+ stratified_filename_ = p["TierFilename" ].str();
}
void product_file_test::read_database_file()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lmi-commits] [4825] Reimplement class product_data,
Greg Chicares <=