Questions tagged [callback]
Callback is facility to save a piece of code so that it may be invoked later in the current environment (Typically in response to an event)
171 questions
4
votes
1
answer
357
views
Is this a sane (as in lacking UB) implementation of a ref-counted subscription cleanup?
AutoCancel is a class which wraps a Cancel (aka void()) function. The purpose of wrapping ...
4
votes
1
answer
177
views
Member (virtual or not) function to C callback by generating static version at compile time
I've started to write a header-only implementation of callback for member functions :
...
1
vote
1
answer
172
views
C++ Structural Requests System with Payload Management
First things first, I'd thank Mr. G. Sliepen and Mr. Davislor regarding their help in the previous questions (C++ System data transfer design) (C++ System data transfer design - Following 1), given ...
6
votes
2
answers
493
views
c++ multithreaded message broadcaster with link lifetime management v3
note: This is v3 of code that was previously reviewed.
I have written a class that handles listeners registering callbacks to receive messages. Link lifetime is managed (or is it? See below). Code is ...
2
votes
1
answer
375
views
An NVIDIA Jetson Nano GPIO Wheel Encoder Message Publisher using ROS2
Although this code uses ros2 my concern is about C++ code quality, because I still struggle when it comes to making good design ...
1
vote
1
answer
676
views
Delphi - did I understand callbacks correctly?
I am trying to learn callbacks in Delphi (7). Could not find a complete simple tutorial, so I puzzled together a few bits here and there. This is my first attempt, of course trivial.
My form contains ...
3
votes
2
answers
1k
views
Wait for a callback and then using the result
I'm using Frida to run a script on a process, and I want to wait for it to send the result back to me, as a callback.
My current code looks like this:
...
7
votes
1
answer
559
views
TFunction: std::function replacement for event system
I've been trying to implement delegate for my event system. I thought that maybe std::function can do the trick for me, but it turned out to be not comparable, so what i have end up doing is this - ...
2
votes
1
answer
263
views
Event callbacks library
This is a small library I wrote to make event callbacks with variadic templates work like C#'s event system (placeholder template by "dyp" at http://stackoverflow.com/a/21664270).
Just like ...
1
vote
1
answer
128
views
c++ multithreaded message broadcaster with link lifetime management v2
note: This is v2 of code that was previously reviewed.
I have written a class that handles listeners registering callbacks to receive messages. Link lifetime is managed (or is it?). Code is ...
1
vote
1
answer
111
views
c++ multithreaded message broadcaster with link lifetime management
note: A version of this code without link lifetime management was previously reviewed. Adding lifetime management actually made the code simpler, and the class simpler to use.
I have written a class ...
2
votes
1
answer
1k
views
Generic Event class
C++ Event class
From the desire of having a callback function which includes a void* userdata argument, I've made this generic event class.
It is tested and working, but some desired features are ...
1
vote
2
answers
1k
views
C++ Observer Pattern with std::function
I am/we are using the observer pattern for many things in our application. I think it's time to create a reusable base class for these situations. Most implementations I could find only do something ...
3
votes
2
answers
128
views
Simplify 2D point angle comparator
I have a comparison function for comparing two points in 2 (or more) dimensions based on the angle of each point in standard polar coordinates. In other words, a point ...
7
votes
3
answers
2k
views
C++ Generic Callback class with removable listeners by unique id
I'm quite new to the STL.
Does this make sense? Is there a better way of removing the listeners instead of using shared_ptr while keeping the code short and simple? Is there something in the STL to ...