lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master d89a676 22/24: Refactor to avoid a header-onl


From: Greg Chicares
Subject: [lmi-commits] [lmi] master d89a676 22/24: Refactor to avoid a header-only implementation
Date: Wed, 30 Dec 2020 18:47:02 -0500 (EST)

branch: master
commit d89a6769c95ee2bc6767c0287671ef6ec1c5d71f
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Refactor to avoid a header-only implementation
    
    Soon the 7702 interest rate will depend on external considerations,
    embodied in a set of TUs that may change during development. A
    header-only implementation would induce ongoing changes to the
    physical design, which are better avoided.
    
    * antediluvian_stubs.cpp: All further changes will be postdiluvian.
    
    It may seem curious that class Irc7702A and its unit test don't depend
    on iglp(). The reason is that a table-driven 7702A implementation does
    not need to know the interest or mortality rates implicit in the tables
    it uses, so this seeming anomaly actually represents an appropriate
    separation of concerns.
---
 Makefile.am                                  |  3 +++
 antediluvian_stubs.cpp                       | 10 ++++++++++
 irc7702_interest.hpp => irc7702_interest.cpp | 13 ++++---------
 irc7702_interest.hpp                         | 15 ++-------------
 objects.make                                 |  3 +++
 5 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9180408..bc8185c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -424,6 +424,7 @@ liblmi_la_SOURCES = \
     ihs_irc7702a.cpp \
     ihs_mortal.cpp \
     ihs_server7702.cpp \
+    irc7702_interest.cpp \
     irc7702_tables.cpp \
     lingo.cpp \
     lmi.cpp \
@@ -777,6 +778,7 @@ test_gpt_SOURCES = \
   gpt_commutation_functions.cpp \
   gpt_test.cpp \
   ihs_irc7702.cpp \
+  irc7702_interest.cpp \
   miscellany.cpp \
   null_stream.cpp \
   path_utility.cpp \
@@ -866,6 +868,7 @@ test_irc7702_tables_SOURCES = \
   $(common_test_objects) \
   commutation_functions.cpp \
   cso_table.cpp \
+  irc7702_interest.cpp \
   irc7702_tables.cpp \
   irc7702_tables_test.cpp
 test_irc7702_tables_CXXFLAGS = $(AM_CXXFLAGS)
diff --git a/antediluvian_stubs.cpp b/antediluvian_stubs.cpp
index 236d0c1..cfb5eaa 100644
--- a/antediluvian_stubs.cpp
+++ b/antediluvian_stubs.cpp
@@ -42,6 +42,16 @@ namespace
 void authenticate_system()
 {}
 
+double iglp()
+{
+    return 0.04;
+}
+
+double igsp()
+{
+    return 0.02 + iglp();
+}
+
 bool is_antediluvian_fork()
 {
     return true;
diff --git a/irc7702_interest.hpp b/irc7702_interest.cpp
similarity index 84%
copy from irc7702_interest.hpp
copy to irc7702_interest.cpp
index 547b4da..7b00d25 100644
--- a/irc7702_interest.hpp
+++ b/irc7702_interest.cpp
@@ -19,25 +19,20 @@
 // email: <gchicares@sbcglobal.net>
 // snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
 
-#ifndef irc7702_interest_hpp
-#define irc7702_interest_hpp
+#include "pchfile.hpp"
 
-#include "config.hpp"
-
-#include "so_attributes.hpp"
+#include "irc7702_interest.hpp"
 
 /// Statutory interest rate for 7702 and 7702A (except GSP).
 
-LMI_SO inline double iglp()
+double iglp()
 {
     return 0.04;
 }
 
 /// Statutory interest rate for 7702 (GSP only).
 
-LMI_SO inline double igsp()
+double igsp()
 {
     return 0.02 + iglp();
 }
-
-#endif // irc7702_interest_hpp
diff --git a/irc7702_interest.hpp b/irc7702_interest.hpp
index 547b4da..cd68ebf 100644
--- a/irc7702_interest.hpp
+++ b/irc7702_interest.hpp
@@ -26,18 +26,7 @@
 
 #include "so_attributes.hpp"
 
-/// Statutory interest rate for 7702 and 7702A (except GSP).
-
-LMI_SO inline double iglp()
-{
-    return 0.04;
-}
-
-/// Statutory interest rate for 7702 (GSP only).
-
-LMI_SO inline double igsp()
-{
-    return 0.02 + iglp();
-}
+LMI_SO double iglp();
+LMI_SO double igsp();
 
 #endif // irc7702_interest_hpp
diff --git a/objects.make b/objects.make
index 800c698..9c422de 100644
--- a/objects.make
+++ b/objects.make
@@ -291,6 +291,7 @@ lmi_common_objects := \
   ihs_irc7702a.o \
   ihs_mortal.o \
   ihs_server7702.o \
+  irc7702_interest.o \
   irc7702_tables.o \
   lingo.o \
   lmi.o \
@@ -666,6 +667,7 @@ gpt_test$(EXEEXT): \
   gpt_commutation_functions.o \
   gpt_test.o \
   ihs_irc7702.o \
+  irc7702_interest.o \
   miscellany.o \
   null_stream.o \
   path_utility.o \
@@ -744,6 +746,7 @@ irc7702_tables_test$(EXEEXT): \
   $(common_test_objects) \
   commutation_functions.o \
   cso_table.o \
+  irc7702_interest.o \
   irc7702_tables.o \
   irc7702_tables_test.o \
 



reply via email to

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