lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [5924] Expunge disused code


From: Greg Chicares
Subject: [lmi-commits] [5924] Expunge disused code
Date: Wed, 09 Jul 2014 14:37:37 +0000

Revision: 5924
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=5924
Author:   chicares
Date:     2014-07-09 14:37:35 +0000 (Wed, 09 Jul 2014)
Log Message:
-----------
Expunge disused code

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/ihs_server7702.cpp
    lmi/trunk/ihs_server7702.hpp
    lmi/trunk/ihs_server7702io.cpp
    lmi/trunk/ihs_server7702io.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2014-07-09 12:32:44 UTC (rev 5923)
+++ lmi/trunk/ChangeLog 2014-07-09 14:37:35 UTC (rev 5924)
@@ -33970,3 +33970,16 @@
 Eradicate the 'gpt_server' binary. Its associated tests have recently
 been rendered merely duplicative.
 
+20140709T1232Z <address@hidden> [537]
+
+  ihs_server7702io.cpp
+Resolve several marked defects in obsolescent code.
+
+20140709T1437Z <address@hidden> [534]
+
+  ihs_server7702.cpp
+  ihs_server7702.hpp
+  ihs_server7702io.cpp
+  ihs_server7702io.hpp
+Expunge disused code.
+

Modified: lmi/trunk/ihs_server7702.cpp
===================================================================
--- lmi/trunk/ihs_server7702.cpp        2014-07-09 12:32:44 UTC (rev 5923)
+++ lmi/trunk/ihs_server7702.cpp        2014-07-09 14:37:35 UTC (rev 5924)
@@ -36,102 +36,19 @@
 #include "basic_values.hpp"
 #include "fenv_lmi.hpp"
 #include "gpt_xml_document.hpp"
-#include "handle_exceptions.hpp"
 #include "ihs_irc7702.hpp"
 #include "ihs_server7702io.hpp"
 #include "ihs_x_type.hpp"
-#include "miscellany.hpp"               // ios_out_trunc_binary()
-#include "path_utility.hpp"             // initialize_filesystem()
 
-#include <cstdlib>
 #include <exception>
-#include <fstream>
-#include <iostream>
-#include <string>
 
 //============================================================================
-int main()
-{
-    std::set_terminate(lmi_terminate_handler);
-    try
-        {
-        // Absolute paths require "native" name-checking policy for msw.
-        initialize_filesystem();
-        InitializeServer7702();
-        // Read from std input, process, and write to std output
-        return RunServer7702();
-// TODO ?? NEED DECISION What should this return?
-        }
-    catch(...)
-        {
-        report_exception();
-        }
-}
-
-//============================================================================
 void EnterServer()
 {
     fenv_initialize();
 }
 
 //============================================================================
