remove task from declare_taskif

This commit is contained in:
andreas 2023-10-27 20:29:16 +02:00
parent 34dd3434fe
commit a6c1511298
4 changed files with 9 additions and 10 deletions

View File

@ -234,7 +234,7 @@ class GwApi{
*
*
*/
#define DECLARE_TASKIF_IMPL(task,type) \
#define DECLARE_TASKIF_IMPL(type) \
template<> \
inline bool GwApi::TaskInterfaces::set(const type & v) {\
return iset(__FILE__,#type,GwApi::TaskInterfaces::Ptr(new type(v))); \
@ -250,6 +250,6 @@ class GwApi{
return type(*tp); \
}
#ifndef DECLARE_TASKIF
#define DECLARE_TASKIF(task,type) DECLARE_TASKIF_IMPL(task,type)
#define DECLARE_TASKIF(type) DECLARE_TASKIF_IMPL(type)
#endif
#endif

View File

@ -14,6 +14,6 @@ public:
ButtonState state=OFF;
long pressCount=0;
};
DECLARE_TASKIF(handleButtons,IButtonTask);
DECLARE_TASKIF(IButtonTask);
#endif

View File

@ -9,6 +9,6 @@ class ExampleTaskIf : public GwApi::TaskInterfaces::Base{
long count=0;
String someValue;
};
DECLARE_TASKIF(exampleTask,ExampleTaskIf);
DECLARE_TASKIF(ExampleTaskIf);
#endif

View File

@ -3,9 +3,9 @@
#define DECLARE_INITFUNCTION(task) GwInitTask __Init##task##__(task,#task);
#define DECLARE_CAPABILITY(name,value) GwUserCapability __CAP##name##__(#name,#value);
#define DECLARE_STRING_CAPABILITY(name,value) GwUserCapability __CAP##name##__(#name,value);
#define DECLARE_TASKIF(task,type) \
DECLARE_TASKIF_IMPL(task,type) \
GwIreg __register##type(#task,__FILE__,#type)
#define DECLARE_TASKIF(type) \
DECLARE_TASKIF_IMPL(type) \
GwIreg __register##type(__FILE__,#type)
#include "GwUserCode.h"
#include "GwSynchronized.h"
@ -60,8 +60,8 @@ static void registerInterface(const String &task,const String &file, const Strin
class GwIreg{
public:
GwIreg(const String &task,const String &file, const String &name){
registerInterface(task,file,name);
GwIreg(const String &file, const String &name){
registerInterface("",file,name);
}
};
@ -124,7 +124,6 @@ class TaskInterfacesStorage{
}
if (it->second.task != task){
LOG_DEBUG(GwLog::ERROR,"TaskInterfaces: invalid set %s wrong task, expected %s , got %s",name.c_str(),it->second.task.c_str(),task.c_str());
return false;
}
auto vit=values.find(name);
if (vit != values.end()){