next up previous contents index
Next: G_List and GraphicDevice Up: Problems Previous: Strings and Opaque Data

Function Pointers

Archiving functions pointers obviously is not possible. The Fe2d function pointer f for example is ignored, it has to be set to the correct function when data is read in. There are two ways to solve this problem: using subclasses or indices.

Instead of using the Fe2d data pointer to store the FE data you should create a subclass with its own data pointer which has a specific type. The subclass' "xdr" function then can write/read the data without problems, it also can restore the correct FE function on reading.

Another possibility is to assign an index to each function. On writing the index for the function is written, on reading the function can be restored from the index. Of course this is only possible if a fixed set of functions is used.



SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.