lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4845] Permit annotations in '.funds' and '.strata' files


From: Greg Chicares
Subject: [lmi-commits] [4845] Permit annotations in '.funds' and '.strata' files
Date: Tue, 20 Apr 2010 13:27:43 +0000

Revision: 4845
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4845
Author:   chicares
Date:     2010-04-20 13:27:43 +0000 (Tue, 20 Apr 2010)
Log Message:
-----------
Permit annotations in '.funds' and '.strata' files

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/ihs_funddata.cpp
    lmi/trunk/ihs_funddata.hpp
    lmi/trunk/stratified_charges.cpp
    lmi/trunk/stratified_charges.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-04-19 22:30:51 UTC (rev 4844)
+++ lmi/trunk/ChangeLog 2010-04-20 13:27:43 UTC (rev 4845)
@@ -24927,3 +24927,11 @@
 Refactor, removing the speed penalty introduced 20100417T1245Z. See:
   http://lists.nongnu.org/archive/html/lmi/2010-04/msg00025.html
 
+20100420T1327Z <address@hidden> [760]
+
+  ihs_funddata.cpp
+  ihs_funddata.hpp
+  stratified_charges.cpp
+  stratified_charges.hpp
+Permit annotations in '.funds' and '.strata' files.
+

Modified: lmi/trunk/ihs_funddata.cpp
===================================================================
--- lmi/trunk/ihs_funddata.cpp  2010-04-19 22:30:51 UTC (rev 4844)
+++ lmi/trunk/ihs_funddata.cpp  2010-04-20 13:27:43 UTC (rev 4845)
@@ -43,18 +43,21 @@
     :ScalarIMF_(0.0)
     ,ShortName_("")
     ,LongName_ ("")
+    ,gloss_    ("")
 {
 }
 
 //============================================================================
 FundInfo::FundInfo
-    (double      ScalarIMF
-    ,std::string ShortName
-    ,std::string LongName
+    (double             ScalarIMF
+    ,std::string const& ShortName
+    ,std::string const& LongName
+    ,std::string const& gloss
     )
     :ScalarIMF_(ScalarIMF)
     ,ShortName_(ShortName)
     ,LongName_ (LongName)
+    ,gloss_    (gloss)
 {
 }
 
@@ -72,6 +75,7 @@
         set_element(e, "scalar_imf", t.ScalarIMF());
         set_element(e, "short_name", t.ShortName());
         set_element(e, "long_name" , t.LongName ());
+        set_element(e, "gloss"     , t.gloss    ());
     }
 
     static void from_xml(xml::element const& e, FundInfo& t)
@@ -79,10 +83,12 @@
         double      scalar_imf;
         std::string short_name;
         std::string long_name;
+        std::string gloss;
         get_element(e, "scalar_imf", scalar_imf);
         get_element(e, "short_name", short_name);
         get_element(e, "long_name" , long_name );
-        t = FundInfo(scalar_imf, short_name, long_name);
+        get_element(e, "gloss"     , gloss     );
+        t = FundInfo(scalar_imf, short_name, long_name, gloss);
     }
 };
 } // namespace xml_serialize
@@ -157,6 +163,7 @@
             (50
             ,"Money Market"
             ,"Money Market Fund"
+            ,"Specimen gloss."
             )
         );
     foo.Write(AddDataDir("sample.funds"));

Modified: lmi/trunk/ihs_funddata.hpp
===================================================================
--- lmi/trunk/ihs_funddata.hpp  2010-04-19 22:30:51 UTC (rev 4844)
+++ lmi/trunk/ihs_funddata.hpp  2010-04-20 13:27:43 UTC (rev 4845)
@@ -46,20 +46,23 @@
   public:
     FundInfo();
     FundInfo