-// TODO ?? Should we make the directory an optional argument?
-void InitializeServer7702()
-{
-    // Data directory where tables etc. are stored
-// TODO ?? This is obsolete; need a replacement. Either let main()
-// take care of it, or copy main()'s initialization code here.
-//    DataDir::Get("./");
-}
-
-//============================================================================
-// Read from std input, process, and write to std output
-int RunServer7702()
-{
-    EnterServer();
-    // Input record (we'll use it over and over)
-    Server7702Input input;
-    try
-        {
-        while(std::cin >> input)
-            {
-            // Run testdeck to validate this chain of conversions:
-            //   Server7702Input --> gpt_input --> Server7702Input
-            std::string f = input.UniqueIdentifier + ".gpt";
-            std::ofstream ofs_input(f.c_str(), ios_out_trunc_binary());
-            gpt_input z = input.operator gpt_input();
-            gpt_xml_document x(z);
-            x.write(ofs_input);
-            Server7702Input y(z);
-            Server7702 contract(y);
-            contract.Process();
-            std::cout << contract.GetOutput();
-            f += ".txt";
-            std::ofstream ofs_output(f.c_str(), ios_out_trunc_binary());
-            ofs_output << contract.GetOutput();
-            while('\n' == std::cin.peek())
-                {
-                std::cin.get();
-                }
-            if(std::cin.eof())
-                {
-                return EXIT_SUCCESS;
-                }
-            }
-        }
-    // Catch exceptions that are thrown during input
-    catch(std::exception const& e)
-        {
-        warning() << input.UniqueIdentifier << " error: " << e.what() << 
LMI_FLUSH;
-        }
-    catch(...)
-        {
-        warning() << "Untrapped exception" << LMI_FLUSH;
-        }
-    return EXIT_FAILURE;
-}
-
-//============================================================================
 // Read from C struct, and return a different C struct
 Server7702Output RunServer7702FromStruct(Server7702Input a_Input)
 {

Modified: lmi/trunk/ihs_server7702.hpp
===================================================================
--- lmi/trunk/ihs_server7702.hpp        2014-07-09 12:32:44 UTC (rev 5923)
+++ lmi/trunk/ihs_server7702.hpp        2014-07-09 14:37:35 UTC (rev 5924)
@@ -32,11 +32,8 @@
 #include <stdexcept>
 #include <string>
 
-int RunServer7702();
-
 extern "C"
 {
-    void LMI_SO InitializeServer7702();
     Server7702Output LMI_SO RunServer7702FromStruct(Server7702Input a_Input);
 }
 

Modified: lmi/trunk/ihs_server7702io.cpp
===================================================================
--- lmi/trunk/ihs_server7702io.cpp      2014-07-09 12:32:44 UTC (rev 5923)
+++ lmi/trunk/ihs_server7702io.cpp      2014-07-09 14:37:35 UTC (rev 5924)
@@ -31,189 +31,6 @@
 #include "assert_lmi.hpp"
 #include "value_cast.hpp"
 
-#include <iomanip>
-#include <ios>
-#include <istream>
-#include <ostream>
-#include <sstream>
-#include <string>
-
-// NEED DECISION on i/o representation. (New code writes as many
-// decimal digits as are significant.)
-//#include <limits>
-namespace
-{
-    static int const prec = 20;
-//      std::numeric_limits<double>::digits10;
-}
-
-// Sample input record (concatenate the two lines):
-// 123456789 1 0 0 0 10000 0 .02 0 1000000 1000000 0 0 0 1000000
-// 45 45 0 0 0 0 0 0 1000000 1000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-
-// It would be better to perform range checking on bool input. (New
-// code accomplishes that by using enumerative types.)
-
-//============================================================================
-std::istream& operator>> (std::istream& is, Server7702Input& z)
-{
-    // Use of std::stringstream here is a kludge. That doesn't matter
-    // because this obsolescent code will soon be removed.
-    std::string s;
-    std::stringstream ss;
-
-    is >> z.UniqueIdentifier;
-    is >> z.IsIssuedToday;
-    is >> z.Duration;
-    is >> z.GrossNontaxableWithdrawal;
-    is >> z.Premium;
-    is >> z.DecreaseRequiredByContract;
-    is >> z.ProductName;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.UnderwritingBasis;
-    is >> z.PremTaxLoadRate;
-    is >> z.TieredAssetChargeRate;
-    is >> z.LeastBenefitAmountEver;
-//    is >> z.TargetPremium; // Apparently this came at the end long ago.
-    is >> z.OldGuidelineLevelPremium;
-    is >> z.OldGuidelineSinglePremium;
-    is >> z.NewIssueAge;
-    is >> z.OldIssueAge;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewGender;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldGender;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewSmoker;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldSmoker;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewUnderwritingClass;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldUnderwritingClass;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewStateOfJurisdiction;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldStateOfJurisdiction;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewDeathBenefitOption;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldDeathBenefitOption;
-    is >> z.NewBenefitAmount;
-    is >> z.OldBenefitAmount;
-    is >> z.NewSpecifiedAmount;
-    is >> z.OldSpecifiedAmount;
-    is >> z.NewTermAmount;
-    is >> z.OldTermAmount;
-    is >> z.NewWaiverOfPremiumInForce;
-    is >> z.OldWaiverOfPremiumInForce;
-    is >> z.NewPremiumsWaived;
-    is >> z.OldPremiumsWaived;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewWaiverOfPremiumRating;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldWaiverOfPremiumRating;
-    is >> z.NewAccidentalDeathInForce;
-    is >> z.OldAccidentalDeathInForce;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewAccidentalDeathRating;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldAccidentalDeathRating;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.NewTableRating;
-    s.clear(); ss.clear(); ss.str(""); is >> std::ws; is >> s; ss << s; ss >> 
z.OldTableRating;
-
-    // I give the names with a suffix "0" here,
-    // but they need to be repeated with "1", "2",
-    // and so on for as many flats as permitted.
-    // NEED DECISION how many is that? --assume it's 3 (New code more
-    // flexibly uses input sequences.)
-    is >> z.NewPermanentFlatAmount0;
-    is >> z.OldPermanentFlatAmount0;
-    is >> z.NewPermanentFlatAmount1;
-    is >> z.OldPermanentFlatAmount1;
-    is >> z.NewPermanentFlatAmount2;
-    is >> z.OldPermanentFlatAmount2;
-    is >> z.NewTemporaryFlatAmount0;
-    is >> z.OldTemporaryFlatAmount0;
-    is >> z.NewTemporaryFlatAmount1;
-    is >> z.OldTemporaryFlatAmount1;
-    is >> z.NewTemporaryFlatAmount2;
-    is >> z.OldTemporaryFlatAmount2;
-    is >> z.NewTemporaryFlatDuration0;
-    is >> z.OldTemporaryFlatDuration0;
-    is >> z.NewTemporaryFlatDuration1;
-    is >> z.OldTemporaryFlatDuration1;
-    is >> z.NewTemporaryFlatDuration2;
-    is >> z.OldTemporaryFlatDuration2;
-
-    is >> z.TargetPremium; // Apparently this came at the end long ago.
-
-    return is;
-}
-
-//============================================================================
-std::ostream& operator<< (std::ostream& os, Server7702Input const& z)
-{
-    os << std::setiosflags(std::ios_base::fixed) << std::setprecision(prec);
-
-    os << z.UniqueIdentifier;
-    os << ' ' << z.IsIssuedToday;
-    os << ' ' << z.Duration;
-    os << ' ' << z.GrossNontaxableWithdrawal;
-    os << ' ' << z.Premium;
-    os << ' ' << z.DecreaseRequiredByContract;
-    os << ' ' << z.ProductName;
-    os << ' ' << z.UnderwritingBasis;
-    os << ' ' << z.PremTaxLoadRate;
-    os << ' ' << z.TieredAssetChargeRate;
-    os << ' ' << z.LeastBenefitAmountEver;
-    os << ' ' << z.OldGuidelineLevelPremium;
-    os << ' ' << z.OldGuidelineSinglePremium;
-    os << ' ' << z.NewIssueAge;
-    os << ' ' << z.OldIssueAge;
-    os << ' ' << z.NewGender;
-    os << ' ' << z.OldGender;
-    os << ' ' << z.NewSmoker;
-    os << ' ' << z.OldSmoker;
-    os << ' ' << z.NewUnderwritingClass;
-    os << ' ' << z.OldUnderwritingClass;
-    os << ' ' << z.NewStateOfJurisdiction;
-    os << ' ' << z.OldStateOfJurisdiction;
-    os << ' ' << z.NewDeathBenefitOption;
-    os << ' ' << z.OldDeathBenefitOption;
-    os << ' ' << z.NewBenefitAmount;
-    os << ' ' << z.OldBenefitAmount;
-    os << ' ' << z.NewSpecifiedAmount;
-    os << ' ' << z.OldSpecifiedAmount;
-    os << ' ' << z.NewTermAmount;
-    os << ' ' << z.OldTermAmount;
-    os << ' ' << z.NewWaiverOfPremiumInForce;
-    os << ' ' << z.OldWaiverOfPremiumInForce;
-    os << ' ' << z.NewPremiumsWaived;
-    os << ' ' << z.OldPremiumsWaived;
-    os << ' ' << z.NewWaiverOfPremiumRating;
-    os << ' ' << z.OldWaiverOfPremiumRating;
-    os << ' ' << z.NewAccidentalDeathInForce;
-    os << ' ' << z.OldAccidentalDeathInForce;
-    os << ' ' << z.NewAccidentalDeathRating;
-    os << ' ' << z.OldAccidentalDeathRating;
-    os << ' ' << z.NewTableRating;
-    os << ' ' << z.OldTableRating;
-
-    // I give the names with a suffix "0" here,
-    // but they need to be repeated with "1", "2",
-    // and so on for as many flats as permitted
-    // (how many is that?).
-    os << ' ' << z.NewPermanentFlatAmount0;
-    os << ' ' << z.OldPermanentFlatAmount0;
-    os << ' ' << z.NewPermanentFlatAmount1;
-    os << ' ' << z.OldPermanentFlatAmount1;
-    os << ' ' << z.NewPermanentFlatAmount2;
-    os << ' ' << z.OldPermanentFlatAmount2;
-    os << ' ' << z.NewTemporaryFlatAmount0;
-    os << ' ' << z.OldTemporaryFlatAmount0;
-    os << ' ' << z.NewTemporaryFlatAmount1;
-    os << ' ' << z.OldTemporaryFlatAmount1;
-    os << ' ' << z.NewTemporaryFlatAmount2;
-    os << ' ' << z.OldTemporaryFlatAmount2;
-    os << ' ' << z.NewTemporaryFlatDuration0;
-    os << ' ' << z.OldTemporaryFlatDuration0;
-    os << ' ' << z.NewTemporaryFlatDuration1;
-    os << ' ' << z.OldTemporaryFlatDuration1;
-    os << ' ' << z.NewTemporaryFlatDuration2;
-    os << ' ' << z.OldTemporaryFlatDuration2;
-
-    os << ' ' << z.TargetPremium;
-
-    os << std::endl;
-    return os;
-}
-
 Server7702Input::Server7702Input()
 {
     // Do nothing.
@@ -337,49 +154,3 @@
     return z;
 }
 
-//============================================================================
-std::istream& operator>> (std::istream& is, Server7702Output& z)
-{
-    is >> z.UniqueIdentifier;
-    is >> z.Status;
-    is >> z.AdjustableEventOccurred;
-    is >> z.GuidelineLevelPremium;
-    is >> z.GuidelineSinglePremium;
-    is >> z.GuidelineLevelPremiumPolicyA;
-    is >> z.GuidelineSinglePremiumPolicyA;
-    is >> z.GuidelineLevelPremiumPolicyB;
-    is >> z.GuidelineSinglePremiumPolicyB;
-    is >> z.GuidelineLevelPremiumPolicyC;
-    is >> z.GuidelineSinglePremiumPolicyC;
-
-    return is;
-}
-
-//============================================================================
-std::ostream& operator<< (std::ostream& os, Server7702Output const& z)
-{
-//      << setw(prec + 1 + prec)
-//      << setfill('0')
-//  os.width(prec + 1 + prec);
-//  os.fill('0');
-// NEED DECISION Do they want everything aligned? (New code uses xml.)
-// NEED DECISION If so, what width for each item? (New code uses xml.)
-
-    os << std::setiosflags(std::ios_base::fixed) << std::setprecision(prec);
-
-    os << z.UniqueIdentifier;
-    os << ' ' << z.Status;
-    os << ' ' << z.AdjustableEventOccurred;
-    os << ' ' << z.GuidelineLevelPremium;
-    os << ' ' << z.GuidelineSinglePremium;
-    os << ' ' << z.GuidelineLevelPremiumPolicyA;
-    os << ' ' << z.GuidelineSinglePremiumPolicyA;
-    os << ' ' << z.GuidelineLevelPremiumPolicyB;
-    os << ' ' << z.GuidelineSinglePremiumPolicyB;
-    os << ' ' << z.GuidelineLevelPremiumPolicyC;
-    os << ' ' << z.GuidelineSinglePremiumPolicyC;
-
-    os << std::endl;
-    return os;
-}
-

Modified: lmi/trunk/ihs_server7702io.hpp
===================================================================
--- lmi/trunk/ihs_server7702io.hpp      2014-07-09 12:32:44 UTC (rev 5923)
+++ lmi/trunk/ihs_server7702io.hpp      2014-07-09 14:37:35 UTC (rev 5924)
@@ -30,7 +30,6 @@
 #include "mc_enum.hpp"
 #include "mc_enum_types.hpp"
 
-#include <iosfwd>
 #include <string>
 
 struct Server7702Input
@@ -117,9 +116,6 @@
     double           TargetPremium; // the target premium. The client will 
always calculate and store it.
 };
 
-std::istream& operator>> (std::istream& is, Server7702Input& z);
-std::ostream& operator<< (std::ostream& os, Server7702Input const& z);
-
 struct Server7702Output
 {
     std::string      UniqueIdentifier;              // the same identifier 
supplied as input.
@@ -135,8 +131,5 @@
     double           GuidelineSinglePremiumPolicyC; // the GSP for notional 
policy C; 0.0 at issue or if there has been no adjustable event.
 };
 
-std::istream& operator>> (std::istream& is, Server7702Output& z);
-std::ostream& operator<< (std::ostream& os, Server7702Output const& z);
-
 #endif // ihs_server7702io_hpp
 




reply via email to

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