TaskFactory.h
Go to the documentation of this file.00001
00002 #include <iostream>
00003 #include <string>
00004 using namespace std;
00005
00006 #include "Task.h"
00007
00008 #ifndef __TASK_FACTORY_H_
00009 #define __TASK_FACTORY_H_
00010
00011 using namespace MipTasks;
00012
00013 static int ciao;
00014
00015 class FunctionsLookupTable{
00016 public:
00017
00018 static map<string, int > table;
00019
00020 void registerNew(string s, int i){
00021 table[s] = i;
00022 }
00023 };
00024
00025 static FunctionsLookupTable staticTaskCreateFunctionsLookUpTables;
00026
00027
00028
00029
00030 #define MIP_REGISTER_STATIC_TASK(TASK_NAME) \
00031 static Task* create_task_##TASK_NAME(ResourcePointers resources,int argc, const char* argv[]) { \
00032 return new TASK_NAME(resources, argc, argv); \
00033 }\
00034 static void destroy_task_##TASK_NAME(Task* p) {\
00035 delete p;\
00036 }\
00037
00038
00039 #define MIP_REGISTER_TASK(TASK_NAME) \
00040 extern "C" Task* create_task_##TASK_NAME(ResourcePointers resources,int argc, const char* argv[]) { \
00041 return new TASK_NAME(resources, argc, argv); \
00042 }\
00043 extern "C" void destroy_task_##TASK_NAME(Task* p) {\
00044 delete p;\
00045 }
00046
00047
00048 #endif