Public Types | |
typedef GeoReader *(* | Constructor )(ReadGeo *, int fd, const unsigned char *buf, int bufsize) |
typedef bool(* | Tester )(int fd, const unsigned char *buf, int bufsize) |
Public Member Functions | |
Description (const char *n, const char *l, Constructor c, Tester t=0, License *f=0) | |
Description (const char *n, Constructor c, Tester t=0, License *f=0) | |
Static Public Member Functions | |
static const Description * | find (int i) |
static const Description * | find (const char *name) |
Public Attributes | |
Constructor | constructor |
Tester | test |
Sample code for a plugin that defines a GeoReader:
class MyReader : public GeoReader { static const Description d; ... }; static GeoReader* build(int fd, const unsigned char* b, int n) { return new MyReader(fd, b, n); } static bool test(int fd, const unsigned char *block, int) { return (block[0] == MY_MAGIC_BYTE); } const GeoReader::Description MyReader::d("myf\0", "my file format", build, test);
DD::Image::GeoReader::Description::Description | ( | const char * | n, | |
const char * | l, | |||
Constructor | c, | |||
Tester | t = 0 , |
|||
License * | f = 0 | |||
) | [inline] |
Constructor that fills all fields and allows a license check.
DD::Image::GeoReader::Description::Description | ( | const char * | n, | |
Constructor | c, | |||
Tester | t = 0 , |
|||
License * | f = 0 | |||
) | [inline] |
Simpler constructor that sets names and label to same value.
Constructor DD::Image::GeoReader::Description::constructor |
Make an instance of the reader.
If test is not null then fd is an opened file, it is seeked to bufsize, and buf contains the first bufsize bytes of the file. You can use this data to store stuff into the info_ (however you cannot report error messages and filename() does not work yet).
If this pointer is non-null, it indicates a named Unix file is used to store the image. In this case Read will open the file and call this function. If it returns non-zero then the constructor will be called. This allows Read to poll all the Readers to see which one can read an unknown file format.
If this is null then zero is passed as the fd to the constructors.
buf points at the first bufsize characters of the file. bufsize is at least 512. If necessary you can mess with the fd, but be sure to seek it back to bufsize.
©2009 The Foundry Visionmongers, Ltd. All Rights Reserved. |