lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 78657d01 6/9: Improve physical structure


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 78657d01 6/9: Improve physical structure
Date: Fri, 6 May 2022 19:37:36 -0400 (EDT)

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

    Improve physical structure
    
    UL (universal life) utilities are likely to use many classes, so
    placing them in their own TU improves physical design. There's only
    one such utility at this moment, and zero unit tests, but further
    changes are planned.
---
 Makefile.am                       | 15 +++++++++++----
 financial.hpp                     | 12 ------------
 ihs_basicval.cpp                  |  3 ++-
 objects.make                      | 13 +++++++++----
 financial.cpp => ul_utilities.cpp |  4 ++--
 ul_utilities.hpp                  | 40 +++++++++++++++++++++++++++++++++++++++
 ul_utilities_test.cpp             | 31 ++++++++++++++++++++++++++++++
 7 files changed, 95 insertions(+), 23 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 02a82878..3f512af9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -166,6 +166,7 @@ TESTS = \
     test_tools_test \
     timer_test \
     tn_range_test \
+    ul_utilities_test \
     value_cast_test \
     vector_test \
     wx_new_test \
@@ -424,7 +425,6 @@ liblmi_la_SOURCES = \
     basic_tables.cpp \
     commutation_functions.cpp \
     cso_table.cpp \
-    financial.cpp \
     fund_data.cpp \
     gpt7702.cpp \
     gpt_commutation_functions.cpp \
@@ -461,6 +461,7 @@ liblmi_la_SOURCES = \
     rounding_rules.cpp \
     stratified_algorithms.cpp \
     stratified_charges.cpp \
+    ul_utilities.cpp \
     verify_products.cpp \
     $(liblmi_common_sources)
 liblmi_la_CXXFLAGS = $(AM_CXXFLAGS) $(XMLWRAPP_CFLAGS)
@@ -719,9 +720,7 @@ file_command_test_LDADD = \
   libtest_common.la
 
 financial_test_SOURCES = \
-  financial.cpp \
-  financial_test.cpp \
-  stratified_algorithms.cpp
+  financial_test.cpp
 financial_test_CXXFLAGS = $(AM_CXXFLAGS)
 financial_test_LDADD = \
   libtest_common.la
@@ -1070,6 +1069,13 @@ tn_range_test_CXXFLAGS = $(AM_CXXFLAGS)
 tn_range_test_LDADD = \
   libtest_common.la
 
+ul_utilities_test_SOURCES = \
+  ul_utilities.cpp \
+  ul_utilities_test.cpp
+ul_utilities_test_CXXFLAGS = $(AM_CXXFLAGS)
+ul_utilities_test_LDADD = \
+  libtest_common.la
+
 value_cast_test_LDADD = \
   libtest_common.la
 
@@ -1294,6 +1300,7 @@ noinst_HEADERS = \
     tn_range_type_trammels.hpp \
     tn_range_types.hpp \
     transferor.hpp \
+    ul_utilities.hpp \
     unwind.hpp \
     value_cast.hpp \
     verify_products.hpp \
diff --git a/financial.hpp b/financial.hpp
index 7eba93bb..be653202 100644
--- a/financial.hpp
+++ b/financial.hpp
@@ -26,15 +26,12 @@
 
 #include "assert_lmi.hpp"
 #include "bourn_cast.hpp"
-#include "mc_enum_type_enums.hpp"       // mcenum_mode
 #include "miscellany.hpp"               // ios_out_app_binary()
 #include "zero.hpp"                     // decimal_root()
 
 #include <fstream>
 #include <iterator>                     // iterator_traits
 
-class calendar_date;
-
 /// Future value.
 ///
 /// For values of 'i' close to zero, accuracy is limited because
@@ -244,13 +241,4 @@ void irr
         );
 }
 
-double list_bill_premium
-    (double               prem_ante
-    ,double               prem_post
-    ,mcenum_mode          mode
-    ,calendar_date const& cert_date
-    ,calendar_date const& bill_date
-    ,double               v12
-    );
-
 #endif // financial_hpp
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index bbb113eb..757828c7 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -31,7 +31,7 @@
 #include "data_directory.hpp"           // AddDataDir()
 #include "death_benefits.hpp"
 #include "et_vector.hpp"
-#include "financial.hpp"                // list_bill_premium()
+#include "financial.hpp"                // coi_rate_from_q(), 
i_upper_12_over_12_from_i()
 #include "fund_data.hpp"
 #include "global_settings.hpp"
 #include "gpt7702.hpp"