-        (double      ScalarIMF
-        ,std::string ShortName
-        ,std::string LongName
+        (double             ScalarIMF
+        ,std::string const& ShortName
+        ,std::string const& LongName
+        ,std::string const& gloss = std::string()
         );
     ~FundInfo();
 
     double ScalarIMF() const;
     std::string const& ShortName() const;
     std::string const& LongName() const;
+    std::string const& gloss() const;
 
   private:
     double ScalarIMF_;
     std::string ShortName_;
     std::string LongName_;
+    std::string gloss_;
 };
 
 class LMI_SO FundData
@@ -100,6 +103,11 @@
     return LongName_;
 }
 
+inline std::string const& FundInfo::gloss() const
+{
+    return gloss_;
+}
+
 inline FundInfo const& FundData::GetFundInfo(int j) const
 {
     return FundInfo_[j];

Modified: lmi/trunk/stratified_charges.cpp
===================================================================
--- lmi/trunk/stratified_charges.cpp    2010-04-19 22:30:51 UTC (rev 4844)
+++ lmi/trunk/stratified_charges.cpp    2010-04-20 13:27:43 UTC (rev 4845)
@@ -72,9 +72,11 @@
 stratified_entity::stratified_entity
     (std::vector<double> const& limits
     ,std::vector<double> const& values
+    ,std::string const&         gloss
     )
     :limits_(limits)
     ,values_(values)
+    ,gloss_ (gloss)
 {
     assert_validity();
 }
@@ -119,10 +121,17 @@
 }
 
 //============================================================================
+std::string const& stratified_entity::gloss() const
+{
+    return gloss_;
+}
+
+//============================================================================
 void stratified_entity::read(xml::element const& e)
 {
     xml_serialize::get_element(e, "values", values_);
     xml_serialize::get_element(e, "limits", limits_);
+    xml_serialize::get_element(e, "gloss" , gloss_ );
 
     assert_validity();
 }
@@ -134,6 +143,7 @@
 
     xml_serialize::set_element(e, "values", values_);
     xml_serialize::set_element(e, "limits", limits_);
+    xml_serialize::set_element(e, "gloss" , gloss_ );
 }
 
 // Class stratified_charges implementation.
@@ -561,6 +571,7 @@
     foo.raw_entity(e_tiered_ak_premium_tax                ).values_.push_back 
(0.00100);
     foo.raw_entity(e_tiered_ak_premium_tax                
).limits_.push_back(100000.0);
     foo.raw_entity(e_tiered_ak_premium_tax                
).limits_.push_back(DBL_MAX);
+    foo.raw_entity(e_tiered_ak_premium_tax).gloss_ = "AK 21.09.210(m)";
 
     // DE: not yet implemented.
     foo.raw_entity(e_tiered_de_premium_tax                ).values_.push_back 
(0.0);
@@ -570,6 +581,7 @@
     foo.raw_entity(e_tiered_sd_premium_tax                ).values_.push_back 
(0.00080);
     foo.raw_entity(e_tiered_sd_premium_tax                
).limits_.push_back(100000.0);
     foo.raw_entity(e_tiered_sd_premium_tax                
).limits_.push_back(DBL_MAX);
+    foo.raw_entity(e_tiered_sd_premium_tax).gloss_ = "SD 10-4-22(2) (see also 
58-6-70)";
 
     foo.write(AddDataDir("sample.strata"));
 }

Modified: lmi/trunk/stratified_charges.hpp
===================================================================
--- lmi/trunk/stratified_charges.hpp    2010-04-19 22:30:51 UTC (rev 4844)
+++ lmi/trunk/stratified_charges.hpp    2010-04-20 13:27:43 UTC (rev 4845)
@@ -72,6 +72,7 @@
     stratified_entity
         (std::vector<double> const& limits
         ,std::vector<double> const& values
+        ,std::string const&         gloss = std::string()
         );
     ~stratified_entity();
 
@@ -83,9 +84,11 @@
 
     std::vector<double> const& limits() const;
     std::vector<double> const& values() const;
+    std::string const&         gloss () const;
 
     std::vector<double> limits_;
     std::vector<double> values_;
+    std::string         gloss_;
 };
 
 // Implicitly-declared special member functions do the right thing.





reply via email to

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