#include <fits_factory.h>
Static Public Member Functions | |
| bool | Register (const fits_keyval_set &fkvs, abstract_product *(*creator)(const iofits &)) |
| abstract_product * | create (const iofits &iof) |
The fits_keyval_header_map between pairs of strings and integers is intended to facilitate polymorphic reading and writing of aggregate and multiply inherited objects. The idea is that for one of these compound objects, the first fits header would hold information necessary to identify the compound object, and subsequent fits HDU's would hold the atomic objects. Thus the factory must know which keyval pairs to look for in each header, and the int contains this information. Since every compound object may itself become incorporated into a larger object through inheritance or aggregation, we interpret the integer identifying the fits HDU as a relative offset from the current HDU. In order for this scheme to work, the fits_keyval_header_map must be sorted from smallest header offset (zero offset) to largest header offset. The Register function ensures that this is the case by sorting the vector of fits
The first entry in the pair of strings must match the fits header key exactly. The second entry in the map must either match the fits header value exactly, or must be empty. If the second entry in the map is empty then this class will consider the entry a match if the first entry matches the fits header key.
This class was modelled after the Object Factory class described by Alexandrescu in "Modern C++ design". While this class could almost have been generated from an instantiation of the more general class he proposed, this instantiation would have relied on his functor, typelist, and singleton classes. Since no version of his library is available as yet, I wrote this simpler version.
|
||||||||||
|
|
|
||||||||||||||||
|
|
1.3.9.1