I am currently working with a program here at work that collects hardware information from a computer and reports it back. The API of this program is similar to the following:
1. I create a callback function to "do something" with the data that gets returned.
2. I then call an "enumerateInstances()" method for each hardware item I am interested in, passing in the callback function as a parameter. This function populates a structure with all of the obtained information.
The problem I have is that there are nearly 600 separate classes to deal with (each representing a various area of the computer hardware). I'd rather not write 600 functions to print each struct (each of which is different, by the way). Is there a way to write one function that prints an arbitrary structure in a humane manner? Debuggers seem to be able to do this kind of thing - how do they do it?
1. I create a callback function to "do something" with the data that gets returned.
2. I then call an "enumerateInstances()" method for each hardware item I am interested in, passing in the callback function as a parameter. This function populates a structure with all of the obtained information.
The problem I have is that there are nearly 600 separate classes to deal with (each representing a various area of the computer hardware). I'd rather not write 600 functions to print each struct (each of which is different, by the way). Is there a way to write one function that prints an arbitrary structure in a humane manner? Debuggers seem to be able to do this kind of thing - how do they do it?