lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] valyuta/004 260857d 2/9: Read product data files ear


From: Greg Chicares
Subject: [lmi-commits] [lmi] valyuta/004 260857d 2/9: Read product data files earlier
Date: Tue, 29 Dec 2020 14:46:01 -0500 (EST)

branch: valyuta/004
commit 260857dfb2311b0debb72a4324245ea23cda5cab
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 32e1291..0830e7f 100644
--- a/ihs_basicval.cpp
+++ b/ihs_basicval.cpp
@@ -174,6 +174,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"));
@@ -224,6 +234,7 @@ void BasicValues::Init()
             << LMI_FLUSH
             ;
         }
+
     if(database().query<int>(DB_MaxIssAge) < IssueAge)
         {
         alarum()
@@ -235,15 +246,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]