GeomVertexRewriter Class Reference

This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter, combined together into one convenient package. More...

#include "geomVertexRewriter.h"

Inheritance diagram for GeomVertexRewriter:
GeomVertexWriter GeomVertexReader GeomEnums GeomEnums

List of all members.

Public Member Functions

 GeomVertexRewriter (Thread *current_thread=Thread::get_current_thread())
 Constructs an invalid GeomVertexRewriter.
 GeomVertexRewriter (GeomVertexData *vertex_data, Thread *current_thread=Thread::get_current_thread())
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexData *vertex_data, const InternalName *name, Thread *current_thread=Thread::get_current_thread())
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexArrayData *array_data, Thread *current_thread=Thread::get_current_thread())
 Constructs a new rewriter to process the vertices of the indicated array only.
 GeomVertexRewriter (GeomVertexData *vertex_data, const string &name, Thread *current_thread=Thread::get_current_thread())
 Constructs a new rewriter to process the vertices of the indicated data object.
 GeomVertexRewriter (GeomVertexArrayData *array_data, int column, Thread *current_thread=Thread::get_current_thread())
 Constructs a new rewriter to process the vertices of the indicated array only.
 GeomVertexRewriter (const GeomVertexRewriter &copy)
void clear ()
 Resets the GeomVertexRewriter to the initial state.
int get_array () const
 Returns the array index containing the data type that the rewriter is working on.
GeomVertexArrayDataget_array_data () const
 Returns the particular array object that the rewriter is currently processing.
GeomVertexArrayDataHandleget_array_handle () const
 Returns the write handle to the array object that the rewriter is currently processing.
const GeomVertexColumnget_column () const
 Returns the description of the data type that the rewriter is working on.
Threadget_current_thread () const
 Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.
int get_start_row () const
 Returns the row index at which the rewriter started.
size_t get_stride () const
 Returns the per-row stride (bytes between consecutive rows) of the underlying vertex array.
GeomVertexDataget_vertex_data () const
 Returns the vertex data object that the rewriter is processing.
bool has_column () const
 Returns true if a valid data type has been successfully set, or false if the data type does not exist.
bool is_at_end () const
 Returns true if the reader or writer is currently at the end of the list of vertices, false otherwise.
void operator= (const GeomVertexRewriter &copy)
void output (ostream &out) const
bool set_column (const string &name)
 Sets up the rewriter to use the data type with the indicated name.
bool set_column (int column)
 Sets up the rewriter to use the nth data type of the GeomVertexFormat, numbering from 0.
bool set_column (int array, const GeomVertexColumn *column)
 Sets up the rewriter to use the indicated column description on the given array.
bool set_column (const InternalName *name)
 Sets up the rewriter to use the data type with the indicated name.
void set_row (int row)
 Sets the start, write, and write index to the indicated value.
void set_row_unsafe (int row)
 Sets the start row to the indicated value, without internal checks.

Detailed Description

This object provides the functionality of both a GeomVertexReader and a GeomVertexWriter, combined together into one convenient package.

It is designed for making a single pass over a GeomVertexData object, modifying rows as it goes.

Although it doesn't provide any real performance benefit over using a separate reader and writer on the same data, it should probably be used in preference to a separate reader and writer, because it makes an effort to manage the reference counts properly between the reader and the writer to avoid accidentally dereferencing either array while recopying.

Definition at line 39 of file geomVertexRewriter.h.


Constructor & Destructor Documentation

GeomVertexRewriter::GeomVertexRewriter ( Thread current_thread = Thread::get_current_thread()) [inline]

Constructs an invalid GeomVertexRewriter.

You must use the assignment operator to assign a valid GeomVertexRewriter to this object before you can use it.

Definition at line 25 of file geomVertexRewriter.I.

GeomVertexRewriter::GeomVertexRewriter ( GeomVertexData vertex_data,
Thread current_thread = Thread::get_current_thread() 
) [inline]

Constructs a new rewriter to process the vertices of the indicated data object.

Definition at line 38 of file geomVertexRewriter.I.

GeomVertexRewriter::GeomVertexRewriter ( GeomVertexData vertex_data,
const string &  name,
Thread current_thread = Thread::get_current_thread() 
) [inline]

Constructs a new rewriter to process the vertices of the indicated data object.

This flavor creates the rewriter specifically to process the named data type.

Definition at line 52 of file geomVertexRewriter.I.

References set_column().

GeomVertexRewriter::GeomVertexRewriter ( GeomVertexData vertex_data,
const InternalName name,
Thread current_thread = Thread::get_current_thread() 
) [inline]

Constructs a new rewriter to process the vertices of the indicated data object.

This flavor creates the rewriter specifically to process the named data type.

Definition at line 68 of file geomVertexRewriter.I.

References set_column().

GeomVertexRewriter::GeomVertexRewriter ( GeomVertexArrayData array_data,
Thread current_thread = Thread::get_current_thread() 
) [inline]

Constructs a new rewriter to process the vertices of the indicated array only.

Definition at line 83 of file geomVertexRewriter.I.

GeomVertexRewriter::GeomVertexRewriter ( GeomVertexArrayData array_data,
int  column,
Thread current_thread = Thread::get_current_thread() 
) [inline]

Constructs a new rewriter to process the vertices of the indicated array only.

Definition at line 96 of file geomVertexRewriter.I.

References set_column().


Member Function Documentation

void GeomVertexRewriter::clear ( ) [inline]

