lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [4874] Simplify


From: Greg Chicares
Subject: [lmi-commits] [4874] Simplify
Date: Fri, 30 Apr 2010 17:09:25 +0000

Revision: 4874
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=4874
Author:   chicares
Date:     2010-04-30 17:09:24 +0000 (Fri, 30 Apr 2010)
Log Message:
-----------
Simplify

Modified Paths:
--------------
    lmi/trunk/ihs_basicval.cpp
    lmi/trunk/ihs_dbdict.cpp
    lmi/trunk/ihs_dbvalue.cpp
    lmi/trunk/ihs_dbvalue.hpp

Modified: lmi/trunk/ihs_basicval.cpp
===================================================================
--- lmi/trunk/ihs_basicval.cpp  2010-04-30 14:29:37 UTC (rev 4873)
+++ lmi/trunk/ihs_basicval.cpp  2010-04-30 17:09:24 UTC (rev 4874)
@@ -929,8 +929,6 @@
             << "Premium-tax load varies by state, but differs"
             << " from premium-tax rates. Probably the database"
             << " is incorrect.\n"
-            << "premium_tax_loads:\n" << premium_tax_loads
-            << "premium_tax_rates:\n" << premium_tax_rates
             << LMI_FLUSH
             ;
         }

Modified: lmi/trunk/ihs_dbdict.cpp
===================================================================
--- lmi/trunk/ihs_dbdict.cpp    2010-04-30 14:29:37 UTC (rev 4873)
+++ lmi/trunk/ihs_dbdict.cpp    2010-04-30 17:09:24 UTC (rev 4874)
@@ -696,7 +696,7 @@
         // nicely with std::map (a name-lookup issue).
         for(unsigned int j = 0; j < dictionary.size(); j++)
             {
-            os << dictionary[j];
+            dictionary[j].write(os);
             }
         }
 }

Modified: lmi/trunk/ihs_dbvalue.cpp
===================================================================
--- lmi/trunk/ihs_dbvalue.cpp   2010-04-30 14:29:37 UTC (rev 4873)
+++ lmi/trunk/ihs_dbvalue.cpp   2010-04-30 17:09:24 UTC (rev 4874)
@@ -38,7 +38,6 @@
 
 #include <algorithm>
 #include <functional>
-#include <istream>
 #include <iterator>          // std::advance()
 #include <limits>            // std::numeric_limits
 #include <numeric>
@@ -82,7 +81,8 @@
 {
 }
 
-//============================================================================
+/// Handy ctor for writing programs to generate '.database' files.
+
 TDBValue::TDBValue
     (int                a_key
     ,int                a_ndims
@@ -114,8 +114,8 @@
     ParanoidCheck();
 }
 
-//============================================================================
-// scalar only
+/// Handy ctor for scalar data.
+
 TDBValue::TDBValue
     (int                a_key
     ,double             a_datum
@@ -129,23 +129,24 @@
 }
 
 //============================================================================
-TDBValue::TDBValue(TDBValue const& obj)
-    :key          (obj.key)
-    ,axis_lengths (obj.axis_lengths)
-    ,data_values  (obj.data_values)
-    ,gloss_       (obj.gloss_)
+TDBValue::TDBValue(TDBValue const& z)
+    :obstruct_slicing<TDBValue>()
+    ,key          (z.key)
+    ,axis_lengths (z.axis_lengths)
+    ,data_values  (z.data_values)
+    ,gloss_       (z.gloss_)
 {
 }
 
 //============================================================================
-TDBValue& TDBValue::operator=(TDBValue const& obj)
+TDBValue& TDBValue::operator=(TDBValue const& z)
 {
-    if(this != &obj)
+    if(this != &z)
         {
-        key          = obj.key;
-        axis_lengths = obj.axis_lengths;
-        data_values  = obj.data_values;
-        gloss_       = obj.gloss_;
+        key          = z.key;
+        axis_lengths = z.axis_lengths;
+        data_values  = z.data_values;
+        gloss_       = z.gloss_;
         }
     return *this;
 }
@@ -542,23 +543,6 @@
     scalar marker?
 */
 
-//===========================================================================
-std::istream& operator>>(std::istream& is, TDBValue&)
-{
-    // SOMEDAY !! Someday we should implement this.
-    fatal_error()
-        << "operator>>(std::istream&, TDBValue&) not implemented."
-        << LMI_FLUSH
-        ;
-    return is;
-}
-
-//===========================================================================
-std::ostream& operator<<(std::ostream& os, TDBValue const& z)
-{
-    return z.write(os);
-}
-
 void TDBValue::read(xml::element const& e)
 {
     std::string short_name;

Modified: lmi/trunk/ihs_dbvalue.hpp
===================================================================
--- lmi/trunk/ihs_dbvalue.hpp   2010-04-30 14:29:37 UTC (rev 4873)
+++ lmi/trunk/ihs_dbvalue.hpp   2010-04-30 17:09:24 UTC (rev 4874)
@@ -31,6 +31,7 @@
 #include "config.hpp"
 
 #include "dbindex.hpp"
+#include "obstruct_slicing.hpp"
 #include "so_attributes.hpp"
 #include "xml_lmi_fwd.hpp"
 
@@ -43,9 +44,8 @@
 /// Value of an entry in the database dictionary.
 
 class LMI_SO TDBValue
+    :virtual private obstruct_slicing<TDBValue>
 {
-    friend std::istream& operator>>(std::istream&, TDBValue&);
-    friend std::ostream& operator<<(std::ostream&, TDBValue const&);
     friend struct xml_serialize::xml_io<TDBValue>;
 
   public:
@@ -62,7 +62,6 @@
     enum {e_max_dim_duration  = 100};
 
     TDBValue();
-// TODO ?? Deprecate this interface in favor of the one that takes vectors.
     TDBValue
         (int                a_key
         ,int                a_ndims
@@ -83,8 +82,11 @@
         );
     TDBValue(TDBValue const&);
     TDBValue& operator=(TDBValue const&);
-    virtual ~TDBValue();
+    ~TDBValue();
 
+    double const* operator[](TDBIndex const& a_idx) const;
+    double&       operator[](std::vector<int> const& a_idx);
+
     int GetKey()              const;
     // TODO ?? Isn't the following function useless?
     int GetNDims()            const;
@@ -92,9 +94,6 @@
     int GetLength(int a_axis) const;
     std::vector<int> const& GetAxisLengths() const;
 
-    double const* operator[](TDBIndex const& a_idx) const;
-    double&       operator[](std::vector<int> const& a_idx);
-
     void Reshape(std::vector<int> const& a_dims);
 
     std::ostream& write(std::ostream&) const;





reply via email to

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