Nuke binary plugins 16.1.1
 
Loading...
Searching...
No Matches
DD::Image::GeoDescription Class Reference

#include <GeoReaderDescription.h>

Inheritance diagram for DD::Image::GeoDescription:
DD::Image::ReaderDescription DD::Image::Description

Public Types

typedef bool(* FilenameTester) (const std::string &filename)
 
typedef bool(* FilenameTesterExt) (const std::string &filename, std::string &errorOut)
 
typedef std::variant< std::monostate, FilenameTester, FilenameTesterExtFilenameTesterVariant
 
typedef GeoReader *(* Constructor) (ReadGeo *, int fd, const unsigned char *buf, int bufsize)
 
typedef bool(* Tester) (int fd, const unsigned char *buf, int bufsize)
 
typedef GeoReaderFormat *(* GeoReaderFormatConstructor) (ReadGeo *)
 
- Public Types inherited from DD::Image::Description
using DescriptionList = std::vector< Description * >
 
using NodeBuilder = std::function< Node *(void *)>
 

Public Member Functions

 GeoDescription (const char *n, Constructor c, GeoReaderFormatConstructor fmtConstructor, Tester t=nullptr, License *f=nullptr, bool needFd=true)
 
 GeoDescription (const char *n, Constructor c, GeoReaderFormatConstructor fmtConstructor, FilenameTester ft, License *f=nullptr, bool needFd=true)
 
 GeoDescription (const char *n, Constructor c, GeoReaderFormatConstructor fmtConstructor, FilenameTesterExt ft, License *f=nullptr, bool needFd=true)
 
- Public Member Functions inherited from DD::Image::ReaderDescription
 ReaderDescription (const char *n, const char *l)
 

Static Public Member Functions

static const GeoDescriptionfind (int i)
 
static const GeoDescriptionfind (const char *name)
 
static FilenameTesterVariant findFilenameTester (const GeoDescription *desc)
 
static bool testFilename (const FilenameTesterVariant &tester, const std::string &filename, std::string &errorOut)
 
- Static Public Member Functions inherited from DD::Image::ReaderDescription
static const Descriptionfind (const DescriptionList &list, const char *name, const char *pluginSuffix, const char *&triedPlugin)
 

Public Attributes

Constructor _constructor
 
GeoReaderFormatConstructor _format_constructor
 
Tester _test
 
bool _needFd
 
- Public Attributes inherited from DD::Image::ReaderDescription
const char * names
 
const char * label
 
- Public Attributes inherited from DD::Image::Description
const char * compiled
 
const char * plugin
 
Licenselicense
 

Static Public Attributes

static DD::Image::Description::DescriptionList _collection
 

Additional Inherited Members

- Protected Member Functions inherited from DD::Image::Description
void ctor (void(*f)(Description *))
 
void ctor (void(*f)(Description *), NodeBuilder nodeBuilder)
 

Detailed Description

This structure describes a subclass of GeoReader. The constructor builds these into a list that ReadGeo operators search to find a way to read a filename given to them.

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);
Definition: Description.h:104
Definition: GeoReader.h:33

Member Typedef Documentation

◆ FilenameTester

typedef bool(* DD::Image::GeoDescription::FilenameTester) (const std::string &filename)

Filename tester: returns true if the reader claims the file

◆ FilenameTesterExt

typedef bool(* DD::Image::GeoDescription::FilenameTesterExt) (const std::string &filename, std::string &errorOut)

Extended filename tester: returns true if the reader claims the file. If returning false it may populate 'errorOut' with a human readable reason which may be surfaced to the user when an explicit type was requested or no reader matched.

◆ FilenameTesterVariant

Type alias for the variant containing different filename tester types.

Constructor & Destructor Documentation

◆ GeoDescription() [1/3]

DD::Image::GeoDescription::GeoDescription ( const char *  n,
Constructor  c,
GeoReaderFormatConstructor  fmtConstructor,
Tester  t = nullptr,
License f = nullptr,
bool  needFd = true 
)
inline

Simpler constructor that sets names and label to same value.

◆ GeoDescription() [2/3]

DD::Image::GeoDescription::GeoDescription ( const char *  n,
Constructor  c,
GeoReaderFormatConstructor  fmtConstructor,
FilenameTester  ft,
License f = nullptr,
bool  needFd = true 
)
inline

This constructor takes a FilenameTester parameter. FilenameTester is a function pointer to test a file's compatibility with the reader using the given filename. This is an alternative to using GeoDescription::Tester which requires a file descriptor.

◆ GeoDescription() [3/3]

DD::Image::GeoDescription::GeoDescription ( const char *  n,
Constructor  c,
GeoReaderFormatConstructor  fmtConstructor,
FilenameTesterExt  ft,
License f = nullptr,
bool  needFd = true 
)
inline

This constructor takes a FilenameTesterExt parameter. FilenameTesterExt is a function pointer to test a file's compatibility with the reader using the given filename. If the test fails, it can provide a human-readable error message. This is an alternative to using GeoDescription::Tester which requires a file descriptor.

Member Function Documentation

◆ find() [1/2]

const GeoDescription * GeoDescription::find ( int  i)
static

Return the i'th GeoDescription known about, or return a null pointer for the last one.

References _collection.

◆ find() [2/2]

const GeoDescription * GeoDescription::find ( const char *  name)
static

Search all the defined GeoDescriptions for one whose name matches the passed string, or return null pointer if none.

References _collection.

◆ findFilenameTester()

GeoDescription::FilenameTesterVariant GeoDescription::findFilenameTester ( const GeoDescription desc)
static

Search all the defined FilenameTesters for one which is related to the passed /p desc, or return null variant if none. Returns a variant containing either FilenameTester or FilenameTesterExt.

◆ testFilename()

bool GeoDescription::testFilename ( const FilenameTesterVariant tester,
const std::string &  filename,
std::string &  errorOut 
)
static

Helper function to test a filename using a FilenameTesterVariant. Returns true if the tester accepts the file, false otherwise. If the tester is FilenameTesterExt and returns false, errorOut will contain the error message.

Member Data Documentation

◆ _collection

DD::Image::Description::DescriptionList GeoDescription::_collection
static

A list of pointers to all possible Descriptions to be used for instantiation of geo plugins.

Referenced by find().

◆ _constructor

Constructor DD::Image::GeoDescription::_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).

◆ _test

Tester DD::Image::GeoDescription::_test

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.

◆ _needFd

bool DD::Image::GeoDescription::_needFd

whether or not the file descriptor is really needed (defaults to true)

if false then any open FD on the file will be closed before build is called, and -1 passed in



©2026 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com