DD::Image::GeoWriter Class Reference

Inherits DD::Image::FileHandler.


class  Description
 Specialised GeoWriter Description. More...

Public Member Functions

 GeoWriter (WriteGeo *)
virtual ~GeoWriter ()
virtual void frame (int)
virtual void execute (Scene &scene)
virtual bool animation () const
virtual int split_input (int i) const
virtual void finish ()
virtual void knobs (Knob_Callback cb)
virtual int knob_changed (Knob *knob)

Protected Member Functions

int frame () const
GeoOpinput0 ()
const char * filename () const
void status (float amount) const
bool open ()
bool close ()
bool write (const void *, FILE_OFFSET)
bool write (FILE_OFFSET, const void *, FILE_OFFSET)
bool seek (FILE_OFFSET)
FILE_OFFSET tell () const

Protected Attributes

 Points at the WriteGeo that created this.
void * file
 Actually a FILE* but I don't want the <stdio.h> header!
 Current offset into file.


class WriteGeo

Detailed Description

Writes data to a geometry file.

The WriteGeo creates one of these for every different filename it writes. Each different file type is a different subclass. Each subclass defines a Writer_Description object, all of these are searched to figure out what subclass to use.

The implementation of the base class is in WriteGeo.C

Constructor & Destructor Documentation

GeoWriter::GeoWriter ( WriteGeo i)

This does not open the file. Instead a subclass should call open() as the first statement in execute() and then return if open fails.

References file.

GeoWriter::~GeoWriter ( )

Destruction closes the temporary file if execute() did not call close().

References file.

Member Function Documentation

int DD::Image::GeoWriter::frame ( ) const

Frame number to write.

GeoOp* DD::Image::GeoWriter::input0 ( )

The GeoOp whose output should be written.

const char* DD::Image::GeoWriter::filename ( ) const

The filename to write.

Referenced by close(), and open().

void DD::Image::GeoWriter::status ( float  amount) const

Call status to display percentage of the current frame done.

References DD::Image::Op::progressFraction().

bool GeoWriter::open ( )

Open the output file. This file is created with a temporary name so that the original file is not replaced until the write is successful. This returns false and calls geo->error() if it can't open the file.

References file, filename(), geo, DD::Image::WriteGeo::internalError(), offset, and strlcpy().

bool GeoWriter::close ( )

Close the output file. If there have not been any errors this will mv the temporary file to the correct place.

References DD::Image::Op::aborted(), file, filename(), geo, DD::Image::WriteGeo::internalError(), and strlcpy().

bool GeoWriter::write ( const void *  buf,
FILE_OFFSET  length 

Write length bytes to the file. Call geo->error() on any errors and returns false. Returns true on success.

References file, geo, DD::Image::WriteGeo::internalError(), and offset.

Referenced by write().

bool GeoWriter::write ( FILE_OFFSET  off,
const void *  buf,
FILE_OFFSET  length 

Same as "seek(off) && write(buf, length)", this writes length bytes to the file at offset and leaves the pointer after that.

References seek(), and write().

bool GeoWriter::seek ( FILE_OFFSET  off)

Move the write pointer to offset. This is done efficiently if the pointer is already at that point. Calls geo->error() on any errors and returns false. Returns true on success.

References file, geo, DD::Image::WriteGeo::internalError(), and offset.

Referenced by write().

FILE_OFFSET DD::Image::GeoWriter::tell ( ) const

Returns where the pointer currently is.

void GeoWriter::frame ( int  n)

Set the frame number to n.

void GeoWriter::execute ( Scene scene)

Write the data in geo->input0(). The frame number may be retrieved with frame() and the filename from filename(). This may call geo->error() with any error messages.

References DD::Image::Op::debug(), and geo.

bool GeoWriter::animation ( ) const

Return true if the destination can have an animation. If this is true then the writer is capable of writing objects with animation, and frame() and execute() may be called multiple times to write different objects. The default version returns false.

Referenced by DD::Image::WriteGeo::_close(), DD::Image::WriteGeo::endExecuting(), and DD::Image::WriteGeo::execFrameMode().

int GeoWriter::split_input ( int  i) const

Lets a writer override the Op::split_input() method of the including WriteGeo op. This is used by Writers that can write more than one view.

Referenced by DD::Image::WriteGeo::execViewMode(), and DD::Image::WriteGeo::split_input().

void GeoWriter::finish ( )

Override if the writer needs to do something to finish a sequence. This is mostly of use by animation writers that don't close out the destination on a frame-by-frame basis.

Referenced by DD::Image::WriteGeo::endExecuting().

void GeoWriter::knobs ( Knob_Callback  cb)

Like the Op::knobs() method, this allows the Writers to create format-specific knobs for format-specific parameters. At present, the Writers are tasked with adding the knobs themselves after the 'file_type' knob of the parent Write.

int GeoWriter::knob_changed ( Knob knob)

Like the Op::knob_changed() method, this allows the Writers to handle changes in their own parameters.

©2022 The Foundry Visionmongers, Ltd. All Rights Reserved.