aboutsummaryrefslogtreecommitdiffstats
path: root/dev/a3-earthquake/earthquake_database.h
blob: 026e454a1f7a6736a326b77d62bc49244129729c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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