[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master f474d10 08/10: Prepare to abstract specified
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master f474d10 08/10: Prepare to abstract specified amount |
Date: |
Fri, 4 Sep 2020 21:16:10 -0400 (EDT) |
branch: master
commit f474d10ca26e727c53d71244f76deb69dde54806
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Prepare to abstract specified amount
At least three sets of variables store specified amount:
death_benefits::specamt_ and death_benefits::supplamt_
AccountValue::ActualSpecAmt and AccountValue::TermSpecAmt
LedgerInvariant::SpecAmt and LedgerInvariant::TermSpecAmt
Those in the ledger class are problematic because they should be
treated as write-only output, but are often used for temporary storage
of evanescent values. Furthermore, ledger data members are generally of
type 'double', and it is most convenient for them all to share the same
data type, but a currency type is preferable for actual calculations.
Therefore, established accessors for these ledger variables, to make it
easier in forthcoming commits to refactor code that uses them for
temporary storage.
---
account_value.hpp | 5 +++++
accountvalue.cpp | 7 +++++++
ihs_acctval.cpp | 34 ++++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+)
diff --git a/account_value.hpp b/account_value.hpp
index fb24786..f3705f2 100644
--- a/account_value.hpp
+++ b/account_value.hpp
@@ -115,6 +115,11 @@ class LMI_SO AccountValue final
double TotalAccountValue() const;
double CashValueFor7702() const;
+ double base_specamt(int year) const;
+ double term_specamt(int year) const;
+ double specamt_for_7702(int year) const;
+ double specamt_for_7702A(int year) const;
+
// We're not yet entirely sure how to handle ledger values. Right now,
// we have pointers to a Ledger and also to its variant and invariant
// parts. We put data into the parts, and then insert the parts into
diff --git a/accountvalue.cpp b/accountvalue.cpp
index 43f6873..ac64f53 100644
--- a/accountvalue.cpp
+++ b/accountvalue.cpp
@@ -124,6 +124,13 @@ AccountValue::AccountValue(Input const& input)
NetPmts .resize(12);
}
+/// Specified amount.
+
+double AccountValue::base_specamt(int year) const
+{
+ return InvariantValues().SpecAmt[year];
+}
+
//============================================================================
std::shared_ptr<Ledger const> AccountValue::ledger_from_av() const
{
diff --git a/ihs_acctval.cpp b/ihs_acctval.cpp
index aeef35d..7c71d51 100644
--- a/ihs_acctval.cpp
+++ b/ihs_acctval.cpp
@@ -138,6 +138,40 @@ AccountValue::AccountValue(Input const& input)
withdrawal_ullage_ .reserve(BasicValues::GetLength());
}
+/// Specified amount (disregarding any term or "supplemental" amount).
+
+double AccountValue::base_specamt(int year) const
+{
+ return InvariantValues().SpecAmt[year];
+}
+
+/// Specified amount of term rider.
+
+double AccountValue::term_specamt(int year) const
+{
+ return InvariantValues().TermSpecAmt[year];
+}
+
+/// Specified amount for 7702 (not 7702A).
+
+double AccountValue::specamt_for_7702(int year) const
+{
+ return
+ InvariantValues().SpecAmt [year]
+ + (TermIsDbFor7702 ? InvariantValues().TermSpecAmt[year] : 0.0)
+ ;
+}
+
+/// Specified amount for 7702A (not 7702).
+
+double AccountValue::specamt_for_7702A(int year) const
+{
+ return
+ InvariantValues().SpecAmt [year]
+ + (TermIsDbFor7702A ? InvariantValues().TermSpecAmt[year] : 0.0)
+ ;
+}
+
//============================================================================
std::shared_ptr<Ledger const> AccountValue::ledger_from_av() const
{
- [lmi-commits] [lmi] master updated (520bb97 -> c4f84b4), Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master f2e2cd7 01/10: Refactor to do less work, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master 9878b92 02/10: Refactor, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master 8fa4ca4 03/10: Reformat and append to commentary, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master 4f10238 05/10: Rename a local variable, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master 42f390d 06/10: Improve documentation, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master e8c4054 04/10: Localize a data member, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master e360e0d 07/10: Add some commentary on a marked defect, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master 6a54fd9 09/10: Never read 7702 or 7702A specamt directly from LedgerInvariant, Greg Chicares, 2020/09/04
- [lmi-commits] [lmi] master f474d10 08/10: Prepare to abstract specified amount,
Greg Chicares <=
- [lmi-commits] [lmi] master c4f84b4 10/10: Never read specamt directly from LedgerInvariant, Greg Chicares, 2020/09/04