lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4842] Permit annotations in '.policy' files


From: Greg Chicares
Subject: [lmi-commits] [4842] Permit annotations in '.policy' files
Date: Sun, 18 Apr 2010 21:19:23 +0000

Revision: 4842
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4842
Author:   chicares
Date:     2010-04-18 21:19:22 +0000 (Sun, 18 Apr 2010)
Log Message:
-----------
Permit annotations in '.policy' files

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/my_prod.cpp
    lmi/trunk/policy_document.cpp
    lmi/trunk/product_data.cpp
    lmi/trunk/product_data.hpp
    lmi/trunk/workhorse.make

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2010-04-17 12:45:23 UTC (rev 4841)
+++ lmi/trunk/ChangeLog 2010-04-18 21:19:22 UTC (rev 4842)
@@ -24899,3 +24899,12 @@
   xml_serializable.tpp
 Refactor.
 
+20100418T2119Z <address@hidden> [760]
+
+  my_prod.cpp
+  policy_document.cpp
+  product_data.cpp
+  product_data.hpp
+  workhorse.make
+Permit annotations in '.policy' files.
+

Modified: lmi/trunk/my_prod.cpp
===================================================================
--- lmi/trunk/my_prod.cpp       2010-04-17 12:45:23 UTC (rev 4841)
+++ lmi/trunk/my_prod.cpp       2010-04-18 21:19:22 UTC (rev 4842)
@@ -61,52 +61,52 @@
 
     // Generic data for the 'sample' product.
 
-    z.DatabaseFilename               = "sample.db4";
-    z.FundFilename                   = "sample.funds";
-    z.RoundingFilename               = "sample.rounding";
-    z.TierFilename                   = "sample.strata";
+    z.DatabaseFilename        = glossed_string("sample.db4");
+    z.FundFilename            = glossed_string("sample.funds");
+    z.RoundingFilename        = glossed_string("sample.rounding");
+    z.TierFilename            = glossed_string("sample.strata");
 
