#include <Writer.h>

Classes | |
| class | WriterDescription |
| struct | WriterFns |
Public Member Functions | |
| const std::string & | fileName () const |
| const Object * | object () const |
| void | write () |
Static Public Member Functions | |
| static WriterPtr | create (ObjectPtr object, const std::string &fileName) |
| static void | supportedExtensions (std::vector< std::string > &extensions) |
| static void | supportedExtensions (TypeId typeId, std::vector< std::string > &extensions) |
Protected Types | |
| typedef WriterPtr(* | CreatorFn )(ObjectPtr object, const std::string &fileName) |
| typedef bool(* | CanWriteFn )(ConstObjectPtr object, const std::string &fileName) |
Protected Member Functions | |
| Writer (const std::string &description, TypeId writableType) | |
| Writer (const std::string &description, const ObjectParameter::TypeIdSet &writableTypes) | |
| ObjectPtr | doOperation (const CompoundObject *operands) |
| Implemented to call doWrite(), so derived classes need only implement that. | |
| virtual void | doWrite (const CompoundObject *operands)=0 |
Static Protected Member Functions | |
| static void | registerWriter (const std::string &extensions, CanWriteFn canWrite, CreatorFn creator, TypeId typeId) |
Protected Attributes | |
| ParameterPtr | m_objectParameter |
| FileNameParameterPtr | m_fileNameParameter |
typedef bool(* IECore::Writer::CanWriteFn)(ConstObjectPtr object, const std::string &fileName) [protected] |
Definition of a function to answer the question can this object be written to this file?
typedef WriterPtr(* IECore::Writer::CreatorFn)(ObjectPtr object, const std::string &fileName) [protected] |
Definition of a function which can create a Writer when given an object and fileName.
| Writer::Writer | ( | const std::string & | description, | |
| TypeId | writableType | |||
| ) | [protected] |
| Writer::Writer | ( | const std::string & | description, | |
| const ObjectParameter::TypeIdSet & | writableTypes | |||
| ) | [protected] |
| WriterPtr Writer::create | ( | ObjectPtr | object, | |
| const std::string & | fileName | |||
| ) | [static] |
| ObjectPtr Writer::doOperation | ( | const CompoundObject * | operands | ) | [protected, virtual] |
Implemented to call doWrite(), so derived classes need only implement that.
Implements IECore::Op.
References doWrite(), and m_objectParameter.
| virtual void IECore::Writer::doWrite | ( | const CompoundObject * | operands | ) | [protected, pure virtual] |
Must be implemented by subclasses to write object() to fileName(). Implementations should throw an Exception on failure.
Implemented in IECore::ObjectWriter, and IECoreRI::RIBWriter.
Referenced by doOperation().
| const std::string & Writer::fileName | ( | ) | const |
Returns the name of the file this Writer is set to create. This is just a convenience returning the equivalent of parameters()->parameter<FileNameParameter>( "fileName" )->getTypedValue().
References m_fileNameParameter.
Referenced by IECoreRI::RIBWriter::doWrite(), IECore::ObjectWriter::doWrite(), and IECore::TIFFImageWriter::encodeChannels().
| const Object * Writer::object | ( | ) | const |
Returns the Object this Writer will use to write the file. This is just a convenience returning the equivalent of parameters()->parameter<Parameter>( "object" )->getValue().
References m_objectParameter.
Referenced by IECoreRI::RIBWriter::doWrite(), IECore::ObjectWriter::doWrite(), IECore::ImageWriter::getImage(), and IECore::ParticleWriter::particleObject().
| void Writer::registerWriter | ( | const std::string & | extensions, | |
| CanWriteFn | canWrite, | |||
| CreatorFn | creator, | |||
| TypeId | typeId | |||
| ) | [static, protected] |
Registers a Writer type which is capable of writing files ending with the space separated extensions specified (e.g. "tif tiff"). Before creating a Writer the canWrite function will be called as a final check that the Writer is appropriate for the given Object type - if this returns true then the creator function will then be called. Typically you will not call this function directly to register a writer type - you will instead use the registration utility class below.
References IECore::InvalidTypeId, and IECore::CamelCase::split().
| void Writer::supportedExtensions | ( | TypeId | typeId, | |
| std::vector< std::string > & | extensions | |||
| ) | [static] |
Fills the passed vector with all the extensions for which a Writer of, or inherited from, the given type is available. Extensions are of the form "tif" - ie without a preceding '.'.
References IECore::RunTimeTyped::derivedTypeIds().
| void Writer::supportedExtensions | ( | std::vector< std::string > & | extensions | ) | [static] |
Fills the passed vector with all the extensions for which a Writer is available. Extensions are of the form "tif" - ie without a preceding '.'.
| void Writer::write | ( | ) |
Writes object() to fileName(). This just calls operate() and is provided for backwards compatibility and pretty syntax.
References IECore::Op::operate().
FileNameParameterPtr IECore::Writer::m_fileNameParameter [protected] |
ParameterPtr IECore::Writer::m_objectParameter [protected] |
1.5.8