lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 4df4bba 3/3: Replace a shared_ptr with an obj


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4df4bba 3/3: Replace a shared_ptr with an object
Date: Sun, 4 Nov 2018 21:27:46 -0500 (EST)

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

    Replace a shared_ptr with an object
---
 basic_values.hpp |  6 +++---
 basicvalues.cpp  | 22 +++++++++-------------
 ihs_basicval.cpp | 17 +++++++++++------
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/basic_values.hpp b/basic_values.hpp
index 7973e90..d6bc8d6 100644
--- a/basic_values.hpp
+++ b/basic_values.hpp
@@ -25,6 +25,7 @@
 #include "config.hpp"
 
 #include "actuarial_table.hpp"          // e_actuarial_table_method
+#include "database.hpp"
 #include "dbnames.hpp"                  // e_database_key
 #include "mc_enum_type_enums.hpp"
 #include "oecumenic_enumerations.hpp"
@@ -60,7 +61,6 @@ class MortalityRates;
 class death_benefits;
 class modal_outlay;
 class premium_tax;
-class product_database;
 class rounding_rules;
 class stratified_charges;
 
@@ -113,7 +113,7 @@ class LMI_SO BasicValues
 
     yare_input                          yare_input_;
     product_data     const              product_;
-    std::shared_ptr<product_database>   Database_;
+    product_database const              database_;
     std::shared_ptr<FundData>           FundData_;
     std::shared_ptr<rounding_rules>     RoundingRules_;
     std::shared_ptr<stratified_charges> StratifiedCharges_;
@@ -127,7 +127,7 @@ class LMI_SO BasicValues
     std::shared_ptr<Irc7702A>           Irc7702A_;
 
     product_data     const& product () const {return product_;}
-    product_database const& database() const {return *Database_;}
+    product_database const& database() const {return database_;}
 
     double GetAnnualTgtPrem(int a_year, double a_specamt) const;
 
diff --git a/basicvalues.cpp b/basicvalues.cpp
index 17dd165..5fa6455 100644
--- a/basicvalues.cpp
+++ b/basicvalues.cpp
@@ -25,8 +25,6 @@
 
 #include "alert.hpp"
 #include "assert_lmi.hpp"
-#include "database.hpp"
-#include "dbnames.hpp"
 #include "death_benefits.hpp"
 #include "input.hpp"
 #include "interest_rates.hpp"
@@ -50,6 +48,15 @@ char const* GuaranteedTableFile() {return 
"/opt/lmi/data/qx_cso";}
 BasicValues::BasicValues(Input const& input)
     :yare_input_              {input}
     ,product_                 {}
+    ,database_
+        ("filename--empty for antediluvian fork"
+        ,yare_input_.Gender
+        ,yare_input_.UnderwritingClass
+        ,yare_input_.Smoking
+        ,yare_input_.IssueAge
+        ,yare_input_.GroupUnderwritingType
+        ,yare_input_.StateOfJurisdiction
+        )
     ,StateOfJurisdiction_     {mce_s_CT}
     ,StateOfDomicile_         {mce_s_CT}
     ,PremiumTaxState_         {mce_s_CT}
@@ -88,17 +95,6 @@ void BasicValues::Init()
 
     StateOfJurisdiction_ = yare_input_.StateOfJurisdiction;
     PremiumTaxState_     = yare_input_.PremiumTaxState    ;
-    Database_.reset
-        (new product_database
-            ("empty for now" // filename
-            ,yare_input_.Gender
-            ,yare_input_.UnderwritingClass
-            ,yare_input_.Smoking
-            ,yare_input_.IssueAge
-            ,yare_input_.GroupUnderwritingType
-            ,yare_input_.StateOfJurisdiction
-            )
-        );
 
     // The database class constrains maturity age to be scalar.
     EndtAge = static_cast<int>(database().Query(DB_MaturityAge));
diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 6475d58..8612aba 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -29,7 +29,6 @@
 #include "calendar_date.hpp"
 #include "contains.hpp"
 #include "data_directory.hpp"
-#include "database.hpp"
 #include "death_benefits.hpp"
 #include "et_vector.hpp"
 #include "financial.hpp"                // list_bill_premium()
@@ -62,6 +61,7 @@
 BasicValues::BasicValues(Input const& input)
     :yare_input_         (input)
     ,product_            (yare_input_.ProductName)
+    ,database_           (yare_input_)
     ,DefnLifeIns_        {mce_cvat}
     ,DefnMaterialChange_ {mce_unnecessary_premium}
     ,Equiv7702DBO3       {mce_option1_for_7702}
@@ -92,6 +92,15 @@ BasicValues::BasicValues
     )
     :yare_input_         (Input{})
     ,product_            (a_ProductName)
+    ,database_
+        (a_ProductName
+        ,a_Gender
+        ,a_UnderwritingClass
+        ,a_Smoker
+        ,a_IssueAge
+        ,a_UnderwritingBasis
+        ,a_StateOfJurisdiction
+        )
     ,DefnLifeIns_        {mce_cvat}
     ,DefnMaterialChange_ {mce_unnecessary_premium}
     ,Equiv7702DBO3       {a_DBOptFor7702}
@@ -136,8 +145,6 @@ BasicValues::BasicValues
 //============================================================================
 void BasicValues::Init()
 {
-    Database_.reset(new product_database(yare_input_));
-
     SetPermanentInvariants();
 
     StateOfDomicile_ = mc_state_from_string(product().datum("InsCoDomicile"));
@@ -242,8 +249,6 @@ void BasicValues::Init()
 // TODO ??  Not for general use--use for GPT server only, for now. TAXATION !! 
refactor later
 void BasicValues::GPTServerInit()
 {
-    Database_.reset(new product_database(yare_input_));
-
     SetPermanentInvariants();
 
     IssueAge = yare_input_.IssueAge;
@@ -595,7 +600,7 @@ double BasicValues::GetAnnualTgtPrem(int a_year, double 
a_specamt) const
 
 /// Establish up front some values that cannot later change.
 ///
-/// Values set here depend on Database_, and thus on yare_input_ and
+/// Values set here depend on database_, and thus on yare_input_ and
 /// on product_, but not on any other shared_ptr members--so they
 /// can reliably be used in initializing those other members.
 



reply via email to

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