[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] valyuta/004 288c26f 8/9: Refactor to avoid a header-
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] valyuta/004 288c26f 8/9: Refactor to avoid a header-only implementation |
Date: |
Tue, 29 Dec 2020 14:46:03 -0500 (EST) |
branch: valyuta/004
commit 288c26f1758cfe06b81fce73e81ead18b94edd3c
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 9877ec0..1391bca 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 b15968c..32828d1 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 f32f551..ada9a6c 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 f32f551..e125375 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 f896566..eb2f731 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 \
- [lmi-commits] [lmi] valyuta/004 updated (cf62b44 -> 506051a), Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 260857d 2/9: Read product data files earlier, Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 296ee07 5/9: Set 7702 and 7702A interest rates OAOO, Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 288c26f 8/9: Refactor to avoid a header-only implementation,
Greg Chicares <=
- [lmi-commits] [lmi] valyuta/004 4a1687e 1/9: Expunge a defect marker [324], Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 50ed405 3/9: Prefer explicit to implicit currency rounding, Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 9e6c7e1 4/9: Abjure converting currency ctors, Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 806f2fd 6/9: fixup, Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 87f1e13 7/9: Split a unit-test TU in twain, Greg Chicares, 2020/12/29
- [lmi-commits] [lmi] valyuta/004 506051a 9/9: Conditionally use H.R. 6800's 7702 transitional rates, Greg Chicares, 2020/12/29