Website Summary Files Commits Branches @commit @diff @stats
path: root / Week08 / Exercise01 / Rocket.h
blob: 90ab2c7ad4328c23f9ee26f17e9465d26535cb18 (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
#ifndef _ROCKET
#define _ROCKET

#include "RocketStage.h"
#include <fstream>

class Rocket {
	char name[512];
	RocketStage* stages;
	unsigned stagesCount;
	unsigned stagesAlloc;

	void free();
	void copyFrom(const Rocket& other);

	void resize();

public:
	Rocket();
	~Rocket();
	Rocket(const Rocket& other);
	Rocket& operator=(const Rocket& other);
	Rocket(Rocket&& other);
	Rocket& operator=(Rocket&& other);

	void SetName(const char* name);
	void AddStage(const RocketStage& stage);

	double TotalWeight() const;
	unsigned TotalHeight() const;
	double FinalStageSpeed() const;
	double TotalDistanceTravel() const;
	unsigned TotalBurnTime() const;

	void Export(std::ofstream& outFile) const;
	void Import(std::ifstream& inFile);
};

#endif /* _ROCKET */