lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master daa9e9c 1/3: Make IRR precision a private dat


From: Greg Chicares
Subject: [lmi-commits] [lmi] master daa9e9c 1/3: Make IRR precision a private data member
Date: Fri, 16 Feb 2018 17:39:03 -0500 (EST)

branch: master
commit daa9e9c043c072d93e75f10d85f0cdc8796e4c04
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Make IRR precision a private data member
    
    Renamed it with a '_' suffix for global concinnity.
---
 ledger_invariant.cpp | 27 +++++++++++++--------------
 ledger_invariant.hpp |  2 +-
 2 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 2d40216..d8c75cb 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -389,8 +389,6 @@ void LedgerInvariant::Copy(LedgerInvariant const& obj)
 {
     LedgerBase::Copy(obj);
 
-    irr_precision          = obj.irr_precision         ;
-
     // Vectors of type not compatible with double.
     EeMode                 = obj.EeMode                ;
     ErMode                 = obj.ErMode                ;
@@ -411,6 +409,8 @@ void LedgerInvariant::Copy(LedgerInvariant const& obj)
     InitErMode             = obj.InitErMode            ;
     InitDBOpt              = obj.InitDBOpt             ;
 
+    // Private internals.
+    irr_precision_         = obj.irr_precision_        ;
     FullyInitialized       = obj.FullyInitialized      ;
 }
 
@@ -426,8 +426,6 @@ void LedgerInvariant::Init()
     // Zero-initialize elements of AllVectors and AllScalars.
     LedgerBase::Initialize(GetLength());
 
-    irr_precision       = 0;
-
     EeMode              .assign(Length, mce_mode(mce_annual));
     ErMode              .assign(Length, mce_mode(mce_annual));
     DBOpt               .assign(Length, mce_dbopt(mce_option1));
@@ -447,6 +445,7 @@ void LedgerInvariant::Init()
 
     SupplementalReport  = false;
 
+    irr_precision_      = 0;
     FullyInitialized    = false;
 }
 
@@ -456,7 +455,7 @@ void LedgerInvariant::Init(BasicValues const* b)
     // Zero-initialize almost everything.
     Init();
 
-    irr_precision = b->round_irr().decimals();
+    irr_precision_ = b->round_irr().decimals();
 
 // TODO ?? These names are confusing. EePmt and ErPmt are *input* values.
 // If they're entered as $1000 for all years, then they have that value
@@ -945,7 +944,7 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant 
const& a_Addend)
 {
     LedgerBase::PlusEq(a_Addend, a_Addend.InforceLives);
 
-    irr_precision = a_Addend.irr_precision;
+    irr_precision_ = a_Addend.irr_precision_;
 
     std::vector<double> const& N = a_Addend.InforceLives;
     int Max = std::min(Length, a_Addend.Length);
@@ -1271,7 +1270,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrCsvGuarInput
         ,static_cast<unsigned int>(Guar_.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     irr
@@ -1280,7 +1279,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrDbGuarInput
         ,static_cast<unsigned int>(Guar_.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     irr
@@ -1289,7 +1288,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrCsvCurrInput
         ,static_cast<unsigned int>(Curr_.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     irr
@@ -1298,7 +1297,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrDbCurrInput
         ,static_cast<unsigned int>(Curr_.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     // Calculate these IRRs only for ledger types that actually use a
@@ -1329,7 +1328,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrCsvGuar0
         ,static_cast<unsigned int>(Guar0.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     irr
@@ -1338,7 +1337,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrDbGuar0
         ,static_cast<unsigned int>(Guar0.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     irr
@@ -1347,7 +1346,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrCsvCurr0
         ,static_cast<unsigned int>(Curr0.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 
     irr
@@ -1356,7 +1355,7 @@ void LedgerInvariant::CalculateIrrs(Ledger const& 
LedgerValues)
         ,IrrDbCurr0
         ,static_cast<unsigned int>(Curr0.LapseYear)
         ,max_length
-        ,irr_precision
+        ,irr_precision_
         );
 }
 
diff --git a/ledger_invariant.hpp b/ledger_invariant.hpp
index bf7f26e..c2f4d38 100644
--- a/ledger_invariant.hpp
+++ b/ledger_invariant.hpp
@@ -64,7 +64,6 @@ class LMI_SO LedgerInvariant
     //   columns would need to be stored.
     // No: its purpose is to push IRR calculations into formatting
     //   routines, which ought not to do any serious calculations.
-    int irr_precision;
     void CalculateIrrs(Ledger const&);
 
     void UpdateCRC(CRC& a_crc) const override;
@@ -414,6 +413,7 @@ class LMI_SO LedgerInvariant
 
     // Special cases.
     int             Length;
+    int             irr_precision_;
     bool            FullyInitialized;   // I.e. by Init(BasicValues const* b).
 };
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]