-
Notifications
You must be signed in to change notification settings - Fork 2
/
car.cpp
executable file
·42 lines (34 loc) · 1.04 KB
/
car.cpp
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
#include "car.h"
Car::Car()
{
this->m_opticalBlock[OpticalBlock::FRONT_LEFT] = new FrontLeftOpticalBlock();
this->m_opticalBlock[OpticalBlock::FRONT_RIGHT] = new FrontRightOpticalBlock();
this->m_opticalBlock[OpticalBlock::REAR_LEFT] = new RearLeftOpticalBlock();
this->m_opticalBlock[OpticalBlock::REAR_RIGHT] = new RearRightOpticalBlock();
for (int i=0; i<4; i++)
this->m_canModul[i]= new CanModul(this->m_opticalBlock[i]);
}
Car::~Car()
{
/* ????
delete [] this->m_canModul;
delete [] this->m_opticalBlock;
*/
}
int Car::getLightState(int p_position, int p_light)
{
return this->m_canModul[p_position]->getLightState(p_light);
}
Light * Car::getLight(int p_position, int p_light)
{
return this->m_opticalBlock[p_position]->getLight(p_light);
}
bool Car::getError(int p_position, int p_mask)
{
return this->m_canModul[p_position]->getError(p_mask);
}
void Car::acceptCanMessage(CanMessage p_canMessage)
{
for (int i=0; i<4; i++)
this->m_canModul[i]->acceptCanMessage(p_canMessage);
}