-    z.CorridorFilename               = "sample";
-    z.CurrCOIFilename                = "qx_cso";
-    z.GuarCOIFilename                = "qx_cso";
-    z.WPFilename                     = "sample";
-    z.ADDFilename                    = "qx_ins";
-    z.ChildRiderFilename             = "qx_ins";
-    z.CurrSpouseRiderFilename        = "qx_ins";
-    z.GuarSpouseRiderFilename        = "qx_ins";
-    z.CurrTermFilename               = "qx_cso";
-    z.GuarTermFilename               = "qx_cso";
-    z.TableYFilename                 = "qx_ins";
-    z.PremTaxFilename                = "sample";
-    z.TAMRA7PayFilename              = "sample";
-    z.TgtPremFilename                = "sample";
-    z.IRC7702Filename                = "qx_cso";
-    z.Gam83Filename                  = "qx_ann";
-    z.SubstdTblMultFilename          = "sample";
-    z.CurrSpecAmtLoadFilename        = "sample";
-    z.GuarSpecAmtLoadFilename        = "sample";
-    z.PolicyForm                     = "UL32768-NY";
-    z.PolicyMktgName                 = "UL Supreme";
-    z.PolicyLegalName = "Flexible Premium Adjustable Life Insurance Policy";
-    z.InsCoShortName                 = "Superior Life";
-    z.InsCoName                      = "Superior Life Insurance Company";
-    z.InsCoAddr                      = "Superior, WI 12345";
-    z.InsCoStreet                    = "246 Main Street";
-    z.InsCoPhone                     = "(800) 555-1212";
-    z.InsCoDomicile                  = "WI";
-    z.MainUnderwriter                = "Superior Securities";
-    z.MainUnderwriterAddress         = "246-M Main Street, Superior, WI 12345";
-    z.CoUnderwriter                  = "Superior Investors";
-    z.CoUnderwriterAddress           = "246-C Main Street, Superior, WI 12345";
-    z.AvName                         = "Account";
-    z.CsvName                        = "Cash Surrender";
-    z.CsvHeaderName                  = "Cash Surr";
-    z.NoLapseProvisionName           = "No-lapse Provision";
+    z.CorridorFilename        = glossed_string("sample");
+    z.CurrCOIFilename         = glossed_string("qx_cso");
+    z.GuarCOIFilename         = glossed_string("qx_cso");
+    z.WPFilename              = glossed_string("sample");
+    z.ADDFilename             = glossed_string("qx_ins", "Specimen gloss.");
+    z.ChildRiderFilename      = glossed_string("qx_ins");
+    z.CurrSpouseRiderFilename = glossed_string("qx_ins");
+    z.GuarSpouseRiderFilename = glossed_string("qx_ins");
+    z.CurrTermFilename        = glossed_string("qx_cso");
+    z.GuarTermFilename        = glossed_string("qx_cso");
+    z.TableYFilename          = glossed_string("qx_ins");
+    z.PremTaxFilename         = glossed_string("sample");
+    z.TAMRA7PayFilename       = glossed_string("sample");
+    z.TgtPremFilename         = glossed_string("sample");
+    z.IRC7702Filename         = glossed_string("qx_cso");
+    z.Gam83Filename           = glossed_string("qx_ann");
+    z.SubstdTblMultFilename   = glossed_string("sample");
+    z.CurrSpecAmtLoadFilename = glossed_string("sample");
+    z.GuarSpecAmtLoadFilename = glossed_string("sample");
+    z.PolicyForm              = glossed_string("UL32768-NY");
+    z.PolicyMktgName          = glossed_string("UL Supreme");
+    z.PolicyLegalName         = glossed_string("Flexible Premium Adjustable 
Life Insurance Policy");
+    z.InsCoShortName          = glossed_string("Superior Life");
+    z.InsCoName               = glossed_string("Superior Life Insurance 
Company");
+    z.InsCoAddr               = glossed_string("Superior, WI 12345");
+    z.InsCoStreet             = glossed_string("246 Main Street");
+    z.InsCoPhone              = glossed_string("(800) 555-1212");
+    z.InsCoDomicile           = glossed_string("WI");
+    z.MainUnderwriter         = glossed_string("Superior Securities");
+    z.MainUnderwriterAddress  = glossed_string("246-M Main Street, Superior, 
WI 12345");
+    z.CoUnderwriter           = glossed_string("Superior Investors");
+    z.CoUnderwriterAddress    = glossed_string("246-C Main Street, Superior, 
WI 12345");
+    z.AvName                  = glossed_string("Account");
+    z.CsvName                 = glossed_string("Cash Surrender");
+    z.CsvHeaderName           = glossed_string("Cash Surr");
+    z.NoLapseProvisionName    = glossed_string("No-lapse Provision");
 
     z.save(AddDataDir("sample.policy"));
 
     // Copy the template above for other policy forms, e.g.:
-//  z.DatabaseFilename               = "another.db4";
+//  z.DatabaseFilename        = glossed_string("another.db4");
 //  ...
 }
 

Modified: lmi/trunk/policy_document.cpp
===================================================================
--- lmi/trunk/policy_document.cpp       2010-04-17 12:45:23 UTC (rev 4841)
+++ lmi/trunk/policy_document.cpp       2010-04-18 21:19:22 UTC (rev 4842)
@@ -43,48 +43,48 @@
     ,product_data_()
     ,values_()
 {
-    values_["DatabaseFilename"       ] = &product_data_.DatabaseFilename;
-    values_["FundFilename"           ] = &product_data_.FundFilename;
-    values_["CorridorFilename"       ] = &product_data_.CorridorFilename;
-    values_["CurrCOIFilename"        ] = &product_data_.CurrCOIFilename;
-    values_["GuarCOIFilename"        ] = &product_data_.GuarCOIFilename;
-    values_["WPFilename"             ] = &product_data_.WPFilename;
-    values_["ADDFilename"            ] = &product_data_.ADDFilename;
-    values_["ChildRiderFilename"     ] = &product_data_.ChildRiderFilename;
-    values_["CurrSpouseRiderFilename"] = 
&product_data_.CurrSpouseRiderFilename;
-    values_["GuarSpouseRiderFilename"] = 
&product_data_.GuarSpouseRiderFilename;
-    values_["CurrTermFilename"       ] = &product_data_.CurrTermFilename;
-    values_["GuarTermFilename"       ] = &product_data_.GuarTermFilename;
-    values_["TableYFilename"         ] = &product_data_.TableYFilename;
-    values_["PremTaxFilename"        ] = &product_data_.PremTaxFilename;
-    values_["TAMRA7PayFilename"      ] = &product_data_.TAMRA7PayFilename;
-    values_["TgtPremFilename"        ] = &product_data_.TgtPremFilename;
-    values_["IRC7702Filename"        ] = &product_data_.IRC7702Filename;
-    values_["Gam83Filename"          ] = &product_data_.Gam83Filename;
-    values_["SubstdTblMultFilename"  ] = &product_data_.SubstdTblMultFilename;
-    values_["CurrSpecAmtLoadFilename"] = 
&product_data_.CurrSpecAmtLoadFilename;
-    values_["GuarSpecAmtLoadFilename"] = 
&product_data_.GuarSpecAmtLoadFilename;
-    values_["RoundingFilename"       ] = &product_data_.RoundingFilename;
-    values_["TierFilename"           ] = &product_data_.TierFilename;
-    values_["PolicyForm"             ] = &product_data_.PolicyForm;
-    values_["PolicyMktgName"         ] = &product_data_.PolicyMktgName;
-    values_["PolicyLegalName"        ] = &product_data_.PolicyLegalName;
-    values_["InsCoShortName"         ] = &product_data_.InsCoShortName;
-    values_["InsCoName"              ] = &product_data_.InsCoName;
-    values_["InsCoAddr"              ] = &product_data_.InsCoAddr;
-    values_["InsCoStreet"            ] = &product_data_.InsCoStreet;
-    values_["InsCoPhone"             ] = &product_data_.InsCoPhone;
-    values_["InsCoDomicile"          ] = &product_data_.InsCoDomicile;
-    values_["MainUnderwriter"        ] = &product_data_.MainUnderwriter;
-    values_["MainUnderwriterAddress" ] = &product_data_.MainUnderwriterAddress;
-    values_["CoUnderwriter"          ] = &product_data_.CoUnderwriter;
-    values_["CoUnderwriterAddress"   ] = &product_data_.CoUnderwriterAddress;
-    values_["AvName"                 ] = &product_data_.AvName;
-    values_["CsvName"                ] = &product_data_.CsvName;
-    values_["CsvHeaderName"          ] = &product_data_.CsvHeaderName;
-    values_["NoLapseProvisionName"   ] = &product_data_.NoLapseProvisionName;
-    values_["InterestDisclaimer"     ] = &product_data_.InterestDisclaimer;
-    values_["GuarMortalityFootnote"  ] = &product_data_.GuarMortalityFootnote;
+    values_["DatabaseFilename"       ] = &product_data_.DatabaseFilename       
.datum_;
+    values_["FundFilename"           ] = &product_data_.FundFilename           
.datum_;
+    values_["CorridorFilename"       ] = &product_data_.CorridorFilename       
.datum_;
+    values_["CurrCOIFilename"        ] = &product_data_.CurrCOIFilename        
.datum_;
+    values_["GuarCOIFilename"        ] = &product_data_.GuarCOIFilename        
.datum_;
+    values_["WPFilename"             ] = &product_data_.WPFilename             
.datum_;
+    values_["ADDFilename"            ] = &product_data_.ADDFilename            
.datum_;
+    values_["ChildRiderFilename"     ] = &product_data_.ChildRiderFilename     
.datum_;
+    values_["CurrSpouseRiderFilename"] = 
&product_data_.CurrSpouseRiderFilename.datum_;
+    values_["GuarSpouseRiderFilename"] = 
&product_data_.GuarSpouseRiderFilename.datum_;
+    values_["CurrTermFilename"       ] = &product_data_.CurrTermFilename       
.datum_;
+    values_["GuarTermFilename"       ] = &product_data_.GuarTermFilename       
.datum_;
+    values_["TableYFilename"         ] = &product_data_.TableYFilename         
.datum_;
+    values_["PremTaxFilename"        ] = &product_data_.PremTaxFilename        
.datum_;
+    values_["TAMRA7PayFilename"      ] = &product_data_.TAMRA7PayFilename      
.datum_;
+    values_["TgtPremFilename"        ] = &product_data_.TgtPremFilename        
.datum_;
+    values_["IRC7702Filename"        ] = &product_data_.IRC7702Filename        
.datum_;
+    values_["Gam83Filename"          ] = &product_data_.Gam83Filename          
.datum_;
+    values_["SubstdTblMultFilename"  ] = &product_data_.SubstdTblMultFilename  
.datum_;
+    values_["CurrSpecAmtLoadFilename"] = 
&product_data_.CurrSpecAmtLoadFilename.datum_;
+    values_["GuarSpecAmtLoadFilename"] = 
&product_data_.GuarSpecAmtLoadFilename.datum_;
+    values_["RoundingFilename"       ] = &product_data_.RoundingFilename       
.datum_;
+    values_["TierFilename"           ] = &product_data_.TierFilename           
.datum_;
+    values_["PolicyForm"             ] = &product_data_.PolicyForm             
.datum_;
+    values_["PolicyMktgName"         ] = &product_data_.PolicyMktgName         
.datum_;
+    values_["PolicyLegalName"        ] = &product_data_.PolicyLegalName        
.datum_;
+    values_["InsCoShortName"         ] = &product_data_.InsCoShortName         
.datum_;
+    values_["InsCoName"              ] = &product_data_.InsCoName              
.datum_;
+    values_["InsCoAddr"              ] = &product_data_.InsCoAddr              
.datum_;
+    values_["InsCoStreet"            ] = &product_data_.InsCoStreet            
.datum_;
+    values_["InsCoPhone"             ] = &product_data_.InsCoPhone             
.datum_;
+    values_["InsCoDomicile"          ] = &product_data_.InsCoDomicile          
.datum_;
+    values_["MainUnderwriter"        ] = &product_data_.MainUnderwriter        
.datum_;
+    values_["MainUnderwriterAddress" ] = &product_data_.MainUnderwriterAddress 
.datum_;
+    values_["CoUnderwriter"          ] = &product_data_.CoUnderwriter          
.datum_;
+    values_["CoUnderwriterAddress"   ] = &product_data_.CoUnderwriterAddress   
.datum_;
+    values_["AvName"                 ] = &product_data_.AvName                 
.datum_;
+    values_["CsvName"                ] = &product_data_.CsvName                
.datum_;
+    values_["CsvHeaderName"          ] = &product_data_.CsvHeaderName          
.datum_;
+    values_["NoLapseProvisionName"   ] = &product_data_.NoLapseProvisionName   
.datum_;
+    values_["InterestDisclaimer"     ] = &product_data_.InterestDisclaimer     
.datum_;
+    values_["GuarMortalityFootnote"  ] = &product_data_.GuarMortalityFootnote  
.datum_;
 }
 
 PolicyDocument::~PolicyDocument()

Modified: lmi/trunk/product_data.cpp
===================================================================
--- lmi/trunk/product_data.cpp  2010-04-17 12:45:23 UTC (rev 4841)
+++ lmi/trunk/product_data.cpp  2010-04-18 21:19:22 UTC (rev 4842)
@@ -33,6 +33,7 @@
 #include "assert_lmi.hpp"
 #include "data_directory.hpp" // AddDataDir()
 #include "miscellany.hpp"     // lmi_array_size()
+#include "xml_serialize.hpp"
 
 #include <boost/filesystem/convenience.hpp>
 #include <boost/filesystem/path.hpp>
@@ -42,6 +43,99 @@
 
 template class xml_serializable<product_data>;
 
+namespace xml_serialize
+{
+template<> struct xml_io<glossed_string>
+{
+    static void to_xml(xml::element& e, glossed_string const& t)
+    {
+        set_element(e, "datum", t.datum());
+        set_element(e, "gloss", t.gloss());
+    }
+
+    static void from_xml(xml::element const& e, glossed_string& t)
+    {
+        std::string datum;
+        std::string gloss;
+        get_element(e, "datum", datum);
+        get_element(e, "gloss", gloss);
+        t = glossed_string(datum, gloss);
+    }
+};
+} // namespace xml_serialize
+
+/// Specialize value_cast<>() to throw an exception.
+///
+/// This is required by
+///   any_member::str()
+/// which is not useful here.
+
+template<> std::string value_cast<std::string>(glossed_string const& z)
+{
+    fatal_error()
+        << "Invalid function call. Context:"
+        << '\n' << z.datum()
+        << '\n' << z.gloss()
+        << LMI_FLUSH
+        ;
+    throw "Unreachable--silences a compiler diagnostic.";
+}
+
+/// Specialize value_cast<>() to throw an exception.
+///
+/// This is required by
+///   any_member::operator=(std::string const&)
+/// which is not useful here.
+
+template<> glossed_string value_cast<glossed_string>(std::string const& z)
+{
+    fatal_error()
+        << "Invalid function call. Context:"
+        << '\n' << z
+        << LMI_FLUSH
+        ;
+    throw "Unreachable--silences a compiler diagnostic.";
+}
+
+/// Private default ctor, for friend class product_data.
+
+glossed_string::glossed_string()
+{}
+
+glossed_string::glossed_string
+    (std::string const& datum
+    ,std::string const& gloss
+    )
+    :datum_(datum)
+    ,gloss_(gloss)
+{}
+
+glossed_string::~glossed_string()
+{}
+
+/// Temporary private assignment operator for external 'my_prod.cpp'.
+
+glossed_string& glossed_string::operator=(std::string const& s)
+{
+    datum_ = s;
+    return *this;
+}
+
+bool glossed_string::operator==(glossed_string const& z) const
+{
+    return z.datum_ == datum_ && z.gloss_ == gloss_;
+}
+
+std::string const& glossed_string::datum() const
+{
+    return datum_;
+}
+
+std::string const& glossed_string::gloss() const
+{
+    return gloss_;
+}
+
 /// Private default ctor.
 ///
 /// Used only by friend class PolicyDocument and 'my_prod.cpp'.
@@ -71,11 +165,11 @@
 {
 }
 
-/// Get string datum (without annotation) for named member.
+/// Principal string datum (without gloss) for named member.
 
 std::string const& product_data::datum(std::string const& name) const
 {
-    return *member_cast<std::string>(operator[](name));
+    return member_cast<glossed_string>(operator[](name))->datum();
 }
 
 /// Enregister certain data members for access via any_member<>[].
@@ -198,6 +292,31 @@
     return "policy";
 }
 
+/// This override doesn't call redintegrate_ex_ante(); that wouldn't
+/// make sense, because the underlying datatype is just a doublet of
+/// strings, and strings can legitimately contain anything.
+
+void product_data::read_element
+    (xml::element const& parent
+    ,std::string const&  name
+    ,product_data&       // t [actually superfluous]
+    ,int                 // file_version
+    )
+{
+    glossed_string& r = *member_cast<glossed_string>(operator[](name));
+    xml_serialize::get_element(parent, name, r);
+}
+
+void product_data::write_element
+    (xml::element&       parent
+    ,std::string const&  name
+    ,product_data const& // t [actually superfluous]
+    ) const
+{
+    glossed_string const& r = *member_cast<glossed_string>(operator[](name));
+    xml_serialize::set_element(parent, name, r);
+}
+
 bool product_data::is_detritus(std::string const& s) const
 {
     static std::string const a[] =
@@ -216,47 +335,47 @@
 {
     product_data z;
 
-    z.DatabaseFilename               = "sample.db4";
-    z.FundFilename                   = "sample.funds";
-    z.RoundingFilename               = "sample.rounding";
-    z.TierFilename                   = "sample.strata";
+    z.DatabaseFilename        = glossed_string("sample.db4");
+    z.FundFilename            = glossed_string("sample.funds");
+    z.RoundingFilename        = glossed_string("sample.rounding");
+    z.TierFilename            = glossed_string("sample.strata");
 
-    z.CorridorFilename               = "sample";
-    z.CurrCOIFilename                = "qx_cso";
-    z.GuarCOIFilename                = "qx_cso";
-    z.WPFilename                     = "sample";
-    z.ADDFilename                    = "qx_ins";
-    z.ChildRiderFilename             = "qx_ins";
-    z.CurrSpouseRiderFilename        = "qx_ins";
-    z.GuarSpouseRiderFilename        = "qx_ins";
-    z.CurrTermFilename               = "qx_cso";
-    z.GuarTermFilename               = "qx_cso";
-    z.TableYFilename                 = "qx_ins";
-    z.PremTaxFilename                = "sample";
-    z.TAMRA7PayFilename              = "sample";
-    z.TgtPremFilename                = "sample";
-    z.IRC7702Filename                = "qx_cso";
-    z.Gam83Filename                  = "qx_ann";
-    z.SubstdTblMultFilename          = "sample";
-    z.CurrSpecAmtLoadFilename        = "sample";
-    z.GuarSpecAmtLoadFilename        = "sample";
-    z.PolicyForm                     = "UL32768-NY";
-    z.PolicyMktgName                 = "UL Supreme";
-    z.PolicyLegalName = "Flexible Premium Adjustable Life Insurance Policy";
-    z.InsCoShortName                 = "Superior Life";
-    z.InsCoName                      = "Superior Life Insurance Company";
-    z.InsCoAddr                      = "Superior, WI 12345";
-    z.InsCoStreet                    = "246 Main Street";
-    z.InsCoPhone                     = "(800) 555-1212";
-    z.InsCoDomicile                  = "WI";
-    z.MainUnderwriter                = "Superior Securities";
-    z.MainUnderwriterAddress         = "246-M Main Street, Superior, WI 12345";
-    z.CoUnderwriter                  = "Superior Investors";
-    z.CoUnderwriterAddress           = "246-C Main Street, Superior, WI 12345";
-    z.AvName                         = "Account";
-    z.CsvName                        = "Cash Surrender";
-    z.CsvHeaderName                  = "Cash Surr";
-    z.NoLapseProvisionName           = "No-lapse Provision";
+    z.CorridorFilename        = glossed_string("sample");
+    z.CurrCOIFilename         = glossed_string("qx_cso");
+    z.GuarCOIFilename         = glossed_string("qx_cso");
+    z.WPFilename              = glossed_string("sample");
+    z.ADDFilename             = glossed_string("qx_ins", "Specimen gloss.");
+    z.ChildRiderFilename      = glossed_string("qx_ins");
+    z.CurrSpouseRiderFilename = glossed_string("qx_ins");
+    z.GuarSpouseRiderFilename = glossed_string("qx_ins");
+    z.CurrTermFilename        = glossed_string("qx_cso");
+    z.GuarTermFilename        = glossed_string("qx_cso");
+    z.TableYFilename          = glossed_string("qx_ins");
+    z.PremTaxFilename         = glossed_string("sample");
+    z.TAMRA7PayFilename       = glossed_string("sample");
+    z.TgtPremFilename         = glossed_string("sample");
+    z.IRC7702Filename         = glossed_string("qx_cso");
+    z.Gam83Filename           = glossed_string("qx_ann");
+    z.SubstdTblMultFilename   = glossed_string("sample");
+    z.CurrSpecAmtLoadFilename = glossed_string("sample");
+    z.GuarSpecAmtLoadFilename = glossed_string("sample");
+    z.PolicyForm              = glossed_string("UL32768-NY");
+    z.PolicyMktgName          = glossed_string("UL Supreme");
+    z.PolicyLegalName         = glossed_string("Flexible Premium Adjustable 
Life Insurance Policy");
+    z.InsCoShortName          = glossed_string("Superior Life");
+    z.InsCoName               = glossed_string("Superior Life Insurance 
Company");
+    z.InsCoAddr               = glossed_string("Superior, WI 12345");
+    z.InsCoStreet             = glossed_string("246 Main Street");
+    z.InsCoPhone              = glossed_string("(800) 555-1212");
+    z.InsCoDomicile           = glossed_string("WI");
+    z.MainUnderwriter         = glossed_string("Superior Securities");
+    z.MainUnderwriterAddress  = glossed_string("246-M Main Street, Superior, 
WI 12345");
+    z.CoUnderwriter           = glossed_string("Superior Investors");
+    z.CoUnderwriterAddress    = glossed_string("246-C Main Street, Superior, 
WI 12345");
+    z.AvName                  = glossed_string("Account");
+    z.CsvName                 = glossed_string("Cash Surrender");
+    z.CsvHeaderName           = glossed_string("Cash Surr");
+    z.NoLapseProvisionName    = glossed_string("No-lapse Provision");
 
     z.save(AddDataDir("sample.policy"));
 }

Modified: lmi/trunk/product_data.hpp
===================================================================
--- lmi/trunk/product_data.hpp  2010-04-17 12:45:23 UTC (rev 4841)
+++ lmi/trunk/product_data.hpp  2010-04-18 21:19:22 UTC (rev 4842)
@@ -35,6 +35,40 @@
 
 #include <string>
 
+/// A single product datum: a string with an optional gloss.
+///
+/// For example, the principal string datum might be the full name of
+/// the issuing company, whereas the gloss might explain under what
+/// conditions that company is used instead of a sibling.
+///
+/// Implicitly-declared special member functions do the right thing.
+
+class glossed_string
+    :virtual private obstruct_slicing<glossed_string>
+{
+    friend class PolicyDocument;
+    friend class product_data;
+
+  public:
+    explicit glossed_string
+        (std::string const& datum
+        ,std::string const& gloss = std::string()
+        );
+    ~glossed_string();
+
+    bool operator==(glossed_string const&) const;
+
+    std::string const& datum() const;
+    std::string const& gloss() const;
+
+  private:
+    glossed_string();
+    glossed_string& operator=(std::string const&);
+
+    std::string datum_;
+    std::string gloss_;
+};
+
 /// Product data representable as strings, including filenames.
 ///
 /// This is the "master" product file: it includes the filenames of
@@ -70,126 +104,137 @@
     virtual std::string xml_root_name() const;
 
     // xml_serializable overrides.
+    virtual void read_element
+        (xml::element const& parent
+        ,std::string const&  name
+        ,product_data&
+        ,int                 file_version
+        );
+    virtual void write_element
+        (xml::element&       parent
+        ,std::string const&  name
+        ,product_data const&
+        ) const;
     virtual bool is_detritus(std::string const&) const;
 
     // Names of files that contain other product data.
-    std::string DatabaseFilename;
-    std::string FundFilename;
-    std::string RoundingFilename;
-    std::string TierFilename;
+    glossed_string DatabaseFilename;
+    glossed_string FundFilename;
+    glossed_string RoundingFilename;
+    glossed_string TierFilename;
 
     // Names of rate-table files.
-    std::string CorridorFilename;
-    std::string CurrCOIFilename;
-    std::string GuarCOIFilename;
-    std::string WPFilename;
-    std::string ADDFilename;
-    std::string ChildRiderFilename;
-    std::string CurrSpouseRiderFilename;
-    std::string GuarSpouseRiderFilename;
-    std::string CurrTermFilename;
-    std::string GuarTermFilename;
-    std::string TableYFilename;
-    std::string PremTaxFilename;
-    std::string TAMRA7PayFilename;
-    std::string TgtPremFilename;
-    std::string IRC7702Filename;
-    std::string Gam83Filename;
-    std::string SubstdTblMultFilename;
-    std::string CurrSpecAmtLoadFilename;
-    std::string GuarSpecAmtLoadFilename;
+    glossed_string CorridorFilename;
+    glossed_string CurrCOIFilename;
+    glossed_string GuarCOIFilename;
+    glossed_string WPFilename;
+    glossed_string ADDFilename;
+    glossed_string ChildRiderFilename;
+    glossed_string CurrSpouseRiderFilename;
+    glossed_string GuarSpouseRiderFilename;
+    glossed_string CurrTermFilename;
+    glossed_string GuarTermFilename;
+    glossed_string TableYFilename;
+    glossed_string PremTaxFilename;
+    glossed_string TAMRA7PayFilename;
+    glossed_string TgtPremFilename;
+    glossed_string IRC7702Filename;
+    glossed_string Gam83Filename;
+    glossed_string SubstdTblMultFilename;
+    glossed_string CurrSpecAmtLoadFilename;
+    glossed_string GuarSpecAmtLoadFilename;
 
     // Essential strings describing the policy and company.
-    std::string PolicyForm;
-    std::string PolicyMktgName;
-    std::string PolicyLegalName;
-    std::string InsCoShortName;
-    std::string InsCoName;
-    std::string InsCoAddr;
-    std::string InsCoStreet;
-    std::string InsCoPhone;
-    std::string InsCoDomicile;
-    std::string MainUnderwriter;
-    std::string MainUnderwriterAddress;
-    std::string CoUnderwriter;
-    std::string CoUnderwriterAddress;
+    glossed_string PolicyForm;
+    glossed_string PolicyMktgName;
+    glossed_string PolicyLegalName;
+    glossed_string InsCoShortName;
+    glossed_string InsCoName;
+    glossed_string InsCoAddr;
+    glossed_string InsCoStreet;
+    glossed_string InsCoPhone;
+    glossed_string InsCoDomicile;
+    glossed_string MainUnderwriter;
+    glossed_string MainUnderwriterAddress;
+    glossed_string CoUnderwriter;
+    glossed_string CoUnderwriterAddress;
 
     // Terms defined in the contract, which must be used for column
     // headers according to the illustration reg.
-    std::string AvName;
-    std::string CsvName;
-    std::string CsvHeaderName;
-    std::string NoLapseProvisionName;
+    glossed_string AvName;
+    glossed_string CsvName;
+    glossed_string CsvHeaderName;
+    glossed_string NoLapseProvisionName;
 
     // Most of the following are missing from the GUI.
 
     // Footnotes that describe various ledger columns.
-    std::string AccountValueFootnote;
-    std::string AttainedAgeFootnote;
-    std::string CashSurrValueFootnote;
-    std::string DeathBenefitFootnote;
-    std::string InitialPremiumFootnote;
-    std::string NetPremiumFootnote;
-    std::string OutlayFootnote;
-    std::string PolicyYearFootnote;
+    glossed_string AccountValueFootnote;
+    glossed_string AttainedAgeFootnote;
+    glossed_string CashSurrValueFootnote;
+    glossed_string DeathBenefitFootnote;
+    glossed_string InitialPremiumFootnote;
+    glossed_string NetPremiumFootnote;
+    glossed_string OutlayFootnote;
+    glossed_string PolicyYearFootnote;
 
     // Rider footnotes.
-    std::string ADDFootnote;
-    std::string ChildFootnote;
-    std::string SpouseFootnote;
-    std::string TermFootnote;
-    std::string WaiverFootnote;
+    glossed_string ADDFootnote;
+    glossed_string ChildFootnote;
+    glossed_string SpouseFootnote;
+    glossed_string TermFootnote;
+    glossed_string WaiverFootnote;
 
     // Premium-specific footnotes.
-    std::string MinimumPremiumFootnote;
-    std::string PremAllocationFootnote;
+    glossed_string MinimumPremiumFootnote;
+    glossed_string PremAllocationFootnote;
 
     // Miscellaneous other footnotes.
-    std::string InterestDisclaimer;
-    std::string GuarMortalityFootnote;
-    std::string ProductDescription;
-    std::string StableValueFootnote;
-    std::string NoVanishPremiumFootnote;
-    std::string RejectPremiumFootnote;
-    std::string ExpRatingFootnote;
-    std::string MortalityBlendFootnote;
-    std::string HypotheticalRatesFootnote;
-    std::string SalesLoadRefundFootnote;
-    std::string NoLapseFootnote;
-    std::string MarketValueAdjFootnote;
-    std::string ExchangeChargeFootnote0;
-    std::string CurrentValuesFootnote;
-    std::string DBOption1Footnote;
-    std::string DBOption2Footnote;
-    std::string ExpRatRiskChargeFootnote;
-    std::string ExchangeChargeFootnote1;
-    std::string FlexiblePremiumFootnote;
-    std::string GuaranteedValuesFootnote;
-    std::string CreditingRateFootnote;
-    std::string MecFootnote;
-    std::string MidpointValuesFootnote;
-    std::string SinglePremiumFootnote;
-    std::string MonthlyChargesFootnote;
-    std::string UltCreditingRateFootnote;
-    std::string MaxNaarFootnote;
-    std::string PremTaxSurrChgFootnote;
-    std::string PolicyFeeFootnote;
-    std::string AssetChargeFootnote;
-    std::string InvestmentIncomeFootnote;
-    std::string IrrDbFootnote;
-    std::string IrrCsvFootnote;
-    std::string MortalityChargesFootnote;
-    std::string LoanAndWithdrawalFootnote;
-    std::string PresaleTrackingNumber;
-    std::string CompositeTrackingNumber;
-    std::string InforceTrackingNumber;
-    std::string InforceCompositeTrackingNumber;
-    std::string InforceNonGuaranteedFootnote0;
-    std::string InforceNonGuaranteedFootnote1;
-    std::string InforceNonGuaranteedFootnote2;
-    std::string InforceNonGuaranteedFootnote3;
-    std::string NonGuaranteedFootnote;
-    std::string MonthlyChargesPaymentFootnote;
+    glossed_string InterestDisclaimer;
+    glossed_string GuarMortalityFootnote;
+    glossed_string ProductDescription;
+    glossed_string StableValueFootnote;
+    glossed_string NoVanishPremiumFootnote;
+    glossed_string RejectPremiumFootnote;
+    glossed_string ExpRatingFootnote;
+    glossed_string MortalityBlendFootnote;
+    glossed_string HypotheticalRatesFootnote;
+    glossed_string SalesLoadRefundFootnote;
+    glossed_string NoLapseFootnote;
+    glossed_string MarketValueAdjFootnote;
+    glossed_string ExchangeChargeFootnote0;
+    glossed_string CurrentValuesFootnote;
+    glossed_string DBOption1Footnote;
+    glossed_string DBOption2Footnote;
+    glossed_string ExpRatRiskChargeFootnote;
+    glossed_string ExchangeChargeFootnote1;
+    glossed_string FlexiblePremiumFootnote;
+    glossed_string GuaranteedValuesFootnote;
+    glossed_string CreditingRateFootnote;
+    glossed_string MecFootnote;
+    glossed_string MidpointValuesFootnote;
+    glossed_string SinglePremiumFootnote;
+    glossed_string MonthlyChargesFootnote;
+    glossed_string UltCreditingRateFootnote;
+    glossed_string MaxNaarFootnote;
+    glossed_string PremTaxSurrChgFootnote;
+    glossed_string PolicyFeeFootnote;
+    glossed_string AssetChargeFootnote;
+    glossed_string InvestmentIncomeFootnote;
+    glossed_string IrrDbFootnote;
+    glossed_string IrrCsvFootnote;
+    glossed_string MortalityChargesFootnote;
+    glossed_string LoanAndWithdrawalFootnote;
+    glossed_string PresaleTrackingNumber;
+    glossed_string CompositeTrackingNumber;
+    glossed_string InforceTrackingNumber;
+    glossed_string InforceCompositeTrackingNumber;
+    glossed_string InforceNonGuaranteedFootnote0;
+    glossed_string InforceNonGuaranteedFootnote1;
+    glossed_string InforceNonGuaranteedFootnote2;
+    glossed_string InforceNonGuaranteedFootnote3;
+    glossed_string NonGuaranteedFootnote;
+    glossed_string MonthlyChargesPaymentFootnote;
 };
 
 #endif // product_data_hpp

Modified: lmi/trunk/workhorse.make
===================================================================
--- lmi/trunk/workhorse.make    2010-04-17 12:45:23 UTC (rev 4841)
+++ lmi/trunk/workhorse.make    2010-04-18 21:19:22 UTC (rev 4842)
@@ -543,6 +543,18 @@
   endif
 endif
 
+# An overriding version of 'my_prod.cpp', which is used to create a
+# nondistributable binary, contains so many large strings that, after
+# consuming more than one CPU minute and 1 MiB of RAM, MinGW gcc-3.4.5
+# produces a diagnostic such as
+#   warning: NULL pointer checks disabled:
+#   39933 basic blocks and 167330 registers
+# Adding '-fno-delete-null-pointer-checks' to $(CPPFLAGS) might
+# suffice to suppress the diagnostic, but this file actually doesn't
+# need any optimization at all.
+
+my_prod.o: optimization_flag := -O0
+
 
################################################################################
 
 # Libraries and associated options.





reply via email to

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