From 79115386afc1dee957f77e9a82b5b9b2c5f347e6 Mon Sep 17 00:00:00 2001 From: sicarius Date: Tue, 16 Jan 2007 16:10:05 +0000 Subject: Changed some things in Concept directory --- source/Concept/Concept.vcproj | 208 -------------------------------- source/Concept/Design.odg | Bin 0 -> 15336 bytes source/Concept/Framework/Concept.vcproj | 208 ++++++++++++++++++++++++++++++++ source/Concept/Framework/defines.h | 91 ++++++++++++++ source/Concept/Framework/engine.cpp | 1 + source/Concept/Framework/engine.h | 19 +++ source/Concept/Framework/io_module.cpp | 1 + source/Concept/Framework/io_module.h | 29 +++++ source/Concept/Framework/main.cpp | 47 ++++++++ source/Concept/Framework/module.cpp | 0 source/Concept/Framework/module.h | 0 source/Concept/Framework/robot.cpp | 37 ++++++ source/Concept/Framework/robot.h | 46 +++++++ source/Concept/Framework/sensor.cpp | 1 + source/Concept/Framework/sensor.h | 29 +++++ source/Concept/Framework/stdafx.h | 12 ++ source/Concept/defines.h | 91 -------------- source/Concept/engine.cpp | 1 - source/Concept/engine.h | 19 --- source/Concept/io_module.cpp | 1 - source/Concept/io_module.h | 29 ----- source/Concept/main.cpp | 47 -------- source/Concept/module.cpp | 0 source/Concept/module.h | 0 source/Concept/robot.cpp | 37 ------ source/Concept/robot.h | 46 ------- source/Concept/sensor.cpp | 1 - source/Concept/sensor.h | 29 ----- source/Concept/stdafx.h | 12 -- 29 files changed, 521 insertions(+), 521 deletions(-) delete mode 100644 source/Concept/Concept.vcproj create mode 100644 source/Concept/Design.odg create mode 100644 source/Concept/Framework/Concept.vcproj create mode 100644 source/Concept/Framework/defines.h create mode 100644 source/Concept/Framework/engine.cpp create mode 100644 source/Concept/Framework/engine.h create mode 100644 source/Concept/Framework/io_module.cpp create mode 100644 source/Concept/Framework/io_module.h create mode 100644 source/Concept/Framework/main.cpp create mode 100644 source/Concept/Framework/module.cpp create mode 100644 source/Concept/Framework/module.h create mode 100644 source/Concept/Framework/robot.cpp create mode 100644 source/Concept/Framework/robot.h create mode 100644 source/Concept/Framework/sensor.cpp create mode 100644 source/Concept/Framework/sensor.h create mode 100644 source/Concept/Framework/stdafx.h delete mode 100644 source/Concept/defines.h delete mode 100644 source/Concept/engine.cpp delete mode 100644 source/Concept/engine.h delete mode 100644 source/Concept/io_module.cpp delete mode 100644 source/Concept/io_module.h delete mode 100644 source/Concept/main.cpp delete mode 100644 source/Concept/module.cpp delete mode 100644 source/Concept/module.h delete mode 100644 source/Concept/robot.cpp delete mode 100644 source/Concept/robot.h delete mode 100644 source/Concept/sensor.cpp delete mode 100644 source/Concept/sensor.h delete mode 100644 source/Concept/stdafx.h (limited to 'source') diff --git a/source/Concept/Concept.vcproj b/source/Concept/Concept.vcproj deleted file mode 100644 index 61c34c2..0000000 --- a/source/Concept/Concept.vcproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/source/Concept/Design.odg b/source/Concept/Design.odg new file mode 100644 index 0000000..c225d1b Binary files /dev/null and b/source/Concept/Design.odg differ diff --git a/source/Concept/Framework/Concept.vcproj b/source/Concept/Framework/Concept.vcproj new file mode 100644 index 0000000..61c34c2 --- /dev/null +++ b/source/Concept/Framework/Concept.vcproj @@ -0,0 +1,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/source/Concept/Framework/defines.h b/source/Concept/Framework/defines.h new file mode 100644 index 0000000..698163a --- /dev/null +++ b/source/Concept/Framework/defines.h @@ -0,0 +1,91 @@ +#ifndef _DEFINES_H +#define _DEFINES_H + +#ifndef NULL +#define NULL 0 +#endif + +//Integer definition +#ifndef int8 + #ifdef __int8 + #define int8 __int8 + #else + #define int8 char + #endif +#endif + +#ifndef int16 + #ifdef __int16 + #define int16 __int16 + #else + #define int16 int + #endif +#endif + +#ifndef int32 + #ifdef __int32 + #define int32 __int32 + #else + #define int32 long + #endif +#endif + +#ifndef int64 + #ifdef __int64 + #define int64 __int64 + #else + #define int64 long long + #endif +#endif + +//Unsigned +#ifndef uint8 +#define uint8 unsigned int8 +#endif + +#ifndef uint16 +#define uint16 unsigned int16 +#endif + +#ifndef uint32 +#define uint32 unsigned int32 +#endif + +#ifndef uint64 +#define uint64 unsigned int64 +#endif + +//Sensor types +enum SensorTypes +{ + SENSOR_TYPE_ANALOG, + SENSOR_TYPE_DIGITAL, +}; + +//IO Module Names +enum IOModuleNames +{ + //General + IO_START, + + //Engines + IO_ENGINE_START = IO_START, + + IO_ENGINE_DRIVE_LEFT = IO_ENGINE_START, + IO_ENGINE_DRIVE_RIGHT, + IO_ENGINE_DRIVE_BACK, + + IO_ENGINE_END, + + //Sensors + IO_SENSOR_START = IO_ENGINE_END, + + IO_SENSOR_MOUSE = IO_SENSOR_START, + + IO_SENSOR_END, + + //General + IO_END = IO_SENSOR_END, +}; + +#endif \ No newline at end of file diff --git a/source/Concept/Framework/engine.cpp b/source/Concept/Framework/engine.cpp new file mode 100644 index 0000000..11856cc --- /dev/null +++ b/source/Concept/Framework/engine.cpp @@ -0,0 +1 @@ +#include "engine.h" \ No newline at end of file diff --git a/source/Concept/Framework/engine.h b/source/Concept/Framework/engine.h new file mode 100644 index 0000000..406d46e --- /dev/null +++ b/source/Concept/Framework/engine.h @@ -0,0 +1,19 @@ +#ifndef _ENGINE_H +#define _ENGINE_H + +#include "stdafx.h" + +class Engine : public IO_Module +{ +public: + Engine() + { + } + + Engine(uint32 engineId) + { + this->moduleId = engineId; + } +}; + +#endif \ No newline at end of file diff --git a/source/Concept/Framework/io_module.cpp b/source/Concept/Framework/io_module.cpp new file mode 100644 index 0000000..93f78ae --- /dev/null +++ b/source/Concept/Framework/io_module.cpp @@ -0,0 +1 @@ +#include "io_module.h" \ No newline at end of file diff --git a/source/Concept/Framework/io_module.h b/source/Concept/Framework/io_module.h new file mode 100644 index 0000000..8aa7ef7 --- /dev/null +++ b/source/Concept/Framework/io_module.h @@ -0,0 +1,29 @@ +#ifndef _MODULE_H +#define _MODULE_H + +#include "defines.h" + +class IO_Module +{ +public: + IO_Module(uint32 moduleId) + { + this->moduleId = moduleId; + } + + IO_Module(){} + +protected: + uint32 moduleId; + +public: + + uint32 GetId() + { + return moduleId; + } + + +}; + +#endif \ No newline at end of file diff --git a/source/Concept/Framework/main.cpp b/source/Concept/Framework/main.cpp new file mode 100644 index 0000000..6305a1e --- /dev/null +++ b/source/Concept/Framework/main.cpp @@ -0,0 +1,47 @@ +#include "stdafx.h" + +int main() +{ + //Init our robot + Robot* localRobot = new Robot(); + + //Init Engines + for(uint8 i = IO_ENGINE_START; i < IO_ENGINE_END; i++) + { + Engine* newEngine = new Engine(i); + localRobot->AddModule(newEngine); + newEngine = NULL; + } + + //Init Sensors + for(uint8 i = IO_SENSOR_START; i < IO_SENSOR_END; i++) + { + SensorTypes newSensorType; + + switch(i) + { + //Cases when sensor is digital: + // newSensorType = SENSOR_TYPE_DIGITAL; + // break; + + //Other cases + default: + newSensorType = SENSOR_TYPE_ANALOG; + break; + } + + Sensor* newSensor = new Sensor(i, newSensorType); + localRobot->AddModule(newSensor); + newSensor = NULL; + } + + //Run + while(true) + { + localRobot->Update(); + } + + //Cleanup + delete localRobot; + localRobot = NULL; +} \ No newline at end of file diff --git a/source/Concept/Framework/module.cpp b/source/Concept/Framework/module.cpp new file mode 100644 index 0000000..e69de29 diff --git a/source/Concept/Framework/module.h b/source/Concept/Framework/module.h new file mode 100644 index 0000000..e69de29 diff --git a/source/Concept/Framework/robot.cpp b/source/Concept/Framework/robot.cpp new file mode 100644 index 0000000..768554e --- /dev/null +++ b/source/Concept/Framework/robot.cpp @@ -0,0 +1,37 @@ +#include "robot.h" + +//----------------------------------------------------------------------------- +Robot::~Robot() +{ + while(!modules.empty()) + { + moduleMap::iterator iter = modules.begin(); + delete iter->second; + modules.erase(iter); + } +} + +//----------------------------------------------------------------------------- +bool Robot::AddModule(IO_Module* newModule) +{ + moduleMap::iterator itr = modules.find(newModule->GetId()); + if(itr != modules.end()) + return false; + + modules[newModule->GetId()] = newModule; + return true; +} + +//----------------------------------------------------------------------------- +bool Robot::RemoveModule(IO_Module* oldModule) +{ + return RemoveModule(oldModule->GetId()); +} + +//----------------------------------------------------------------------------- +void Robot::Update() +{ + //insert code here +} + +//--- EOF --- \ No newline at end of file diff --git a/source/Concept/Framework/robot.h b/source/Concept/Framework/robot.h new file mode 100644 index 0000000..543f1ed --- /dev/null +++ b/source/Concept/Framework/robot.h @@ -0,0 +1,46 @@ +#ifndef _ROBOT_H +#define _ROBOT_H + +#include "stdafx.h" + +class IO_Module; +class Sensor; +class Engine; + +class Robot +{ +public: + ~Robot(); + +private: + typedef hash_map moduleMap; + moduleMap modules; + +public: + bool AddModule(IO_Module* newModule); + + template 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 \ No newline at end of file diff --git a/source/Concept/Framework/sensor.cpp b/source/Concept/Framework/sensor.cpp new file mode 100644 index 0000000..b9b4936 --- /dev/null +++ b/source/Concept/Framework/sensor.cpp @@ -0,0 +1 @@ +#include "sensor.h" \ No newline at end of file diff --git a/source/Concept/Framework/sensor.h b/source/Concept/Framework/sensor.h new file mode 100644 index 0000000..23e40e9 --- /dev/null +++ b/source/Concept/Framework/sensor.h @@ -0,0 +1,29 @@ +#ifndef _SENSOR_H +#define _SENSOR_H + +#include "stdafx.h" + +class Sensor : public IO_Module +{ +public: + Sensor() + { + } + + Sensor(uint32 sensorId, SensorTypes sensorType) + { + this->moduleId = sensorId; + this->sensorType = sensorType; + } + +protected: + SensorTypes sensorType; + +public: + SensorTypes GetType() + { + return sensorType; + } +}; + +#endif \ No newline at end of file diff --git a/source/Concept/Framework/stdafx.h b/source/Concept/Framework/stdafx.h new file mode 100644 index 0000000..0a5a81e --- /dev/null +++ b/source/Concept/Framework/stdafx.h @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +using namespace std; + +#include "defines.h" +#include "io_module.h" +#include "sensor.h" +#include "engine.h" +#include "robot.h" \ No newline at end of file diff --git a/source/Concept/defines.h b/source/Concept/defines.h deleted file mode 100644 index 698163a..0000000 --- a/source/Concept/defines.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _DEFINES_H -#define _DEFINES_H - -#ifndef NULL -#define NULL 0 -#endif - -//Integer definition -#ifndef int8 - #ifdef __int8 - #define int8 __int8 - #else - #define int8 char - #endif -#endif - -#ifndef int16 - #ifdef __int16 - #define int16 __int16 - #else - #define int16 int - #endif -#endif - -#ifndef int32 - #ifdef __int32 - #define int32 __int32 - #else - #define int32 long - #endif -#endif - -#ifndef int64 - #ifdef __int64 - #define int64 __int64 - #else - #define int64 long long - #endif -#endif - -//Unsigned -#ifndef uint8 -#define uint8 unsigned int8 -#endif - -#ifndef uint16 -#define uint16 unsigned int16 -#endif - -#ifndef uint32 -#define uint32 unsigned int32 -#endif - -#ifndef uint64 -#define uint64 unsigned int64 -#endif - -//Sensor types -enum SensorTypes -{ - SENSOR_TYPE_ANALOG, - SENSOR_TYPE_DIGITAL, -}; - -//IO Module Names -enum IOModuleNames -{ - //General - IO_START, - - //Engines - IO_ENGINE_START = IO_START, - - IO_ENGINE_DRIVE_LEFT = IO_ENGINE_START, - IO_ENGINE_DRIVE_RIGHT, - IO_ENGINE_DRIVE_BACK, - - IO_ENGINE_END, - - //Sensors - IO_SENSOR_START = IO_ENGINE_END, - - IO_SENSOR_MOUSE = IO_SENSOR_START, - - IO_SENSOR_END, - - //General - IO_END = IO_SENSOR_END, -}; - -#endif \ No newline at end of file diff --git a/source/Concept/engine.cpp b/source/Concept/engine.cpp deleted file mode 100644 index 11856cc..0000000 --- a/source/Concept/engine.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "engine.h" \ No newline at end of file diff --git a/source/Concept/engine.h b/source/Concept/engine.h deleted file mode 100644 index 406d46e..0000000 --- a/source/Concept/engine.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _ENGINE_H -#define _ENGINE_H - -#include "stdafx.h" - -class Engine : public IO_Module -{ -public: - Engine() - { - } - - Engine(uint32 engineId) - { - this->moduleId = engineId; - } -}; - -#endif \ No newline at end of file diff --git a/source/Concept/io_module.cpp b/source/Concept/io_module.cpp deleted file mode 100644 index 93f78ae..0000000 --- a/source/Concept/io_module.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "io_module.h" \ No newline at end of file diff --git a/source/Concept/io_module.h b/source/Concept/io_module.h deleted file mode 100644 index 8aa7ef7..0000000 --- a/source/Concept/io_module.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _MODULE_H -#define _MODULE_H - -#include "defines.h" - -class IO_Module -{ -public: - IO_Module(uint32 moduleId) - { - this->moduleId = moduleId; - } - - IO_Module(){} - -protected: - uint32 moduleId; - -public: - - uint32 GetId() - { - return moduleId; - } - - -}; - -#endif \ No newline at end of file diff --git a/source/Concept/main.cpp b/source/Concept/main.cpp deleted file mode 100644 index 6305a1e..0000000 --- a/source/Concept/main.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "stdafx.h" - -int main() -{ - //Init our robot - Robot* localRobot = new Robot(); - - //Init Engines - for(uint8 i = IO_ENGINE_START; i < IO_ENGINE_END; i++) - { - Engine* newEngine = new Engine(i); - localRobot->AddModule(newEngine); - newEngine = NULL; - } - - //Init Sensors - for(uint8 i = IO_SENSOR_START; i < IO_SENSOR_END; i++) - { - SensorTypes newSensorType; - - switch(i) - { - //Cases when sensor is digital: - // newSensorType = SENSOR_TYPE_DIGITAL; - // break; - - //Other cases - default: - newSensorType = SENSOR_TYPE_ANALOG; - break; - } - - Sensor* newSensor = new Sensor(i, newSensorType); - localRobot->AddModule(newSensor); - newSensor = NULL; - } - - //Run - while(true) - { - localRobot->Update(); - } - - //Cleanup - delete localRobot; - localRobot = NULL; -} \ No newline at end of file diff --git a/source/Concept/module.cpp b/source/Concept/module.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/source/Concept/module.h b/source/Concept/module.h deleted file mode 100644 index e69de29..0000000 diff --git a/source/Concept/robot.cpp b/source/Concept/robot.cpp deleted file mode 100644 index 768554e..0000000 --- a/source/Concept/robot.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "robot.h" - -//----------------------------------------------------------------------------- -Robot::~Robot() -{ - while(!modules.empty()) - { - moduleMap::iterator iter = modules.begin(); - delete iter->second; - modules.erase(iter); - } -} - -//----------------------------------------------------------------------------- -bool Robot::AddModule(IO_Module* newModule) -{ - moduleMap::iterator itr = modules.find(newModule->GetId()); - if(itr != modules.end()) - return false; - - modules[newModule->GetId()] = newModule; - return true; -} - -//----------------------------------------------------------------------------- -bool Robot::RemoveModule(IO_Module* oldModule) -{ - return RemoveModule(oldModule->GetId()); -} - -//----------------------------------------------------------------------------- -void Robot::Update() -{ - //insert code here -} - -//--- EOF --- \ No newline at end of file diff --git a/source/Concept/robot.h b/source/Concept/robot.h deleted file mode 100644 index 543f1ed..0000000 --- a/source/Concept/robot.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _ROBOT_H -#define _ROBOT_H - -#include "stdafx.h" - -class IO_Module; -class Sensor; -class Engine; - -class Robot -{ -public: - ~Robot(); - -private: - typedef hash_map moduleMap; - moduleMap modules; - -public: - bool AddModule(IO_Module* newModule); - - template 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 \ No newline at end of file diff --git a/source/Concept/sensor.cpp b/source/Concept/sensor.cpp deleted file mode 100644 index b9b4936..0000000 --- a/source/Concept/sensor.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "sensor.h" \ No newline at end of file diff --git a/source/Concept/sensor.h b/source/Concept/sensor.h deleted file mode 100644 index 23e40e9..0000000 --- a/source/Concept/sensor.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef _SENSOR_H -#define _SENSOR_H - -#include "stdafx.h" - -class Sensor : public IO_Module -{ -public: - Sensor() - { - } - - Sensor(uint32 sensorId, SensorTypes sensorType) - { - this->moduleId = sensorId; - this->sensorType = sensorType; - } - -protected: - SensorTypes sensorType; - -public: - SensorTypes GetType() - { - return sensorType; - } -}; - -#endif \ No newline at end of file diff --git a/source/Concept/stdafx.h b/source/Concept/stdafx.h deleted file mode 100644 index 0a5a81e..0000000 --- a/source/Concept/stdafx.h +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include -#include -#include - -using namespace std; - -#include "defines.h" -#include "io_module.h" -#include "sensor.h" -#include "engine.h" -#include "robot.h" \ No newline at end of file -- cgit v1.2.3