@@ -52,6 +52,7 @@
 #include "rounding_rules.hpp"
 #include "stl_extensions.hpp"           // nonstd::power()
 #include "stratified_charges.hpp"
+#include "ul_utilities.hpp"             // list_bill_premium()
 
 #include <algorithm>                    // min()
 #include <cfenv>                        // fesetround()
diff --git a/objects.make b/objects.make
index 8a31fb0d..85d38976 100644
--- a/objects.make
+++ b/objects.make
@@ -228,7 +228,6 @@ lmi_common_objects := \
   basic_tables.o \
   commutation_functions.o \
   cso_table.o \
-  financial.o \
   fund_data.o \
   gpt7702.o \
   gpt_commutation_functions.o \
@@ -265,6 +264,7 @@ lmi_common_objects := \
   rounding_rules.o \
   stratified_algorithms.o \
   stratified_charges.o \
+  ul_utilities.o \
   verify_products.o \
 
 skeleton_objects := \
@@ -428,6 +428,7 @@ unit_test_targets := \
   test_tools_test \
   timer_test \
   tn_range_test \
+  ul_utilities_test \
   value_cast_test \
   vector_test \
   wx_new_test \
@@ -604,11 +605,8 @@ file_command_test$(EXEEXT): \
 
 financial_test$(EXEEXT): \
   $(common_test_objects) \
-  calendar_date.o \
-  financial.o \
   financial_test.o \
   null_stream.o \
-  stratified_algorithms.o \
   timer.o \
 
 getopt_test$(EXEEXT): \
@@ -1029,6 +1027,13 @@ tn_range_test$(EXEEXT): \
   tn_range_test.o \
   tn_range_test_aux.o \
 
+ul_utilities_test$(EXEEXT): \
+  $(common_test_objects) \
+  calendar_date.o \
+  null_stream.o \
+  ul_utilities.o \
+  ul_utilities_test.o \
+
 value_cast_test$(EXEEXT): \
   $(common_test_objects) \
   calendar_date.o \
diff --git a/financial.cpp b/ul_utilities.cpp
similarity index 98%
rename from financial.cpp
rename to ul_utilities.cpp
index 9541d5d3..17f2fa0b 100644
--- a/financial.cpp
+++ b/ul_utilities.cpp
@@ -1,4 +1,4 @@
-// Financial functions.
+// UL utilities.
 //
 // Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022 Gregory W. Chicares.
 //
@@ -21,7 +21,7 @@
 
 #include "pchfile.hpp"
 
-#include "financial.hpp"
+#include "ul_utilities.hpp"
 
 #include "calendar_date.hpp"
 
diff --git a/ul_utilities.hpp b/ul_utilities.hpp
new file mode 100644
index 00000000..25760b71
--- /dev/null
+++ b/ul_utilities.hpp
@@ -0,0 +1,40 @@
+// UL utilities.
+//
+// Copyright (C) 2017, 2018, 2019, 2020, 2021, 2022 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// https://savannah.nongnu.org/projects/lmi
+// email: <gchicares@sbcglobal.net>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#ifndef ul_utilities_hpp
+#define ul_utilities_hpp
+
+#include "config.hpp"
+
+#include "mc_enum_type_enums.hpp"       // mcenum_mode
+
+class calendar_date;
+
+double list_bill_premium
+    (double               prem_ante
+    ,double               prem_post
+    ,mcenum_mode          mode
+    ,calendar_date const& cert_date
+    ,calendar_date const& bill_date
+    ,double               v12
+    );
+
+#endif // ul_utilities_hpp
diff --git a/ul_utilities_test.cpp b/ul_utilities_test.cpp
new file mode 100644
index 00000000..2a094983
--- /dev/null
+++ b/ul_utilities_test.cpp
@@ -0,0 +1,31 @@
+// UL utilities--unit test.
+//
+// Copyright (C) 2022 Gregory W. Chicares.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as
+// published by the Free Software Foundation.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software Foundation,
+// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+//
+// https://savannah.nongnu.org/projects/lmi
+// email: <gchicares@sbcglobal.net>
+// snail: Chicares, 186 Belle Woods Drive, Glastonbury CT 06033, USA
+
+#include "pchfile.hpp"
+
+#include "ul_utilities.hpp"
+
+#include "test_tools.hpp"
+
+int test_main(int, char*[])
+{
+    return EXIT_SUCCESS;
+}



reply via email to

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