diff options
feat(Week08): Add solutions
1 files changed, 41 insertions, 0 deletions
| -rw-r--r-- | Week08/Exercise01/Hangar.h | 41 |
diff --git a/Week08/Exercise01/Hangar.h b/Week08/Exercise01/Hangar.h new file mode 100644 index 0000000..29bd5da --- /dev/null +++ b/Week08/Exercise01/Hangar.h @@ -0,0 +1,41 @@ +#ifndef _HANGAR +#define _HANGAR + +#include "RocketStage.h" +#include "Rocket.h" + +class Hangar { + Rocket* rockets; + unsigned rocketsCount; + unsigned rocketsAlloc; + + RocketStage* stages; + unsigned stagesCount; + unsigned stagesAlloc; + + void free(); + void copyFrom(const Hangar& other); + + void resizeRockets(); + void resizeStages(); + +public: + Hangar(); + ~Hangar(); + Hangar(const Hangar& other); + Hangar& operator=(const Hangar& other); + Hangar(Hangar&& other); + Hangar& operator=(Hangar&& other); + + unsigned AddStage(const RocketStage& stage); + RocketStage RemoveStage(unsigned stageIndex); + + unsigned AddRocket(const Rocket& rocket); + const Rocket* GetRocket(unsigned rocketIndex) const; + void MoveStageToRocket(unsigned rocketIndex, unsigned stageIndex); + + void Export(std::ofstream& outFile) const; + void Import(std::ifstream& inFile); +}; + +#endif /* _HANGAR */ |
