|
Data Structures & Algorithms in C++
Goodrich, Tamassia, Mount and Goldwasser
|
Class for storing high scores ordered within an array. More...
#include <scoreboard.h>

Public Member Functions | |
| Scoreboard (int cap=10) | |
| void | add (int score, const std::string &name) |
| GameEntry | remove (int i) |
| int | get_capacity () const |
| int | get_num_entries () const |
| const GameEntry & | get_entry (int i) const |
| Scoreboard (const Scoreboard &other) | |
| Copy constructor. | |
| Scoreboard & | operator= (const Scoreboard &other) |
| Copy assignment. | |
| Scoreboard (Scoreboard &&other) | |
| Move constructor. | |
| Scoreboard & | operator= (Scoreboard &&other) |
| Move assignment. | |
| ~Scoreboard () | |
| destructor | |
Class for storing high scores ordered within an array.
|
inline |
Constructs an empty scoreboard with the given capacity for storing entries The default capacity is 10.
| cap | the desired capacity for the scoreboard |
|
inline |
Copy constructor.
|
inline |
Move constructor.
|
inline |
destructor
| void dsac::array::Scoreboard::add | ( | int | score, |
| const std::string & | name | ||
| ) |
Attempts to add a new score to the scoreboard (if it is high enough)
| int | score |
| string | name |
|
inline |
Returns the capacity of the scoreboard
Returns a reference to the entry at index i
| i | index such that 0 <= i < getNumEntries() |
|
inline |
Returns the number of current entries stored
|
inline |
Copy assignment.
|
inline |
Move assignment.
Removes and returns the scoreboard entry at index i
| i | index within scoreboard |
| out_of_range | if not 0 <= i < get_num_entries() |