|
Cortex 6.0.0
|
#include <Reader.h>
Inheritance diagram for IECore::Reader:Classes | |
| class | ReaderDescription |
Public Member Functions | |
| IE_CORE_DECLARERUNTIMETYPED (Reader, Op) | |
| const std::string & | fileName () const |
| virtual CompoundObjectPtr | readHeader () |
| ObjectPtr | read () |
Protected Member Functions | |
| Reader (const std::string &description, ParameterPtr resultParameter=0) | |
Protected Attributes | |
| FileNameParameterPtr | m_fileNameParameter |
Factory functions | |
| //////////////////////////////////////////////////////////////////////// | |
| typedef boost::function < ReaderPtr(const std::string &fileName)> | CreatorFn |
| typedef boost::function< bool(const std::string &fileName)> | CanReadFn |
| static ReaderPtr | create (const std::string &fileName) |
| static void | supportedExtensions (std::vector< std::string > &extensions) |
| static void | supportedExtensions (TypeId typeId, std::vector< std::string > &extensions) |
| static void | registerReader (const std::string &extensions, CanReadFn canRead, CreatorFn creator, TypeId typeId) |
The Reader class defines an interface for loading files of arbitrary type in the form of Object instances.
| typedef boost::function<bool ( const std::string &fileName )> IECore::Reader::CanReadFn |
Definition of a function to answer the question can this file be read?
| typedef boost::function<ReaderPtr ( const std::string &fileName )> IECore::Reader::CreatorFn |
Definition of a function which can create a Reader when given a fileName.
| IECore::Reader::Reader | ( | const std::string & | description, |
| ParameterPtr | resultParameter = 0 |
||
| ) | [protected] |
If resultParameter is not specified then creates a resultParameter which is a simple Parameter instance. If a derived class provides more concrete constraints on the type of the result it should pass an appropriate resultParameter in its initialiser.
| static ReaderPtr IECore::Reader::create | ( | const std::string & | fileName | ) | [static] |
| const std::string& IECore::Reader::fileName | ( | ) | const |
Returns the name of the file this Reader is set to read. Actually calls parameters()->parameter<FileNameParameter>( "fileName" )->getTypedValue(); and therefore can potentially throw an Exception if the fileName is invalid.
| ObjectPtr IECore::Reader::read | ( | ) |
Reads the file specified by fileName() and returns it in the form of an Object. This function actually just calls Op::operate() - it's provided for backwards compatibility and prettier syntax.
| virtual CompoundObjectPtr IECore::Reader::readHeader | ( | ) | [virtual] |
Returns the file header in the file specified by fileName(). This is intended to give fast access to some information about the contents of the file, without having to load the entire thing. Classes implementing this method should call the base class method first, and append any additional data to the CompoundObject it returns.
Reimplemented in IECore::EXRImageReader, IECore::ImageReader, and IECore::ObjectReader.
| static void IECore::Reader::registerReader | ( | const std::string & | extensions, |
| CanReadFn | canRead, | ||
| CreatorFn | creator, | ||
| TypeId | typeId | ||
| ) | [static] |
Registers a Reader type which is capable of reading files ending with the space separated extensions specified (e.g. "tif tiff"). Before creating a reader the canRead function will be called as a final check that the Reader is appropriate - if this returns true then the creator function will then be called. If a file has no extension then all registered canRead functions are called in a last ditch attempt to find a suitable reader. Typically you will not call this function directly to register a reader type - you will instead use the ReaderDescription registration utility class below.
| static void IECore::Reader::supportedExtensions | ( | std::vector< std::string > & | extensions | ) | [static] |
Fills the passed vector with all the extensions for which a Reader is available. Extensions are of the form "tif" - ie without a preceding '.'.
| static void IECore::Reader::supportedExtensions | ( | TypeId | typeId, |
| std::vector< std::string > & | extensions | ||
| ) | [static] |
Fills the passed vector with all the extensions for which a Reader of, or inherited from, the given type is available. Extensions are of the form "tif" - ie without a preceding '.'.
1.7.3