summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/robot.cpp
blob: f982be694485c99461c8f55e0003de99811c536e (plain)
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
#include "robot.h"

//-----------------------------------------------------------------------------
Robot::Robot()
{
	memset(modules, NULL, sizeof(modules));
}

//-----------------------------------------------------------------------------
Robot::~Robot()
{
	for(uint8 i = 0; i < IO_END; i++)
	{
		if(!modules[i]) continue;

		delete modules[i];
		modules[i] = NULL;
	}
}

//-----------------------------------------------------------------------------
bool Robot::AddModule(IO_Module* newModule)
{
	if(modules[newModule->GetId()])
		return false;

	newModule->SetParent(this);

	modules[newModule->GetId()] = newModule;

	return true;
}

//-----------------------------------------------------------------------------
bool Robot::RemoveModule(IO_Module* oldModule)
{
	return RemoveModule(oldModule->GetId());
}

//-----------------------------------------------------------------------------
void Robot::Update()
{
	//insert code here
}

//--- EOF ---