Change selection method implementation to use C++
This would make it easier to publish the API for creating new selection methods in the C++ framework, and it would also make it more robust and easier to use and to maintain.
The current implementation should map quite straightforwardly to C++. gmx_ana_selmethod_t should be made into a base class or an interface with virtual methods for each function pointer currently used, and all places where it is used should be adapted accordingly. Implementations of individual keywords in sm_*.cpp should be changed to be subclasses of it. The main difficulty is in handling options (that currently use an array of gmx_ana_selparam_t structures). It should be possible to use the options implementation in src/gromacs/options/, but it will need a non-trivial extension.
Enable C++ use in selection methods.
The method that frees the internal data structure for a selection method
now also has the responsibility of freeing the data structure itself.
This makes it possible to allocate the data structure using operator new
in the initialization function, and then correctly free it.
Prerequisite for using C++ types in selection methods before #652 is
#6 Updated by Teemu Murtola about 7 years ago
Is it realistic/necessary to plan to do this for 5.0? This is a large effort, with very little user-visible effects. Even the API doesn't change, unless we expose a way to add custom selection keywords (which this task would enable). Unless some extra refactoring is also done (haven't created any Redmine task for that yet), it may also make the C/C++ mixture in the selection code even messier...