-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFalcon9.cpp
More file actions
67 lines (48 loc) · 1.5 KB
/
Falcon9.cpp
File metadata and controls
67 lines (48 loc) · 1.5 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
60
61
62
63
64
65
66
67
#ifndef FALCON_NINE_CPP
#define FALCON_NINE_CPP
#include "Falcon9.h"
Falcon9::Falcon9() : Rocket( "Falcon9" ){
this->core = new Falcon9Core();
this->core->startEngine();
MerlinEngine* eng = new MerlinEngine();
this->engines = new MerlinEngine*[9];
for ( int i = 0; i < 9; i++ ) {
this->engines[ i ] = new MerlinEngine(*eng);
this->engines[ i ]->startEngine();
}
delete eng;
cout << "Falcon 9's 9 engines and the single core have been prepped for use." << endl;
}
Falcon9::~Falcon9(){
for ( int i = 0; i < 9; i++ ) {
if ( this->engines[ i ] ) delete this->engines[ i ];
}
delete [] this->engines;
delete this->core;
this->engines = 0x0;
this->core = 0x0;
}
Falcon9Core* Falcon9::getCore(){
return this->core;
}
MerlinEngine* Falcon9::getEngine( int index ){
return ( index > -1 && index < 3 ) ? this->engines[ index ] : 0x0;
}
bool Falcon9::coreSystemCheck(){
return this->core->isActive();
}
bool Falcon9::engineSystemCheck(){
for ( int i = 0; i < 9; i++ )
if ( !this->engines[ i ]->isActive() ) return false;
return true;
}
void Falcon9::handleRequest(Rocket* pRocket){
if( pRocket->getPayloadType() == "Falcon9" ){
cout << "Falcon9 initialising." << endl;
}
else{
cout << "Incompatible payload. Request could not be handled by Falcon9."<<endl;
Rocket::handleRequest( pRocket );
}
}
#endif