Resets the GeomVertexRewriter to the initial state.

Reimplemented from GeomVertexReader.

Definition at line 294 of file geomVertexRewriter.I.

int GeomVertexRewriter::get_array ( ) const [inline]

Returns the array index containing the data type that the rewriter is working on.

Reimplemented from GeomVertexReader.

Definition at line 320 of file geomVertexRewriter.I.

References GeomVertexReader::get_array(), and GeomVertexWriter::get_array().

GeomVertexArrayData * GeomVertexRewriter::get_array_data ( ) const [inline]

Returns the particular array object that the rewriter is currently processing.

Reimplemented from GeomVertexReader.

Definition at line 156 of file geomVertexRewriter.I.

References GeomVertexWriter::get_array_data(), and GeomVertexReader::get_array_data().

GeomVertexArrayDataHandle * GeomVertexRewriter::get_array_handle ( ) const [inline]

Returns the write handle to the array object that the rewriter is currently processing.

This low-level call should be used with caution; be careful with modifying the data in the handle out from under the GeomVertexRewriter.

Reimplemented from GeomVertexReader.

Definition at line 172 of file geomVertexRewriter.I.

const GeomVertexColumn * GeomVertexRewriter::get_column ( ) const [inline]

Returns the description of the data type that the rewriter is working on.

Reimplemented from GeomVertexReader.

Definition at line 333 of file geomVertexRewriter.I.

References GeomVertexReader::get_column(), and GeomVertexWriter::get_column().

Thread * GeomVertexRewriter::get_current_thread ( ) const [inline]

Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.

Reimplemented from GeomVertexReader.

Definition at line 197 of file geomVertexRewriter.I.

References GeomVertexReader::get_current_thread(), and GeomVertexWriter::get_current_thread().

int GeomVertexRewriter::get_start_row ( ) const [inline]

Returns the row index at which the rewriter started.

It will return to this row if you reset the current column.

Reimplemented from GeomVertexReader.

Definition at line 380 of file geomVertexRewriter.I.

References GeomVertexReader::get_start_row(), and GeomVertexWriter::get_start_row().

size_t GeomVertexRewriter::get_stride ( ) const [inline]

Returns the per-row stride (bytes between consecutive rows) of the underlying vertex array.

This low-level information is normally not needed to use the GeomVertexRewriter directly.

Reimplemented from GeomVertexReader.

Definition at line 185 of file geomVertexRewriter.I.

References GeomVertexReader::get_stride(), and GeomVertexWriter::get_stride().

GeomVertexData * GeomVertexRewriter::get_vertex_data ( ) const [inline]

Returns the vertex data object that the rewriter is processing.

Reimplemented from GeomVertexReader.

Definition at line 143 of file geomVertexRewriter.I.

References GeomVertexReader::get_vertex_data(), and GeomVertexWriter::get_vertex_data().

bool GeomVertexRewriter::has_column ( ) const [inline]

Returns true if a valid data type has been successfully set, or false if the data type does not exist.

Reimplemented from GeomVertexReader.

Definition at line 307 of file geomVertexRewriter.I.

References GeomVertexReader::get_column(), and GeomVertexWriter::get_column().

bool GeomVertexRewriter::is_at_end ( ) const [inline]

Returns true if the reader or writer is currently at the end of the list of vertices, false otherwise.

Reimplemented from GeomVertexReader.

Definition at line 393 of file geomVertexRewriter.I.

Referenced by GeomPrimitive::offset_vertices().

bool GeomVertexRewriter::set_column ( const string &  name) [inline]

Sets up the rewriter to use the data type with the indicated name.

This also resets both the read and write row numbers to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented from GeomVertexReader.

Definition at line 240 of file geomVertexRewriter.I.

References set_column().

bool GeomVertexRewriter::set_column ( int  array,
const GeomVertexColumn column 
) [inline]

Sets up the rewriter to use the indicated column description on the given array.

This also resets both the read and write row numbers to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented from GeomVertexReader.

Definition at line 281 of file geomVertexRewriter.I.

References set_column().

bool GeomVertexRewriter::set_column ( int  column) [inline]

Sets up the rewriter to use the nth data type of the GeomVertexFormat, numbering from 0.

This also resets both the read and write row numbers to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented from GeomVertexReader.

Definition at line 218 of file geomVertexRewriter.I.

Referenced by GeomVertexRewriter(), and set_column().

bool GeomVertexRewriter::set_column ( const InternalName name) [inline]

Sets up the rewriter to use the data type with the indicated name.

This also resets both the read and write row numbers to the start row (the same value passed to a previous call to set_row(), or 0 if set_row() was never called.)

The return value is true if the data type is valid, false otherwise.

Reimplemented from GeomVertexReader.

Definition at line 259 of file geomVertexRewriter.I.

References set_column().

void GeomVertexRewriter::set_row ( int  row) [inline]

Sets the start, write, and write index to the indicated value.

The rewriter will begin traversing from the given row.

Reimplemented from GeomVertexReader.

Definition at line 367 of file geomVertexRewriter.I.

void GeomVertexRewriter::set_row_unsafe ( int  row) [inline]

Sets the start row to the indicated value, without internal checks.

This is the same as set_row(), but it does not check for the possibility that the array has been reallocated internally for some reason; use only when you are confident that the array is unchanged and you really need every bit of available performance.

Reimplemented from GeomVertexReader.

Definition at line 351 of file geomVertexRewriter.I.


The documentation for this class was generated from the following files: