18 #ifndef CAMSERIALIZER_H_ 19 #define CAMSERIALIZER_H_ 32 template<std::size_t ... Is>
37 template<std::size_t N, std::size_t ... Is>
42 template<std::size_t ... Is>
54 struct is_placeholder<::
placeholder<I>> : std::integral_constant<int, I>
60 # define DEPRECATED(MSG) __attribute__ ((__deprecated__((#MSG)))) 62 # define DEPRECATED(MSG) 101 SyncCallType =
false, AsyncCallType =
true 104 virtual ~CAmDelegate()
108 virtual CallType call(
int* pipe)=0;
115 template<
class Class,
typename Method,
typename Tuple,
bool Done,
int Total,
int ... N>
116 class CAmDelegateAsyncImpl:
public CAmDelegate
123 static void call(Class instance, Method method, Tuple && arguments)
125 CAmDelegateAsyncImpl<Class, Method, Tuple, Total == 1 +
sizeof...(N), Total, N...,
sizeof...(N)>::call(instance, method, std::forward<Tuple>(arguments));
128 CAmDelegateAsyncImpl(Class instance, Method method, Tuple && arguments)
130 mInstance = instance;
132 mArguments = std::move(arguments);
135 CallType call(
int* pipe)
138 call(mInstance, mMethod, std::forward<Tuple>(mArguments));
139 return (AsyncCallType);
147 template<
class Class,
typename Method,
typename Tuple,
int Total,
int ... N>
148 class CAmDelegateAsyncImpl<Class, Method, Tuple, true, Total, N...> :
public CAmDelegate
155 static void call(Class instance, Method method, Tuple && t)
157 (*instance.*method)(std::get<N>(std::forward<Tuple>(t))...);
160 CAmDelegateAsyncImpl(Class instance, Method method, Tuple && arguments)
162 mInstance = instance;
164 mArguments = std::move(arguments);
167 CallType call(
int* pipe)
170 call(mInstance, mMethod, std::forward<Tuple>(mArguments));
171 return (AsyncCallType);
179 template<
class Class,
typename Method,
typename Return,
typename Tuple,
bool Done,
int Total,
int ... N>
180 class CAmDelegateSyncImpl:
public CAmDelegate
188 static void call(Class instance, Method method, Return & result, Tuple && arguments)
190 CAmDelegateSyncImpl<Class, Method, Return, Tuple, Total == 1 +
sizeof...(N), Total, N...,
sizeof...(N)>::call(instance, method, result, std::forward<Tuple>(arguments));
193 CAmDelegateSyncImpl(Class instance, Method method, Tuple && arguments)
195 mInstance = instance;
197 mArguments = std::move(arguments);
200 CallType call(
int* pipe)
202 call(mInstance, mMethod, mReturn, std::forward<Tuple>(mArguments));
204 result = write(pipe[1],
this,
sizeof(
this));
206 logError(
"CAmSerializer: Problem writing into pipe! Error No:", errno);
207 return (SyncCallType);
215 template<
class Class,
typename Method,
typename Return,
typename Tuple,
int Total,
int ... N>
216 class CAmDelegateSyncImpl<Class, Method, Return, Tuple, true, Total, N...> :
public CAmDelegate
224 static void call(Class instance, Method method, Return & result, Tuple && t)
226 result = (*instance.*method)(std::get<N>(t)...);
229 CAmDelegateSyncImpl(Class instance, Method method, Tuple && arguments)
231 mInstance = instance;
233 mArguments = std::move(arguments);
236 CallType call(
int* pipe)
238 call(mInstance, mMethod, mReturn, std::forward<Tuple>(mArguments));
240 result = write(pipe[1],
this,
sizeof(
this));
242 logError(
"CAmSerializer: Problem writing into pipe! Error No:", errno);
243 return (SyncCallType);
248 typedef CAmDelegate* CAmDelegagePtr;
254 template<
typename Class,
typename Method,
typename Tuple>
255 void doAsyncCall(Class intsance, Method method, Tuple & arguments)
257 typedef typename std::decay<Tuple>::type ttype;
258 typedef CAmDelegateAsyncImpl<Class, Method, Tuple, 0 == std::tuple_size<ttype>::value, std::tuple_size<ttype>::value> AsyncDelegate;
259 AsyncDelegate *pImp =
new AsyncDelegate(intsance, method, std::forward<Tuple>(arguments));
267 template<
typename Class,
typename Method,
typename Return,
typename Tuple>
268 void doSyncCall(Class intsance, Method method, Return & result, Tuple & arguments)
270 typedef typename std::decay<Tuple>::type ttype;
271 typedef CAmDelegateSyncImpl<Class, Method, Return, Tuple, 0 == std::tuple_size<ttype>::value, std::tuple_size<ttype>::value> SyncDelegate;
272 SyncDelegate *pImp =
new SyncDelegate(intsance, method, std::forward<Tuple>(arguments));
275 SyncDelegate *p = NULL;
276 if ((numReads = read(mReturnPipe[0], &p,
sizeof(p))) == -1)
278 logError(
"CAmSerializer::doSyncCall could not read pipe!");
279 throw std::runtime_error(
"CAmSerializer Could not read pipe!");
281 result = std::move(pImp->mReturn);
282 arguments = std::move(pImp->mArguments);
292 inline void send(CAmDelegagePtr p)
294 if (write(mPipe[1], &p,
sizeof(p)) == -1)
296 throw std::runtime_error(
"could not write to pipe !");
304 std::deque<CAmDelegagePtr> mListDelegatePoiters;
313 return mListDelegatePoiters.size();
337 template<
class TClass,
class TRet,
class ... TArgs>
338 void syncCall(TClass* instance, TRet (TClass::*method)(TArgs ...), TRet & result, TArgs & ... arguments)
340 auto t = std::make_tuple(arguments...);
341 doSyncCall(instance, method, result, t);
342 std::tie(arguments...) = t;
364 template<
class TClass,
class TRet,
class ... TArgs>
365 void asyncCall(TClass* instance, TRet (TClass::*method)(TArgs ...), TArgs & ... arguments)
367 auto t = std::make_tuple(arguments...);
368 doAsyncCall(instance, method, t);
388 template<
class TClass>
389 void asyncCall(TClass* instance,
void (TClass::*
function)())
391 auto t = std::make_tuple();
392 doAsyncCall(instance,
function, t);
415 template<
class TClass1,
class Targ>
416 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ), Targ argument)
418 auto t = std::make_tuple(argument);
419 doAsyncCall(instance,
function, t);
442 template<
class TClass1,
class Targ>
443 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ&), Targ& argument)
445 auto t = std::make_tuple(argument);
446 doAsyncCall(instance,
function, t);
459 template<
class TClass1,
class Targ,
class Targ1>
460 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1 argument1), Targ argument, Targ1 argument1)
462 auto t = std::make_tuple(argument, argument1);
463 doAsyncCall(instance,
function, t);
476 template<
class TClass1,
class Targ,
class Targ1>
477 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ& argument, Targ1 argument1), Targ& argument, Targ1 argument1)
479 auto t = std::make_tuple(argument, argument1);
480 doAsyncCall(instance,
function, t);
493 template<
class TClass1,
class Targ,
class Targ1>
494 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1& argument1), Targ argument, Targ1& argument1)
496 auto t = std::make_tuple(argument, argument1);
497 doAsyncCall(instance,
function, t);
510 template<
class TClass1,
class Targ,
class Targ1>
511 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ& argument, Targ1& argument1), Targ& argument, Targ1& argument1)
513 auto t = std::make_tuple(argument, argument1);
514 doAsyncCall(instance,
function, t);
520 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
521 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1 argument1, Targ2 argument2), Targ argument, Targ1 argument1, Targ2 argument2)
523 auto t = std::make_tuple(argument, argument1, argument2);
524 doAsyncCall(instance,
function, t);
530 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
531 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ& argument, Targ1 argument1, Targ2 argument2), Targ& argument, Targ1 argument1, Targ2 argument2)
533 auto t = std::make_tuple(argument, argument1, argument2);
534 doAsyncCall(instance,
function, t);
540 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
541 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1& argument1, Targ2 argument2), Targ argument, Targ1& argument1, Targ2 argument2)
543 auto t = std::make_tuple(argument, argument1, argument2);
544 doAsyncCall(instance,
function, t);
550 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
551 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1 argument1, Targ2& argument2), Targ argument, Targ1 argument1, Targ2& argument2)
553 auto t = std::make_tuple(argument, argument1, argument2);
554 doAsyncCall(instance,
function, t);
560 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
561 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1& argument1, Targ2& argument2), Targ argument, Targ1& argument1, Targ2& argument2)
563 auto t = std::make_tuple(argument, argument1, argument2);
564 doAsyncCall(instance,
function, t);
570 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
571 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ& argument, Targ1& argument1, Targ2& argument2), Targ& argument, Targ1& argument1, Targ2& argument2)
573 auto t = std::make_tuple(argument, argument1, argument2);
574 doAsyncCall(instance,
function, t);
580 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
581 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ& argument, Targ1& argument1, Targ2 argument2), Targ& argument, Targ1& argument1, Targ2 argument2)
583 auto t = std::make_tuple(argument, argument1, argument2);
584 doAsyncCall(instance,
function, t);
590 template<
class TClass1,
class Targ,
class Targ1,
class Targ2>
591 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ& argument, Targ1 argument1, Targ2& argument2), Targ& argument, Targ1 argument1, Targ2& argument2)
593 auto t = std::make_tuple(argument, argument1, argument2);
594 doAsyncCall(instance,
function, t);
600 template<
class TClass1,
class Targ,
class Targ1,
class Targ2,
class Targ3>
601 void asyncCall(TClass1* instance,
void (TClass1::*
function)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3), Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3)
603 auto t = std::make_tuple(argument, argument1, argument2, argument3);
604 doAsyncCall(instance,
function, t);
629 template<
class TClass1,
class TretVal>
630 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(), TretVal& retVal)
632 auto t = std::make_tuple();
633 doSyncCall(instance,
function, retVal, t);
662 template<
class TClass1,
class TretVal,
class TargCall,
class Targ>
663 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall), TretVal& retVal, Targ& argument)
665 auto t = std::make_tuple(argument);
666 doSyncCall(instance,
function, retVal, t);
667 std::tie(argument) = t;
673 template<
class TClass1,
class TretVal,
class TargCall,
class Targ>
674 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall)
const, TretVal& retVal, Targ& argument)
676 auto t = std::make_tuple(argument);
677 doSyncCall(instance,
function, retVal, t);
678 std::tie(argument) = t;
684 template<
class TClass1,
class TretVal,
class TargCall,
class Targ1Call,
class Targ,
class Targ1>
685 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, Targ1Call), TretVal& retVal, Targ& argument, Targ1& argument1)
687 auto t = std::make_tuple(argument, argument1);
688 doSyncCall(instance,
function, retVal, t);
689 std::tie(argument, argument1) = t;
694 template<
class TClass1,
class TretVal,
class TargCall,
class Targ1Call,
class Targ,
class Targ1>
695 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, Targ1Call)
const, TretVal& retVal, Targ& argument, Targ1& argument1)
697 auto t = std::make_tuple(argument, argument1);
698 doSyncCall(instance,
function, retVal, t);
699 std::tie(argument, argument1) = t;
705 template<
class TClass1,
class TretVal,
class TargCall,
class TargCall1,
class TargCall2,
class Targ,
class Targ1,
class Targ2>
706 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, TargCall1, TargCall2), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2)
708 auto t = std::make_tuple(argument, argument1, argument2);
709 doSyncCall(instance,
function, retVal, t);
710 std::tie(argument, argument1, argument2) = t;
716 template<
class TClass1,
class TretVal,
class TargCall,
class TargCall1,
class TargCall2,
class Targ,
class Targ1,
class Targ2>
717 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, TargCall1, TargCall2)
const, TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2)
719 auto t = std::make_tuple(argument, argument1, argument2);
720 doSyncCall(instance,
function, retVal, t);
721 std::tie(argument, argument1, argument2) = t;
727 template<
class TClass1,
class TretVal,
class TargCall,
class TargCall1,
class TargCall2,
class TargCall3,
class Targ,
class Targ1,
class Targ2,
class Targ3>
728 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, TargCall1, TargCall2, TargCall3), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3)
730 auto t = std::make_tuple(argument, argument1, argument2, argument3);
731 doSyncCall(instance,
function, retVal, t);
732 std::tie(argument, argument1, argument2, argument3) = t;
738 template<
class TClass1,
class TretVal,
class TargCall,
class TargCall1,
class TargCall2,
class TargCall3,
class TargCall4,
class Targ,
class Targ1,
class Targ2,
class Targ3,
class Targ4>
739 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, TargCall1, TargCall2, TargCall3, TargCall4), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3, Targ4& argument4)
741 auto t = std::make_tuple(argument, argument1, argument2, argument3, argument4);
742 doSyncCall(instance,
function, retVal, t);
743 std::tie(argument, argument1, argument2, argument3, argument4) = t;
749 template<
class TClass1,
class TretVal,
class TargCall,
class TargCall1,
class TargCall2,
class TargCall3,
class TargCall4,
class TargCall5,
class Targ,
class Targ1,
class Targ2,
class Targ3,
class Targ4,
class Targ5>
750 void syncCall(TClass1* instance, TretVal (TClass1::*
function)(TargCall, TargCall1, TargCall2, TargCall3, TargCall4, TargCall5), TretVal& retVal, Targ& argument, Targ1& argument1, Targ2& argument2, Targ3& argument3,
751 Targ4& argument4, Targ5& argument5)
753 auto t = std::make_tuple(argument, argument1, argument2, argument3, argument4, argument5);
754 doSyncCall(instance,
function, retVal, t);
755 std::tie(argument, argument1, argument2, argument3, argument4, argument5) = t;
766 CAmDelegagePtr listPointers[3];
767 if ((numReads = read(pollfd.fd, &listPointers,
sizeof(listPointers))) == -1)
769 logError(
"CAmSerializer::receiverCallback could not read pipe!");
770 throw std::runtime_error(
"CAmSerializer Could not read pipe!");
772 mListDelegatePoiters.assign(listPointers, listPointers + (numReads /
sizeof(CAmDelegagePtr)));
782 if (mListDelegatePoiters.empty())
794 CAmDelegagePtr delegatePoiter = mListDelegatePoiters.front();
795 mListDelegatePoiters.pop_front();
796 if (delegatePoiter->call(mReturnPipe))
797 delete delegatePoiter;
798 if (mListDelegatePoiters.empty())
815 mpSocketHandler(iSocketHandler),
816 mListDelegatePoiters(),
818 dispatcherCallbackT(this, &
CAmSerializer::dispatcherCallback),
821 assert(NULL!=iSocketHandler);
823 if (pipe(mPipe) == -1)
825 logError(
"CAmSerializer could not create pipe!");
826 throw std::runtime_error(
"CAmSerializer Could not open pipe!");
829 if (pipe(mReturnPipe) == -1)
831 logError(
"CAmSerializer could not create mReturnPipe!");
832 throw std::runtime_error(
"CAmSerializer Could not open mReturnPipe!");
837 mpSocketHandler->
addFDPoll(mPipe[0], event, NULL, &receiverCallbackT, &checkerCallbackT, &dispatcherCallbackT, NULL, mHandle);
845 close(mReturnPipe[0]);
846 close(mReturnPipe[1]);
867 SyncCallType =
false, AsyncCallType =
true 870 virtual ~CAmDelegate()
874 virtual CallType call(
int* pipe)=0;
880 template<
class TInvocation>
881 class CAmDelegateAsyncImpl:
public CAmDelegate
883 TInvocation mInvocation;
886 CAmDelegateAsyncImpl(TInvocation && invocation) :
887 mInvocation(std::move(invocation))
891 CallType call(
int* pipe)
895 return (AsyncCallType);
900 template<
class TInvocation,
class TRet>
901 class CAmDelegateSyncImpl:
public CAmDelegate
903 TInvocation mInvocation;
907 CAmDelegateSyncImpl(TInvocation && invocation, TRet && ret) :
908 mInvocation(std::move(invocation)), mReturn(ret)
912 CallType call(
int* pipe)
914 mReturn = mInvocation();
916 result = write(pipe[1],
this,
sizeof(
this));
918 logError(
"CAmSerializer: Problem writing into pipe! Error No:", errno);
919 return (SyncCallType);
924 template<
class TInvocation>
925 class CAmDelegateSyncVoidImpl:
public CAmDelegate
927 TInvocation mInvocation;
930 CAmDelegateSyncVoidImpl(TInvocation && invocation) :
931 mInvocation(std::move(invocation))
935 CallType call(
int* pipe)
939 result = write(pipe[1],
this,
sizeof(
this));
941 logError(
"CAmSerializer: Problem writing into pipe! Error No:", errno);
942 return (SyncCallType);
947 typedef CAmDelegate* CAmDelegagePtr;
949 void sendSync(CAmDelegagePtr pDelegate)
953 CAmDelegagePtr *p = NULL;
954 if ((numReads = read(mReturnPipe[0], &p,
sizeof(p))) == -1)
956 logError(
"CAmSerializer::doSyncCall could not read pipe!");
957 throw std::runtime_error(
"CAmSerializer Could not read pipe!");
965 inline void send(CAmDelegagePtr p)
967 if (write(mPipe[1], &p,
sizeof(p)) == -1)
969 throw std::runtime_error(
"could not write to pipe !");
977 std::deque<CAmDelegagePtr> mListDelegatePointers;
986 return mListDelegatePointers.size();
998 template<
class TFunc>
1001 static_assert(std::is_bind_expression<TFunc>::value,
"The type is not produced by std::bind");
1002 typedef CAmDelegateAsyncImpl<TFunc> AsyncDelegate;
1003 AsyncDelegate *pImp =
new AsyncDelegate(std::forward<TFunc>(invocation));
1027 template<
class TClass,
class TMeth,
class TRet,
class ... TArgs>
1028 void asyncCall(TClass* instance, TMeth method, TArgs && ... arguments)
1030 auto invocation = std::bind(method, instance, std::forward<TArgs>(arguments)...);
1031 asyncInvocation(invocation);
1034 template<
class TClass,
class TMeth,
class ... TArgs>
1035 void asyncCall(TClass* instance, TMeth method, TArgs && ... arguments)
1037 auto invocation = std::bind(method, instance, std::forward<TArgs>(arguments)...);
1038 asyncInvocation(invocation);
1052 template<
class TFunc,
class TRet>
1055 static_assert(std::is_bind_expression<TFunc>::value,
"The type is not produced by std::bind");
1057 typedef CAmDelegateSyncImpl<TFunc, TRet> SyncDelegate;
1059 SyncDelegate *pImp =
new SyncDelegate(std::forward<TFunc>(invocation), std::forward<TRet>(result));
1074 template<
class TFunc>
1077 static_assert(std::is_bind_expression<TFunc>::value,
"The type is not produced by std::bind");
1079 typedef CAmDelegateSyncVoidImpl<TFunc> SyncDelegate;
1081 SyncDelegate *pImp =
new SyncDelegate(std::forward<TFunc>(invocation));
1107 template<
class TClass,
class TMeth,
class TRet,
class ... TArgs>
1108 void syncCall(TClass* instance, TMeth method, TRet & result, TArgs && ... arguments)
1110 auto invocation = std::bind(method, instance, std::ref(arguments)...);
1111 syncInvocation(invocation, result);
1114 template<
class TClass,
class TMeth,
class ... TArgs>
1115 void syncCall(TClass* instance, TMeth method, TArgs && ... arguments)
1117 auto invocation = std::bind(method, instance, std::ref(arguments)...);
1118 syncInvocation(invocation);
1129 CAmDelegagePtr listPointers[3];
1130 if ((numReads = read(pollfd.fd, &listPointers,
sizeof(listPointers))) == -1)
1132 logError(
"CAmSerializer::receiverCallback could not read pipe!");
1133 throw std::runtime_error(
"CAmSerializer Could not read pipe!");
1135 mListDelegatePointers.assign(listPointers, listPointers + (numReads /
sizeof(CAmDelegagePtr)));
1145 if (mListDelegatePointers.empty())
1157 CAmDelegagePtr delegatePoiter = mListDelegatePointers.front();
1158 mListDelegatePointers.pop_front();
1159 if (delegatePoiter->call(mReturnPipe))
1160 delete delegatePoiter;
1161 if (mListDelegatePointers.empty())
1178 mpSocketHandler(iSocketHandler),
1179 mListDelegatePointers(),
1181 dispatcherCallbackT(this, &
CAmSerializer::dispatcherCallback),
1184 assert(NULL!=iSocketHandler);
1186 if (pipe(mPipe) == -1)
1188 logError(
"CAmSerializer could not create pipe!");
1189 throw std::runtime_error(
"CAmSerializer Could not open pipe!");
1192 if (pipe(mReturnPipe) == -1)
1194 logError(
"CAmSerializer could not create mReturnPipe!");
1195 throw std::runtime_error(
"CAmSerializer Could not open mReturnPipe!");
1200 mpSocketHandler->
addFDPoll(mPipe[0], event, NULL, &receiverCallbackT, &checkerCallbackT, &dispatcherCallbackT, NULL, mHandle);
1208 close(mReturnPipe[0]);
1209 close(mReturnPipe[1]);
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &argument, Targ1 argument1), Targ &argument, Targ1 argument1)
calls a function with two arguments asynchronously threadsafe, first argument is a reference...
void asyncInvocation(TFunc invocation)
calls a function with variadic arguments threadsafe
A Common-API wrapper class, which loads the common-api runtime and instantiates all necessary objects...
TAmShPollFired< CAmSerializer > receiverCallbackT
Helper structures used within std::bind for automatically identification of all placeholders.
TAmShPollFired< CAmSerializer > receiverCallbackT
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, TargCall1, TargCall2, TargCall3, TargCall4), TretVal &retVal, Targ &argument, Targ1 &argument1, Targ2 &argument2, Targ3 &argument3, Targ4 &argument4)
calls a function with five arguments synchronously threadsafe.
bool dispatcherCallback(const sh_pollHandle_t handle, void *userData)
dispatcher callback for sockethandling, for more, see CAmSocketHandler
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 argument1, Targ2 argument2), Targ argument, Targ1 argument1, Targ2 argument2)
calls a function with three arguments asynchronously threadsafe.
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(), TretVal &retVal)
calls a synchronous function with no arguments threadsafe
TAmShPollDispatch< CAmSerializer > dispatcherCallbackT
size_t getListDelegatePointers()
get the size of delegate pointers
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, Targ1Call), TretVal &retVal, Targ &argument, Targ1 &argument1)
calls a function with two arguments synchronously threadsafe.
void asyncCall(TClass *instance, TRet(TClass::*method)(TArgs...), TArgs &...arguments)
calls a function with variadic arguments threadsafe
int getListDelegatePoiters()
get the size of delegate pointers
make private, not public template for a callback
The am::CAmSocketHandler implements a mainloop for the AudioManager.
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3), Targ argument, Targ1 argument1, Targ2 argument2, Targ3 argument3)
calls a function with four arguments asynchronously threadsafe.
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ), Targ argument)
calls a function with one arguments asynchronously threadsafe
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &argument, Targ1 argument1, Targ2 argument2), Targ &argument, Targ1 argument1, Targ2 argument2)
calls a function with three arguments asynchronously threadsafe.
void syncCall(TClass *instance, TMeth method, TArgs &&...arguments)
uint16_t sh_pollHandle_t
this is a handle for a filedescriptor to be used with the SocketHandler
SPDX license identifier: MPL-2.0.
void asyncCall(TClass *instance, void(TClass::*function)())
calls a function with no arguments threadsafe
am_Error_e removeFDPoll(const sh_pollHandle_t handle)
removes a filedescriptor from the poll loop
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, Targ1Call) const, TretVal &retVal, Targ &argument, Targ1 &argument1)
calls a function with two arguments synchronously threadsafe const.
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, TargCall1, TargCall2) const, TretVal &retVal, Targ &argument, Targ1 &argument1, Targ2 &argument2)
calls a const function with three arguments synchronously threadsafe.
CAmSerializer(CAmSocketHandler *iSocketHandler)
The constructor must be called in the mainthread context !
CAmSerializer(CAmSocketHandler *iSocketHandler)
The constructor must be called in the mainthread context !
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 &argument1, Targ2 argument2), Targ argument, Targ1 &argument1, Targ2 argument2)
calls a function with three arguments asynchronously threadsafe.
void syncInvocation(TFunc invocation)
calls a function with variadic arguments threadsafe
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall) const, TretVal &retVal, Targ &argument)
calls a function with one argument synchronous threadsafe for const functions.
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, TargCall1, TargCall2, TargCall3), TretVal &retVal, Targ &argument, Targ1 &argument1, Targ2 &argument2, Targ3 &argument3)
calls a function with four arguments synchronously threadsafe.
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 &argument1, Targ2 &argument2), Targ argument, Targ1 &argument1, Targ2 &argument2)
calls a function with three arguments asynchronously threadsafe.
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &argument, Targ1 &argument1), Targ &argument, Targ1 &argument1)
calls a function with two arguments asynchronously threadsafe, both arguments are references...
bool dispatcherCallback(const sh_pollHandle_t handle, void *userData)
dispatcher callback for sockethandling, for more, see CAmSocketHandler
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, TargCall1, TargCall2, TargCall3, TargCall4, TargCall5), TretVal &retVal, Targ &argument, Targ1 &argument1, Targ2 &argument2, Targ3 &argument3, Targ4 &argument4, Targ5 &argument5)
calls a function with six arguments synchronously threadsafe.
am_Error_e addFDPoll(const int fd, const short event, std::function< void(const sh_pollHandle_t handle, void *userData)> prepare, std::function< void(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)> fired, std::function< bool(const sh_pollHandle_t handle, void *userData)> check, std::function< bool(const sh_pollHandle_t handle, void *userData)> dispatch, void *userData, sh_pollHandle_t &handle)
Adds a filedescriptor to the polling loop.
TAmShPollDispatch< CAmSerializer > dispatcherCallbackT
void doSyncCall(Class intsance, Method method, Return &result, Tuple &arguments)
instantiates a sync delegate with given arguments and sends the delegate pointer over the pipe ...
SPDX license identifier: MPL-2.0.
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall, TargCall1, TargCall2), TretVal &retVal, Targ &argument, Targ1 &argument1, Targ2 &argument2)
calls a function with three arguments synchronously threadsafe.
void logError(T value, TArgs...args)
logs given values with errorlevel with the default context
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 argument1), Targ argument, Targ1 argument1)
calls a function with two arguments asynchronously threadsafe.
void syncCall(TClass1 *instance, TretVal(TClass1::*function)(TargCall), TretVal &retVal, Targ &argument)
calls a function with one argument synchronous threadsafe
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 argument1, Targ2 &argument2), Targ argument, Targ1 argument1, Targ2 &argument2)
calls a function with three arguments asynchronously threadsafe.
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &argument, Targ1 &argument1, Targ2 argument2), Targ &argument, Targ1 &argument1, Targ2 argument2)
calls a function with three arguments asynchronously threadsafe.
void doAsyncCall(Class intsance, Method method, Tuple &arguments)
instantiates a async delegate with given arguments and sends the delegate pointer over the pipe ...
void syncCall(TClass *instance, TRet(TClass::*method)(TArgs...), TRet &result, TArgs &...arguments)
calls a function with variadic arguments threadsafe
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &), Targ &argument)
calls a function with one argument called by reference asynchronously threadsafe
bool checkerCallback(const sh_pollHandle_t handle, void *userData)
checker callback for sockethandling, for more, see CAmSocketHandler
void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
receiver callback for sockethandling, for more, see CAmSocketHandler
TAmShPollCheck< CAmSerializer > checkerCallbackT
TAmShPollCheck< CAmSerializer > checkerCallbackT
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ argument, Targ1 &argument1), Targ argument, Targ1 &argument1)
calls a function with two arguments asynchronously threadsafe, second argument is a reference...
void receiverCallback(const pollfd pollfd, const sh_pollHandle_t handle, void *userData)
receiver callback for sockethandling, for more, see CAmSocketHandler
bool checkerCallback(const sh_pollHandle_t handle, void *userData)
checker callback for sockethandling, for more, see CAmSocketHandler
void asyncCall(TClass *instance, TMeth method, TArgs &&...arguments)
calls a function with variadic arguments threadsafe
void asyncCall(TClass *instance, TMeth method, TArgs &&...arguments)
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &argument, Targ1 argument1, Targ2 &argument2), Targ &argument, Targ1 argument1, Targ2 &argument2)
calls a function with three arguments asynchronously threadsafe.
void syncInvocation(TFunc invocation, TRet &&result)
calls a function with variadic arguments threadsafe
void syncCall(TClass *instance, TMeth method, TRet &result, TArgs &&...arguments)
calls a function with variadic arguments threadsafe
void asyncCall(TClass1 *instance, void(TClass1::*function)(Targ &argument, Targ1 &argument1, Targ2 &argument2), Targ &argument, Targ1 &argument1, Targ2 &argument2)
calls a function with three arguments asynchronously threadsafe.