lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 359c74c 09/16: Treat 'InitErMode' the same as


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 359c74c 09/16: Treat 'InitErMode' the same as any other ledger string
Date: Sat, 11 Apr 2020 20:36:03 -0400 (EDT)

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

    Treat 'InitErMode' the same as any other ledger string
    
    'InitErMode' and 'InitDBOpt' are "special" in the same sense: they're
    strings representing initial values of enumerative vectors. They're
    arguably redundant, because they simply store the string corresponding
    to the first element of their respective enumerative vectors. However,
    they had heretofore been treated differently: 'InitDBOpt' was part of
    the 'Strings' map, whose elements are handled in the base class's Copy()
    and PlusEq() functions, but 'InitErMode' was not; now it is.
    
    This affects '.test' output, which now includes 'InitErMode'.
    
    Some other strings are "special" and redundant in a different way: they
    represent formatted dates corresponding to JDN members. Those strings
    are excluded from 'Strings', because date formatting depends on OS
    settings, and regression tests wouldn't match between machines with
    different settings if they were included in '.test' output.
---
 ledger_invariant.cpp | 10 +---------
 ledger_invariant.hpp | 16 ++++++++--------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/ledger_invariant.cpp b/ledger_invariant.cpp
index 4de989c..963eed8 100644
--- a/ledger_invariant.cpp
+++ b/ledger_invariant.cpp
@@ -381,8 +381,7 @@ void LedgerInvariant::Alloc(int len)
     Strings["SupplementalReportColumn10"    ] = &SupplementalReportColumn10    
;
     Strings["SupplementalReportColumn11"    ] = &SupplementalReportColumn11    
;
 
-    // Special-case strings.
-
+    Strings["InitErMode"                    ] = &InitErMode                    
;
     Strings["InitDBOpt"                     ] = &InitDBOpt                     
;
 
     LedgerBase::Alloc();
@@ -437,8 +436,6 @@ void LedgerInvariant::Copy(LedgerInvariant const& obj)
     LastCoiReentryDate     = obj.LastCoiReentryDate    ;
     ListBillDate           = obj.ListBillDate          ;
     InforceAsOfDate        = obj.InforceAsOfDate       ;
-    InitErMode             = obj.InitErMode            ;
-    InitDBOpt              = obj.InitDBOpt             ;
 
     // Private internals.
     irr_precision_         = obj.irr_precision_        ;
@@ -662,11 +659,6 @@ LedgerInvariant& LedgerInvariant::PlusEq(LedgerInvariant 
const& a_Addend)
     ListBillDate                  = a_Addend.ListBillDate;
     InforceAsOfDate               = a_Addend.InforceAsOfDate;
 
-    // Special-case enumerative data.
-
-    InitErMode                    = a_Addend.InitErMode;
-    InitDBOpt                     = a_Addend.InitDBOpt;
-
     return *this;
 }
 
diff --git a/ledger_invariant.hpp b/ledger_invariant.hpp
index 7d39631..7187276 100644
--- a/ledger_invariant.hpp
+++ b/ledger_invariant.hpp
@@ -428,6 +428,14 @@ class LMI_SO LedgerInvariant final
     std::string SupplementalReportColumn10;
     std::string SupplementalReportColumn11;
 
+    // Arguably enumerative members such as 'ErMode' should be of type
+    // std::string instead, because strings would be more useful for
+    // generating reports from this class's data, and mc_enum::str()
+    // is not visible across a shared-library boundary. For now, this
+    // kludge solves an immediate problem for premium quotes.
+    std::string     InitErMode;
+    std::string     InitDBOpt;
+
     // Special-case strings.
 
     // Calendar dates are special because date formatting might be
@@ -440,14 +448,6 @@ class LMI_SO LedgerInvariant final
     std::string     ListBillDate;
     std::string     InforceAsOfDate;
 
-    // Arguably enumerative members such as 'ErMode' should be of type
-    // std::string instead, because strings would be more useful for
-    // generating reports from this class's data, and mc_enum::str()
-    // is not visible across a shared-library boundary. For now, this
-    // kludge solves an immediate problem for premium quotes.
-    std::string     InitErMode;
-    std::string     InitDBOpt;
-
   private:
     void Alloc(int len);
     void Copy(LedgerInvariant const&);



reply via email to

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