I apologize if this has already been posted, but the word 'introspection' doesn't bring any search results in this section of the forum. I also did not find anything in the presentations about introspection, so I assume Poco doesn't have any. Please feel free to correct me.

Anyway, on to the wish: sometimes it is necessary to be able to do actions on code that are defined by runtime parameters; for example, invoking a function by name, getting the fields and methods of a class, walking the inheritance tree, examining the properties of an object, etc. This can be done by introspection, of which C++ does not offer any.

One of the very useful things introspection could do for us is to allow us to convert values from enumerations to integers in a safe manner, as well as automatically discover the names of the values of an enumeration, its minimum and maximum value, the number of values, etc.

I think that the C preprocessor could be 'abused' in some way, along with templates, to provide us a little framework within Poco that can be used to manually provide introspection for our objects.

I don't think the preprocessor would be the right tool for that. Using the CppParser library (can be found in the SVN sandbox) or, even better, Clang, and generating meta information from that may be a better approach.

I agree that the preprocessor might not be the right approach, but using an external tool like Reflex or the cppparser, means that the tool has to be integrated with existing toolsets, which is very difficult and time consuming and error prone for some toolsets.

It is fine when, for example, a project is setup to be compiled via makefiles, but not so fine if the project is to be compiled with an IDE which does not support the tool, like Code::Blocks, Visual Studio and QtCreator.

Visual Studio allows the user to setup an existing tool to be used on each source code file, but I am not sure if any other IDE has the same functionality.

I think that any solution that does not take into account the tools users use will be doomed to fail.

It might even be a better solution to provide the introspection manually, for the required classes, in the form of static constant variables, because this will work across all tools.

I use QT Creator for all my projects. I have a dumb script that I conditionally enable to generate the reflex files. In future, I will probably start comparing header file time stamps and the reflex file timestamp to determine whether genreflex is to be run or not, so I can run the reflex generation script unconditionally when the IDE builds. It is a manual process at present, but works.