46 lines
751 B
C
46 lines
751 B
C
![]() |
#ifndef _ROBOT_H
|
||
|
#define _ROBOT_H
|
||
|
|
||
|
#include "stdafx.h"
|
||
|
|
||
|
class IO_Module;
|
||
|
class Sensor;
|
||
|
class Engine;
|
||
|
|
||
|
class Robot
|
||
|
{
|
||
|
public:
|
||
|
~Robot();
|
||
|
|
||
|
private:
|
||
|
typedef hash_map<uint32, IO_Module*> moduleMap;
|
||
|
moduleMap modules;
|
||
|
|
||
|
public:
|
||
|
bool AddModule(IO_Module* newModule);
|
||
|
|
||
|
template <class T> T* GetModule(uint32 moduleId)
|
||
|
{
|
||
|
moduleMap::const_iterator itr = modules.find(moduleId);
|
||
|
if(itr == modules.end())
|
||
|
return NULL;
|
||
|
else
|
||
|
return ((T*)itr->second);
|
||
|
}
|
||
|
|
||
|
bool RemoveModule(uint32 moduleId)
|
||
|
{
|
||
|
moduleMap::iterator itr = modules.find(moduleId);
|
||
|
if(itr == modules.end())
|
||
|
return false;
|
||
|
|
||
|
modules.erase(itr);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
bool RemoveModule(IO_Module* oldModule);
|
||
|
|
||
|
void Update();
|
||
|
};
|
||
|
|
||
|
#endif
|