summaryrefslogtreecommitdiffstats
path: root/dev/a3-earthquake/earthquake_database.h
diff options
context:
space:
mode:
authorMatt Strapp <matt@mattstrapp.net>2021-10-11 20:02:46 -0500
committerMatt Strapp <matt@mattstrapp.net>2021-10-11 20:02:46 -0500
commitaa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf (patch)
treed5049549bcb1fed21d118c200ae40bac7e1ebbcc /dev/a3-earthquake/earthquake_database.h
parentFix gnu's stupidity (diff)
parentPublish a3 (diff)
downloadcsci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.gz
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.bz2
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.lz
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.xz
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.tar.zst
csci4611-aa2a4faf537c9bc7e2e87ff38483e2bf53ed24cf.zip
Merge branch 'support-code' of github.umn.edu:umn-csci-4611-f21/shared-upstream
Diffstat (limited to '')
-rw-r--r--dev/a3-earthquake/earthquake_database.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/dev/a3-earthquake/earthquake_database.h b/dev/a3-earthquake/earthquake_database.h
new file mode 100644
index 0000000..026e454
--- /dev/null
+++ b/dev/a3-earthquake/earthquake_database.h
@@ -0,0 +1,50 @@
+/** CSci-4611 Assignment 3: Earthquake
+ */
+
+#ifndef EARTHQUAKEDATABASE_H_
+#define EARTHQUAKEDATABASE_H_
+
+#include <string>
+#include <vector>
+
+#include "earthquake.h"
+#include "date.h"
+
+/** A database of earthquakes created by loading from a data file.
+ */
+class EarthquakeDatabase {
+public:
+ /// Creates an empty EarthquakeDatabase
+ EarthquakeDatabase() {}
+
+ /// Creates an EarthquakeDatabase from file
+ EarthquakeDatabase(std::string filename);
+
+ /// Returns the index of the most recent earthquake as of given date
+ int FindMostRecentQuake(Date d);
+
+ /// Returns Earthquake given index in file
+ Earthquake earthquake(int index);
+
+ /// Returns minimum index. Note that this is not zero!
+ int min_index();
+
+ /// Returns maximum valid index. Running
+ /// getByIndex(getMaxIndex()) WILL return the last earthquake in the file
+ int max_index();
+
+ /// Returns the magnitude of the earthquake with the largest magnitude
+ /// in the database
+ float max_magnitude();
+
+ /// Returns the magnitude of the earthquake with the smallest magnitude
+ /// in the database
+ float min_magnitude();
+
+protected:
+ std::vector<Earthquake> earthquakes;
+ float min_mag_;
+ float max_mag_;
+};
+
+#endif