I have an API for managing a camera configuration. There are 344 individual options to manage. When a certain value changes the API calls a callback function to notify the p
You do not provide many details about the camera API or the semantics of the call; if it is publicly available software a link to the actual documentation would be helpful.
In any case I found the question interesting and will show a solution below which uses the fact that we can generate different functions with templates, instead of coding them by hand.
The code below assumes that the Option *ptr parameter in void RegisterCallback(Option *ptr, void (fn*)(void*)) is a pointer which you obtained from the camera; it serves as an indicator to the camera API for which option you want to register this callback. Conceivably the camera API has an enumeration with 344 members or such for this, which would replace the size_t template parameters and map key type below.
A simple recursive template function is called to register a callback for each of the 344 options.
#include
#include
Sample session:
$ g++ -Wall -o callbacks callbacks.cpp && ./callbacks
reacting to change in property 0
reacting to change in property 2
property callback for 343 not yet implemented