diff options
author | sicarius <devnull@localhost> | 2007-02-04 22:38:03 +0100 |
---|---|---|
committer | sicarius <devnull@localhost> | 2007-02-04 22:38:03 +0100 |
commit | 7370f9ab1e76111114602b500ba9217bb7503865 (patch) | |
tree | f33c496109feee9471bf4f58301630f81dee965d /source/Concept | |
parent | 5843f35538639ccfdfcb2d77f11a25bbb7661e4b (diff) | |
download | rc2007-soccer-7370f9ab1e76111114602b500ba9217bb7503865.tar rc2007-soccer-7370f9ab1e76111114602b500ba9217bb7503865.zip |
updated todo.txt;
added some files as .pdf, too
Diffstat (limited to 'source/Concept')
-rw-r--r-- | source/Concept/Framework/atmega128io.h | 2 | ||||
-rw-r--r-- | source/Concept/Framework/defines.h | 2 | ||||
-rw-r--r-- | source/Concept/Framework/engine.h | 2 | ||||
-rw-r--r-- | source/Concept/Framework/io_module.h | 2 | ||||
-rw-r--r-- | source/Concept/Framework/main.cpp | 4 | ||||
-rw-r--r-- | source/Concept/Framework/robot.cpp | 31 | ||||
-rw-r--r-- | source/Concept/Framework/robot.h | 33 | ||||
-rw-r--r-- | source/Concept/Framework/sensor.h | 2 | ||||
-rw-r--r-- | source/Concept/Framework/stdafx.h | 8 |
9 files changed, 44 insertions, 42 deletions
diff --git a/source/Concept/Framework/atmega128io.h b/source/Concept/Framework/atmega128io.h index 46d0f69..94912b6 100644 --- a/source/Concept/Framework/atmega128io.h +++ b/source/Concept/Framework/atmega128io.h @@ -6,4 +6,4 @@ namespace hardware };
-#endif
\ No newline at end of file +#endif diff --git a/source/Concept/Framework/defines.h b/source/Concept/Framework/defines.h index 698163a..fd07125 100644 --- a/source/Concept/Framework/defines.h +++ b/source/Concept/Framework/defines.h @@ -88,4 +88,4 @@ enum IOModuleNames IO_END = IO_SENSOR_END,
};
-#endif
\ No newline at end of file +#endif diff --git a/source/Concept/Framework/engine.h b/source/Concept/Framework/engine.h index 406d46e..0b8bfac 100644 --- a/source/Concept/Framework/engine.h +++ b/source/Concept/Framework/engine.h @@ -16,4 +16,4 @@ public: }
};
-#endif
\ No newline at end of file +#endif diff --git a/source/Concept/Framework/io_module.h b/source/Concept/Framework/io_module.h index 8aa7ef7..271f7a7 100644 --- a/source/Concept/Framework/io_module.h +++ b/source/Concept/Framework/io_module.h @@ -26,4 +26,4 @@ public: };
-#endif
\ No newline at end of file +#endif diff --git a/source/Concept/Framework/main.cpp b/source/Concept/Framework/main.cpp index 6305a1e..cf80770 100644 --- a/source/Concept/Framework/main.cpp +++ b/source/Concept/Framework/main.cpp @@ -1,4 +1,4 @@ -#include "stdafx.h"
+#include "stdafx.h" int main()
{
@@ -44,4 +44,4 @@ int main() //Cleanup
delete localRobot;
localRobot = NULL;
-}
\ No newline at end of file +} diff --git a/source/Concept/Framework/robot.cpp b/source/Concept/Framework/robot.cpp index 768554e..24038d3 100644 --- a/source/Concept/Framework/robot.cpp +++ b/source/Concept/Framework/robot.cpp @@ -1,24 +1,31 @@ -#include "robot.h"
+#include "robot.h" + +//-----------------------------------------------------------------------------
+Robot::Robot()
+{
+ memset(modules, NULL, sizeof(modules));
+}
//-----------------------------------------------------------------------------
Robot::~Robot()
-{
- while(!modules.empty())
- {
- moduleMap::iterator iter = modules.begin();
- delete iter->second;
- modules.erase(iter);
+{ + for(uint8 i = 0; i < IO_END; i++) + { + if(!modules[i]) continue; + + delete modules[i]; + modules[i] = NULL; }
}
//-----------------------------------------------------------------------------
bool Robot::AddModule(IO_Module* newModule)
-{
- moduleMap::iterator itr = modules.find(newModule->GetId());
- if(itr != modules.end())
+{ + if(modules[newModule->GetId()]) return false;
- modules[newModule->GetId()] = newModule;
+ modules[newModule->GetId()] = newModule; +
return true;
}
@@ -34,4 +41,4 @@ void Robot::Update() //insert code here
}
-//--- EOF ---
\ No newline at end of file +//--- EOF --- diff --git a/source/Concept/Framework/robot.h b/source/Concept/Framework/robot.h index 543f1ed..db7fe15 100644 --- a/source/Concept/Framework/robot.h +++ b/source/Concept/Framework/robot.h @@ -9,32 +9,29 @@ class Engine; class Robot
{
-public:
+public: + Robot();
~Robot();
private:
- typedef hash_map<uint32, IO_Module*> moduleMap;
- moduleMap modules;
+ IO_Module* modules[IO_END];
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);
+ template <class T> T* GetModule(uint8 moduleId)
+ { + return ((T*)modules[moduleId]);
}
- bool RemoveModule(uint32 moduleId)
- {
- moduleMap::iterator itr = modules.find(moduleId);
- if(itr == modules.end())
- return false;
-
- modules.erase(itr);
+ bool RemoveModule(uint8 moduleId)
+ { + if(!modules[moduleId]) + return false; + + delete modules[moduleId]; + modules[moduleId] = NULL; +
return true;
}
@@ -43,4 +40,4 @@ public: void Update();
};
-#endif
\ No newline at end of file +#endif diff --git a/source/Concept/Framework/sensor.h b/source/Concept/Framework/sensor.h index 23e40e9..15dcdc0 100644 --- a/source/Concept/Framework/sensor.h +++ b/source/Concept/Framework/sensor.h @@ -26,4 +26,4 @@ public: }
};
-#endif
\ No newline at end of file +#endif diff --git a/source/Concept/Framework/stdafx.h b/source/Concept/Framework/stdafx.h index 0a5a81e..d653b9e 100644 --- a/source/Concept/Framework/stdafx.h +++ b/source/Concept/Framework/stdafx.h @@ -1,12 +1,10 @@ -#include <iostream>
#include <stdlib.h>
-#include <string>
-#include <hash_map>
using namespace std;
-#include "defines.h"
+#include "defines.h" +#include "tools.h"
#include "io_module.h"
#include "sensor.h"
#include "engine.h"
-#include "robot.h"
\ No newline at end of file +#include "robot.h" |