File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ void loop() {
5555 out_packer.clear ();
5656
5757 blink_before ();
58- int out = wrapped_add (5 , 3 );
58+ int out = (* wrapped_add) (5 , 3 );
5959
60- bool unpack_ok = wrapped_add (unpacker, out_packer);
60+ bool unpack_ok = (* wrapped_add) (unpacker, out_packer);
6161
6262 Serial.print (" simple call: " );
6363 Serial.println (out);
@@ -82,7 +82,7 @@ void loop() {
8282 unpacker.feed (packer.data (), packer.size ());
8383 out_packer.clear ();
8484
85- bool should_be_false = wrapped_divide (unpacker, out_packer);
85+ bool should_be_false = (* wrapped_divide) (unpacker, out_packer);
8686
8787 if (!should_be_false){
8888 Serial.println (" RPC error call divide by zero " );
@@ -103,7 +103,7 @@ void loop() {
103103 unpacker.clear ();
104104 unpacker.feed (packer.data (), packer.size ());
105105 out_packer.clear ();
106- wrapped_hello (unpacker, out_packer);
106+ (* wrapped_hello) (unpacker, out_packer);
107107
108108 for (size_t i=0 ; i<out_packer.size (); i++){
109109 Serial.print (out_packer.data ()[i], HEX);
Original file line number Diff line number Diff line change @@ -19,9 +19,7 @@ class RpcFunctionDispatcher {
1919
2020 if (isBound (name)) return false ;
2121
22- using WrapperT = decltype (wrap (std::forward<F>(f)));
23- WrapperT* instance = new WrapperT (wrap (std::forward<F>(f)));
24- _entries[_count++] = {name, tag, instance};
22+ _entries[_count++] = {name, tag, wrap (std::forward<F>(f))};
2523 return true ;
2624 }
2725
Original file line number Diff line number Diff line change @@ -100,11 +100,10 @@ class RpcFunctionWrapper<std::function<R(Args...)>>: public IFunctionWrapper {
100100 }
101101};
102102
103-
104103template <typename F>
105- auto wrap (F&& f) -> RpcFunctionWrapper<typename arx::function_traits<typename std::decay<F>::type>::function_type> {
104+ auto wrap (F&& f) -> RpcFunctionWrapper<typename arx::function_traits<typename std::decay<F>::type>::function_type>* {
106105 using Signature = typename arx::function_traits<typename std::decay<F>::type>::function_type;
107- return RpcFunctionWrapper<Signature>(std::forward<F>(f));
106+ return new RpcFunctionWrapper<Signature>(std::forward<F>(f));
108107};
109108
110109#endif
You can’t perform that action at this time.
0 commit comments