Website Summary Files Commits Branches @commit @diff @stats
path: root / Week08 / Exercise01 / Hangar.h
diff options
context:
space:
mode:
Commit7d98b664c9e459a08f2e6e6fa5b636686dfed554 (patch)
Author
 Syndamia <kamen@syndamia.com>
2026-04-08 10:42:51 +0300
Committer
 Syndamia <kamen@syndamia.com>
2026-04-08 10:42:51 +0300
Filesb2b6eddb0c6f582999ebb32c8dea2a01b477d747 /Week08/Exercise01/Hangar.h
oop-2025-solutions-7d98b664c9e459a08f2e6e6fa5b636686dfed554.tar
oop-2025-solutions-7d98b664c9e459a08f2e6e6fa5b636686dfed554.tar.gz
oop-2025-solutions-7d98b664c9e459a08f2e6e6fa5b636686dfed554.zip
Parent945f7e67d6ca8047c961457786fac5e2d9a13d82 (diff)
feat(Week08): Add solutions
1 files changed, 41 insertions, 0 deletions
-rw-r--r--Week08/Exercise01/Hangar.h41
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 */