15 #include <boost/bind.hpp> 16 #include <boost/function.hpp> 24 template<
typename Signature>
33 template<
class XFuncOwnerType >
34 KTSlotNoArg(
const std::string& name, XFuncOwnerType* owner, return_type (XFuncOwnerType::*func)());
36 template<
class XFuncOwnerType >
37 KTSlotNoArg(
const std::string& name,
KTProcessor* proc, XFuncOwnerType* owner, return_type (XFuncOwnerType::*func)());
43 boost::function< Signature >
fFunc;
64 template<
typename Signature>
74 template<
class XFuncOwnerType >
75 KTSlotOneArg(
const std::string& name, XFuncOwnerType* owner, return_type (XFuncOwnerType::*func)(argument_type));
77 template<
class XFuncOwnerType >
78 KTSlotOneArg(
const std::string& name,
KTProcessor* proc, XFuncOwnerType* owner, return_type (XFuncOwnerType::*func)(argument_type));
84 boost::function< Signature >
fFunc;
88 template<
typename Signature>
99 template<
class XFuncOwnerType >
100 KTSlotTwoArg(
const std::string& name, XFuncOwnerType* owner, return_type (XFuncOwnerType::*func)(first_argument_type, second_argument_type));
102 template<
class XFuncOwnerType >
103 KTSlotTwoArg(
const std::string& name,
KTProcessor* proc, XFuncOwnerType* owner, return_type (XFuncOwnerType::*func)(first_argument_type, second_argument_type));
106 return_type
operator()(first_argument_type arg1, second_argument_type arg2);
115 template<
typename Signature>
116 template<
class XFuncOwnerType >
118 fFunc(boost::bind(func, owner))
120 owner->RegisterSlot(name,
this, &KTSlotNoArg::operator());
123 template<
typename Signature>
124 template<
class XFuncOwnerType >
126 fFunc(boost::bind(func, owner))
128 proc->
RegisterSlot(name,
this, &KTSlotNoArg::operator());
131 template<
typename Signature>
136 template<
typename Signature>
145 template<
typename Signature>
146 template<
class XFuncOwnerType >
148 fFunc(boost::bind(func, owner, _1))
150 owner->RegisterSlot(name,
this, &KTSlotOneArg::operator());
153 template<
typename Signature>
154 template<
class XFuncOwnerType >
156 fFunc(boost::bind(func, owner, _1))
158 proc->
RegisterSlot(name,
this, &KTSlotOneArg::operator());
161 template<
typename Signature>
166 template<
typename Signature>
176 template<
typename Signature>
177 template<
class XFuncOwnerType >
179 fFunc(boost::bind(func, owner, _1, _2))
181 owner->RegisterSlot(name,
this, &KTSlotTwoArg::operator());
184 template<
typename Signature>
185 template<
class XFuncOwnerType >
187 fFunc(boost::bind(func, owner, _1, _2))
189 proc->
RegisterSlot(name,
this, &KTSlotTwoArg::operator());
192 template<
typename Signature>
197 template<
typename Signature>
200 return fFunc(arg1, arg2);
228 template<
class XDataType >
239 template<
class XFuncOwnerType >
242 template<
class XFuncOwnerType >
249 boost::function< bool (data_type&) >
fFunc;
255 template<
class XDataType1,
class XDataType2 >
267 template<
class XFuncOwnerType >
268 KTSlotDataTwoTypes(
const std::string& name, XFuncOwnerType* owner,
bool (XFuncOwnerType::*func)(first_data_type&, second_data_type&),
KTSignalData* signalPtr=NULL);
270 template<
class XFuncOwnerType >
277 boost::function< bool (first_data_type&, second_data_type&) >
fFunc;
283 template<
class XDataType1,
class XDataType2,
class XDataType3 >
296 template<
class XFuncOwnerType >
297 KTSlotDataThreeTypes(
const std::string& name, XFuncOwnerType* owner,
bool (XFuncOwnerType::*func)(first_data_type&, second_data_type&, third_data_type&),
KTSignalData* signalPtr=NULL);
299 template<
class XFuncOwnerType >
306 boost::function< bool (first_data_type&, second_data_type&, third_data_type&) >
fFunc;
313 template<
class XDataType >
314 template<
class XFuncOwnerType >
316 fFunc(boost::bind(func, owner, _1)),
317 fSignalPtr(signalPtr)
319 owner->RegisterSlot(name,
this, &KTSlotDataOneType::operator());
322 template<
class XDataType >
323 template<
class XFuncOwnerType >
325 fFunc(boost::bind(func, owner, _1)),
328 proc->
RegisterSlot(name,
this, &KTSlotDataOneType::operator());
331 template<
class XDataType >
336 template<
class XDataType >
341 if (! data->Has< data_type >())
343 KTERROR(slotlog,
"Data not found with type <" <<
typeid(data_type).name() <<
">");
347 if (!
fFunc(data->Of< data_type >()))
349 KTERROR(slotlog,
"Something went wrong while analyzing data with type <" <<
typeid(data_type).name() <<
">");
362 template<
class XDataType1,
class XDataType2 >
363 template<
class XFuncOwnerType >
365 fFunc(boost::bind(func, owner, _1, _2)),
368 owner->RegisterSlot(name,
this, &KTSlotDataTwoTypes::operator());
371 template<
class XDataType1,
class XDataType2 >
372 template<
class XFuncOwnerType >
374 fFunc(boost::bind(func, owner, _1, _2)),
377 proc->
RegisterSlot(name,
this, &KTSlotDataTwoTypes::operator());
380 template<
class XDataType1,
class XDataType2 >
385 template<
class XDataType1,
class XDataType2 >
390 if (! data->Has< first_data_type >())
392 KTERROR(slotlog,
"Data not found with type <" <<
typeid(first_data_type).name() <<
">");
395 if (! data->Has< second_data_type >())
397 KTERROR(slotlog,
"Data not found with type <" <<
typeid(second_data_type).name() <<
">");
401 if (!
fFunc(data->Of< first_data_type >(), data->Of< second_data_type >()))
403 KTERROR(slotlog,
"Something went wrong while analyzing data with types <" <<
typeid(first_data_type).name() <<
"> and <" <<
typeid(second_data_type).name() <<
">");
415 template<
class XDataType1,
class XDataType2,
class XDataType3 >
416 template<
class XFuncOwnerType >
418 fFunc(boost::bind(func, owner, _1, _2, _3)),
421 owner->RegisterSlot(name,
this, &KTSlotDataThreeTypes::operator());
424 template<
class XDataType1,
class XDataType2,
class XDataType3 >
425 template<
class XFuncOwnerType >
427 fFunc(boost::bind(func, owner, _1, _2, _3)),
430 proc->
RegisterSlot(name,
this, &KTSlotDataThreeTypes::operator());
433 template<
class XDataType1,
class XDataType2,
class XDataType3 >
438 template<
class XDataType1,
class XDataType2,
class XDataType3 >
443 if (! data->Has< first_data_type >())
445 KTERROR(slotlog,
"Data not found with type <" <<
typeid(first_data_type).name() <<
">");
448 if (! data->Has< second_data_type >())
450 KTERROR(slotlog,
"Data not found with type <" <<
typeid(second_data_type).name() <<
">");
453 if (! data->Has< third_data_type >())
455 KTERROR(slotlog,
"Data not found with type <" <<
typeid(third_data_type).name() <<
">");
459 if (!
fFunc(data->Of< first_data_type >(), data->Of< second_data_type >(), data->Of< third_data_type >()))
461 KTERROR(slotlog,
"Something went wrong while analyzing data with types <" <<
typeid(first_data_type).name() <<
">, <" <<
typeid(second_data_type).name() <<
">, and <" <<
typeid(third_data_type).name() <<
">");
501 template<
class XFuncOwnerType >
502 KTSlotDone(
const std::string& name, XFuncOwnerType* owner,
void (XFuncOwnerType::*func)(),
KTSignalDone* signalPtr=NULL);
504 template<
class XFuncOwnerType >
516 template<
class XFuncOwnerType >
518 fFunc(boost::bind(func, owner)),
521 owner->RegisterSlot(name,
this, &KTSlotDone::operator());
524 template<
class XFuncOwnerType >
526 fFunc(boost::bind(func, owner)),
529 proc->
RegisterSlot(name,
this, &KTSlotDone::operator());
function_signature::argument_type argument_type
function_signature::result_type return_type
return_type operator()(first_argument_type arg1, second_argument_type arg2)
KTSlotOneArg(const std::string &name, XFuncOwnerType *owner, return_type(XFuncOwnerType::*func)(argument_type))
Constructor for the case where the processor has the function that will be called by the slot...
function_signature::argument_type argument_type
function_signature::argument_type argument_type
boost::function< void(KTDataPtr) > function_signature
boost::function< Signature > function_signature
KTSlotDataOneType(const std::string &name, XFuncOwnerType *owner, bool(XFuncOwnerType::*func)(data_type &), KTSignalData *signalPtr=NULL)
Constructor for the case where the processor has the function that will be called by the slot...
boost::function< Signature > fFunc
KTSlotTwoArg(const std::string &name, XFuncOwnerType *owner, return_type(XFuncOwnerType::*func)(first_argument_type, second_argument_type))
Constructor for the case where the processor has the function that will be called by the slot...
function_signature::argument_type argument_type
void operator()(KTDataPtr data)
void RegisterSlot(std::string name, XTarget *target, XReturn(XTarget::*funcPtr)())
Creates a slot that calls a member function of the func_owner_type object, taking one argument...
boost::function< Signature > fFunc
boost::function< bool(first_data_type &, second_data_type &) > fFunc
KTSlotNoArg(const std::string &name, XFuncOwnerType *owner, return_type(XFuncOwnerType::*func)())
Constructor for the case where the processor has the function that will be called by the slot...
boost::function< void() > fFunc
boost::function< bool(first_data_type &, second_data_type &, third_data_type &) > fFunc
boost::function< Signature > function_signature
KTSlotDataTwoTypes(const std::string &name, XFuncOwnerType *owner, bool(XFuncOwnerType::*func)(first_data_type &, second_data_type &), KTSignalData *signalPtr=NULL)
Constructor for the case where the processor has the function that will be called by the slot...
KTSignalData * fSignalPtr
function_signature::result_type return_type
KTSlotDone(const std::string &name, XFuncOwnerType *owner, void(XFuncOwnerType::*func)(), KTSignalDone *signalPtr=NULL)
Constructor for the case where the processor has the function that will be called by the slot...
Creates a signal that takes a KTDataPtr object as its argument.
boost::function< void(KTDataPtr) > function_signature
XDataType1 first_data_type
boost::function< Signature > fFunc
boost::function< void() > function_signature
KTLOGGER(applog, "KTApplication")
XDataType3 third_data_type
boost::function< bool(data_type &) > fFunc
function_signature::result_type return_type
KTSignalData * fSignalPtr
KTSignalDone * fSignalPtr
boost::function< Signature > function_signature
XDataType2 second_data_type
function_signature::first_argument_type first_argument_type
KTSignalData * fSignalPtr
virtual ~KTSlotDataTwoTypes()
function_signature::second_argument_type second_argument_type
boost::shared_ptr< KTData > KTDataPtr
KTSlotDataThreeTypes(const std::string &name, XFuncOwnerType *owner, bool(XFuncOwnerType::*func)(first_data_type &, second_data_type &, third_data_type &), KTSignalData *signalPtr=NULL)
Constructor for the case where the processor has the function that will be called by the slot...
boost::function< void(KTDataPtr) > function_signature
virtual ~KTSlotDataOneType()
void operator()(KTDataPtr data)
function_signature::result_type return_type
function_signature::result_type return_type
XDataType2 second_data_type
function_signature::result_type return_type
virtual ~KTSlotDataThreeTypes()
XDataType1 first_data_type
Contains the logger class and macros, based on Kasper's KLogger class.
void operator()(KTDataPtr data)