lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [6346] Validate run order for all cells


From: Greg Chicares
Subject: [lmi-commits] [6346] Validate run order for all cells
Date: Sat, 10 Oct 2015 19:30:25 +0000

Revision: 6346
          http://svn.sv.gnu.org/viewvc/?view=rev&root=lmi&revision=6346
Author:   chicares
Date:     2015-10-10 19:30:25 +0000 (Sat, 10 Oct 2015)
Log Message:
-----------
Validate run order for all cells

Modified Paths:
--------------
    lmi/trunk/ChangeLog
    lmi/trunk/census_view.cpp
    lmi/trunk/group_values.cpp
    lmi/trunk/illustrator.cpp
    lmi/trunk/illustrator.hpp

Modified: lmi/trunk/ChangeLog
===================================================================
--- lmi/trunk/ChangeLog 2015-10-10 17:13:44 UTC (rev 6345)
+++ lmi/trunk/ChangeLog 2015-10-10 19:30:25 UTC (rev 6346)
@@ -37167,3 +37167,11 @@
 Improve the 20151006T1517Z change. See:
   http://lists.nongnu.org/archive/html/lmi/2015-10/msg00029.html
 
+20151010T1930Z <address@hidden> [472]
+
+  census_view.cpp
+  group_values.cpp
+  illustrator.cpp
+  illustrator.hpp
+Validate run order for all cells.
+

Modified: lmi/trunk/census_view.cpp
===================================================================
--- lmi/trunk/census_view.cpp   2015-10-10 17:13:44 UTC (rev 6345)
+++ lmi/trunk/census_view.cpp   2015-10-10 19:30:25 UTC (rev 6346)
@@ -1423,7 +1423,7 @@
 
 bool CensusView::DoAllCells(mcenum_emission emission)
 {
-    assert_consistency(case_parms()[0], cell_parms()[0]);
+    assert_consistent_run_order(case_parms()[0], cell_parms());
 
     illustrator z(emission);
     if(!z(base_filename(), cell_parms()))

Modified: lmi/trunk/group_values.cpp
===================================================================
--- lmi/trunk/group_values.cpp  2015-10-10 17:13:44 UTC (rev 6345)
+++ lmi/trunk/group_values.cpp  2015-10-10 19:30:25 UTC (rev 6346)
@@ -709,6 +709,9 @@
             )
         );
 
+    // Use the first cell's run order for the entire census, ignoring
+    // any conflicting run order for any other cell--which would have
+    // been prevented upstream by assert_consistent_run_order().
     mcenum_run_order order = yare_input(cells[0]).RunOrder;
     switch(order)
         {

Modified: lmi/trunk/illustrator.cpp
===================================================================
--- lmi/trunk/illustrator.cpp   2015-10-10 17:13:44 UTC (rev 6345)
+++ lmi/trunk/illustrator.cpp   2015-10-10 19:30:25 UTC (rev 6346)
@@ -69,7 +69,7 @@
         {
         Timer timer;
         multiple_cell_document doc(file_path.string());
-        assert_consistency(doc.case_parms()[0], doc.cell_parms()[0]);
+        assert_consistent_run_order(doc.case_parms()[0], doc.cell_parms());
         seconds_for_input_ = timer.stop().elapsed_seconds();
         return operator()(file_path, doc.cell_parms());
         }
@@ -236,30 +236,31 @@
     return user_default;
 }
 
-/// Throw if an inconsistency is detected between a cell and its
-/// corresponding case default.
+/// Throw if run order for any cell does not match case default.
 ///
-/// The run order depends on the first cell's parameters and ignores
-/// any conflicting input for any individual cell. It might be cleaner
-/// to offer this field (and certain others) only at the case level.
-///
-/// TODO ?? Instead, this should be enforced when data is entered.
+/// If lmi had case-only input fields, run order would be one of them.
 
-void assert_consistency
-    (Input const& case_default
-    ,Input const& cell
+void assert_consistent_run_order
+    (Input              const& case_default
+    ,std::vector<Input> const& cells
     )
 {
-    if(case_default["RunOrder"] != cell["RunOrder"])
+    typedef std::vector<Input>::size_type svst;
+    for(svst i = 0; i != cells.size(); ++i)
         {
-        fatal_error()
-            << "Case-default run order '"
-            << case_default["RunOrder"]
-            << "' differs from first cell's run order '"
-            << cell["RunOrder"]
-            << "'. Make them consistent before running illustrations."
-            << LMI_FLUSH
-            ;
+        if(case_default["RunOrder"] != cells[i]["RunOrder"])
+            {
+            fatal_error()
+                << "Case-default run order '"
+                << case_default["RunOrder"]
+                << "' differs from run order '"
+                << cells[i]["RunOrder"]
+                << "' of cell number "
+                << 1 + i
+                << ". Make this consistent before running illustrations."
+                << LMI_FLUSH
+                ;
+            }
         }
 }
 

Modified: lmi/trunk/illustrator.hpp
===================================================================
--- lmi/trunk/illustrator.hpp   2015-10-10 17:13:44 UTC (rev 6345)
+++ lmi/trunk/illustrator.hpp   2015-10-10 19:30:25 UTC (rev 6346)
@@ -73,9 +73,9 @@
 
 Input const& LMI_SO default_cell();
 
-void LMI_SO assert_consistency
-    (Input const& case_default
-    ,Input const& cell
+void LMI_SO assert_consistent_run_order
+    (Input              const& case_default
+    ,std::vector<Input> const& cells
     );
 
 #endif // illustrator_hpp




reply via email to

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