update
This commit is contained in:
parent
8c21c6d07f
commit
df5325db4c
|
@ -10,12 +10,12 @@ namespace cmds {
|
|||
private:
|
||||
QString _name_value;
|
||||
dispatch::Dispatch* core = dispatch::Dispatch::unique();
|
||||
Inlet::CmdsImpl<(void*) func, Ret, Args...> _g_inst;
|
||||
|
||||
public:
|
||||
Cmd(const QString& name) : _name_value(name) {
|
||||
auto g_inst = Inlet::CmdsImpl<(void*) func, Ret, Args...>::unique();
|
||||
core->registerCmd(g_inst->address(), g_inst);
|
||||
core->setCmdAlias(g_inst->address(), name);
|
||||
core->registerCmd(_g_inst.address(), &_g_inst);
|
||||
core->setCmdAlias(_g_inst.address(), name);
|
||||
}
|
||||
|
||||
Ret operator()(Args... args) {
|
||||
|
@ -31,12 +31,12 @@ namespace cmds {
|
|||
private:
|
||||
QString _name_value;
|
||||
dispatch::Dispatch* core = dispatch::Dispatch::unique();
|
||||
Inlet::EventsImpl<(void*) func, Ret, Args...> _g_inst;
|
||||
|
||||
public:
|
||||
Event(const QString& name) : _name_value(name) {
|
||||
auto g_inst = Inlet::EventsImpl<(void*)func, Ret, Args...>::unique();
|
||||
core->registerEvent(g_inst->address(), g_inst);
|
||||
core->setEventAlias(g_inst->address(), name);
|
||||
core->registerEvent(_g_inst.address(), &_g_inst);
|
||||
core->setEventAlias(_g_inst.address(), name);
|
||||
}
|
||||
|
||||
void operator()(Args... args) {
|
||||
|
|
|
@ -93,18 +93,10 @@ namespace Inlet {
|
|||
Callable<Ret, Args...> _func = (Callable<Ret, Args...>)addr;
|
||||
SignatureImpl<Ret, Args...> _args_value;
|
||||
|
||||
static CmdsImpl<addr, Ret, Args...>* _unique_inst;
|
||||
|
||||
public:
|
||||
CmdsImpl() : _args_value() { }
|
||||
CmdsImpl(Args... args) :_args_value(args...) { }
|
||||
|
||||
static CmdsImpl<addr, Ret, Args...>* unique() {
|
||||
if (!_unique_inst)
|
||||
_unique_inst = new CmdsImpl<addr, Ret, Args...>();
|
||||
return _unique_inst;
|
||||
}
|
||||
|
||||
Ret execute(Args... args) {
|
||||
_args_value = SignatureImpl<Ret, Args...>(args...);
|
||||
return _args_value.execute(_func);
|
||||
|
@ -132,25 +124,16 @@ namespace Inlet {
|
|||
_args_value.loadFrom(0, object);
|
||||
}
|
||||
};
|
||||
template<void* addr, typename Ret, typename... Args> CmdsImpl<addr, Ret, Args...>* CmdsImpl<addr, Ret, Args...>::_unique_inst = nullptr;
|
||||
|
||||
template<void* addr, typename Ret, typename... Args> struct EventsImpl : public IRunbase {
|
||||
private:
|
||||
Callable<Ret, Args...> _func = (Callable<Ret, Args...>)addr;
|
||||
SignatureImpl<Ret, Args...> _args_value;
|
||||
|
||||
static EventsImpl<addr, Ret, Args...>* _unique_inst;
|
||||
|
||||
public:
|
||||
EventsImpl() : _args_value() { }
|
||||
EventsImpl(Args... args) : _args_value(args...) { }
|
||||
|
||||
static EventsImpl<addr, Ret, Args...>* unique() {
|
||||
if(!_unique_inst)
|
||||
_unique_inst = new EventsImpl<addr, Ret, Args...>();
|
||||
return _unique_inst;
|
||||
}
|
||||
|
||||
void execute(Args... args) {
|
||||
_args_value = SignatureImpl<Ret, Args...>(args...);
|
||||
}
|
||||
|
@ -167,5 +150,4 @@ namespace Inlet {
|
|||
_args_value.loadFrom(0, object);
|
||||
}
|
||||
};
|
||||
template<void* addr, typename Ret, typename... Args> EventsImpl<addr, Ret, Args...>* EventsImpl<addr, Ret, Args...>::_unique_inst = nullptr;
|
||||
}
|
||||
|
|
|
@ -8,35 +8,35 @@
|
|||
#include "validate_impl.h"
|
||||
#include "validate_depict.h"
|
||||
|
||||
//int vp(int c) {
|
||||
// qDebug() << c;
|
||||
// return c;
|
||||
//}
|
||||
//verify::T<int(int)>::Validate<vp> vp_check;
|
||||
//auto args0 = vp_check.pos<0>() & new impls::Int32Limit<true, true>(u8"Hello World", 0, 3);
|
||||
//
|
||||
//cmds::T<int(int)>::Cmd<vp> entry("hello");
|
||||
//
|
||||
//
|
||||
//namespace xproc {
|
||||
// int xmp(int arg) {
|
||||
// qDebug() << "xmp";
|
||||
// return 3;
|
||||
// }
|
||||
//}
|
||||
//cmds::T<int(int)>::Cmd<xproc::xmp> xvv("sfaf");
|
||||
//
|
||||
//template<> void datas::dataSet<int>(IDataObject& object, const QString& key, int value) { }
|
||||
//template<> int datas::dataGet<int>(IDataObject& object, const QString& key) {
|
||||
// return 0;
|
||||
//}
|
||||
int vp(int c) {
|
||||
qDebug() << c;
|
||||
return c;
|
||||
}
|
||||
verify::T<int(int)>::Validate<vp> vp_check;
|
||||
auto args0 = vp_check.pos<0>() & new impls::Int32Limit<true, true>(u8"Hello World", 0, 3);
|
||||
|
||||
cmds::T<int(int)>::Cmd<vp> entry("hello");
|
||||
|
||||
|
||||
namespace xproc {
|
||||
int xmp(int arg) {
|
||||
qDebug() << "xmp";
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
cmds::T<int(int)>::Cmd<xproc::xmp> xvv("sfaf");
|
||||
|
||||
template<> void datas::dataSet<int>(IDataObject& object, const QString& key, int value) { }
|
||||
template<> int datas::dataGet<int>(IDataObject& object, const QString& key) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "logs_port.h"
|
||||
using namespace Inlet;
|
||||
int main(int argc, char* argv[]) {
|
||||
QCoreApplication a(argc, argv);
|
||||
|
||||
/*SignatureImpl<int, int> v(3);
|
||||
SignatureImpl<int, int> v(3);
|
||||
v.execute(vp);
|
||||
|
||||
Callable<int, int> vptr = vp;
|
||||
|
@ -52,7 +52,7 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
depict::ValidateDocObject doc;
|
||||
dispatch::Dispatch::unique()->getValidateDepict(doc);
|
||||
qDebug().noquote() << doc.toText();*/
|
||||
qDebug().noquote() << doc.toText();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue