Forráskód Böngészése

fixes max-events being ignored

Caleb Fangmeier 7 éve
szülő
commit
3e5976dd50
1 módosított fájl, 6 hozzáadás és 2 törlés
  1. 6 2
      include/dataset.hpp

+ 6 - 2
include/dataset.hpp

@@ -44,7 +44,7 @@ namespace fv {
 
 /*
  * A DataSet is a generic source of data that is used to populate
- * ObservedValues. For each ObservedValue, it is recommened that the DataSet
+ * ObservedValues. For each ObservedValue, it is recommended that the DataSet
  * have a field whose value is updated when the load_next() method is called. A
  * pointer to this value is then passed during the creation of the
  * ObservedValue. It is important, therefore, that the location in memory of
@@ -110,10 +110,14 @@ namespace fv {
         virtual void save_config() = 0;
 
     public:
+        DataSet() {
+            max_events = fv_util::the_config->get_max_events();
+        }
+
         bool next(bool verbose=true) {
             int current_event = get_current_event();
             if (current_event == 0) gettimeofday(&start_time, nullptr);
-            if (verbose and (((current_event + 1) % 500) == 0)) print_status();
+            if (verbose and (((current_event + 1) % 500) == 0 or current_event+1 == max_events)) print_status();
             if (max_events && current_event + 1 >= max_events) return false;
             GenValue::reset();
             return load_next();