-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfleet.hh
More file actions
59 lines (38 loc) · 1.51 KB
/
fleet.hh
File metadata and controls
59 lines (38 loc) · 1.51 KB
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
51
52
53
54
55
56
57
58
59
// Time-stamp: <2016-03-03 09:26:28 dmendyke>
#ifndef __FLEET_HH__
#define __FLEET_HH__
// Required header files
//-----------------------------------------------------------------------------
#include <vector> // std::map
#include "agent.hh" // parsec::agent_t
#include "ship.hh" // parsec::ship_t
// Project namespace
//-----------------------------------------------------------------------------
namespace parsec {
// Wrapper around a fleet - uses std::map
//---------------------------------------------------------------------------
class fleet_t {
public:
fleet_t( const agent_t& ); // main constructor
fleet_t( const fleet_t& ); // copy constructor
virtual ~fleet_t(); // destructor
void attach( ship_t& ); // add a ship to this fleet
void attach( int, int ); // add a number of ships
void destroy( uint64_t ); // destroy a ship in this fleet
auto begin() { return vector_.begin(); };
auto end() { return vector_.end(); };
auto empty() { return vector_.empty(); };
auto size() { return vector_.size(); };
void shuffle();
const agent_t& agent() const { return agent_; };
const ship_t& operator[]( int ) const;
friend std::ostream& operator<<( std::ostream&, const fleet_t& );
protected:
private:
const agent_t& agent_;
std::vector< ship_t > vector_;
}; // end class fleet_t
// dump this fleet to the output stream
std::ostream& operator<<( std::ostream&, const fleet_t& );
}; // end parsec - project NS
#endif // __FLEET_HH__