lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 3ee62a7 19/24: Read product data files earlie


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 3ee62a7 19/24: Read product data files earlier
Date: Wed, 30 Dec 2020 18:47:01 -0500 (EST)

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

    Read product data files earlier
    
    The immediate motivation is to make rounding rules available earlier,
    so that values can be rounded when they are loaded from the database.
    This is safe because the selection of data files depends only on the
    product, which is determined by ctor arguments; because these XML files
    are always read in the same way (in their entirety, regardless of any
    other context); and because failure to read any of them causes the ctor
    to throw.
    
    SetRoundingFunctors() is similarly safe: it merely sets the function
    objects used for rounding, and it depends only on a '.rounding' file.
    
    The appropriate '.policy' and '.database' files have already been read
    upstream from this change. The '.funds', '.lingo', and '.strata' files
    may as well be read at the same time as '.rounding', for concinnity.
---
 ihs_basicval.cpp | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/ihs_basicval.cpp b/ihs_basicval.cpp
index 8e3f6fe..48ab827 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -164,6 +164,16 @@ BasicValues::BasicValues
 //============================================================================
 void BasicValues::Init()
 {
+    lingo_ = 
lingo::read_via_cache(AddDataDir(product().datum("LingoFilename")));
+    FundData_.reset(new FundData(AddDataDir(product().datum("FundFilename"))));
+    RoundingRules_.reset
+        (new rounding_rules(AddDataDir(product().datum("RoundingFilename")))
+        );
+    SetRoundingFunctors();
+    StratifiedCharges_.reset
+        (new stratified_charges(AddDataDir(product().datum("TierFilename")))
+        );
+
     SetPermanentInvariants();
 
     StateOfDomicile_ = mc_state_from_string(product().datum("InsCoDomicile"));
@@ -214,6 +224,7 @@ void BasicValues::Init()
             << LMI_FLUSH
             ;
         }
+
     if(database().query<int>(DB_MaxIssAge) < IssueAge)
         {
         alarum()
@@ -225,15 +236,7 @@ void BasicValues::Init()
             << LMI_FLUSH
             ;
         }
-    lingo_ = 
lingo::read_via_cache(AddDataDir(product().datum("LingoFilename")));
-    FundData_.reset(new FundData(AddDataDir(product().datum("FundFilename"))));
-    RoundingRules_.reset
-        (new rounding_rules(AddDataDir(product().datum("RoundingFilename")))
-        );
-    SetRoundingFunctors();
-    StratifiedCharges_.reset
-        (new stratified_charges(AddDataDir(product().datum("TierFilename")))
-        );
+
     SpreadFor7702_.assign
         (Length
         ,StratifiedCharges_->minimum_tiered_spread_for_7702()



reply via email to

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