Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PipelineCycler< CycleDataType > Struct Template Reference

This class maintains different copies of a page of data between stages of the graphics pipeline (or any other pipelining context). More...

#include <pipelineCycler.h>

Inheritance diagram for PipelineCycler< CycleDataType >:

PipelineCyclerBase List of all members.

Public Member Functions

 PipelineCycler (Pipeline *pipeline=NULL)
 PipelineCycler (const PipelineCycler< CycleDataType > &copy)
void operator= (const PipelineCycler< CycleDataType > &copy)
const CycleDataType * read () const
 See PipelineCyclerBase::read().

CycleDataType * write ()
 See PipelineCyclerBase::write().

CycleDataType * elevate_read (const CycleDataType *pointer)
 See PipelineCyclerBase::elevate_read().

CycleDataType * write_stage (int n)
 See PipelineCyclerBase::write_stage().

CycleDataType * cheat () const
 Returns a pointer without counting it.

void increment_read (const CycleData *pointer) const
 Increments the count on a pointer previously retrieved by read(); now the pointer will need to be released twice.

void release_read (const CycleData *pointer) const
 Releases a pointer previously obtained via a call to read().

CycleDataelevate_read (const CycleData *pointer)
 Elevates a currently-held read pointer into a write pointer.

void release_write (CycleData *pointer)
 Releases a pointer previously obtained via a call to write().

int get_num_stages ()
 Returns the number of stages in the pipeline.

bool is_stage_unique (int n) const
 Returns true if the nth stage is a different pointer than the previous stage, or false if its pointer is shared with the previous one.

void release_write_stage (int n, CycleData *pointer)
 Releases a pointer previously obtained via a call to write_stage().

int get_read_count () const
 Returns the number of handles currently outstanding to read the current stage of the data.

int get_write_count () const
 Returns the number of handles currently outstanding to read the current stage of the data.


Public Attributes

CycleData_data

Private Attributes

CycleDataType _typed_data

Detailed Description

template<class CycleDataType>
struct PipelineCycler< CycleDataType >

This class maintains different copies of a page of data between stages of the graphics pipeline (or any other pipelining context).

The class object maintains up to n copies of a CycleData structure, one for each stage of the pipeline. The head of the pipeline is responsible for making changes to its copy, which are then cycled through the pipeline at each frame.

To access the data, you must first ask for a readable pointer. In order to make changes to the data, you must ask for a writable pointer. Both kinds of pointers should be released when you are done, as a sanity check. The CycleDataReader and CycleDataWriter classes transparently handle this.

If pipelining support is not enabled at compile time (that is, SUPPORT_PIPELINING is not defined), this object compiles to a minimum object that presents the same interface but with minimal runtime overhead. (Actually, this isn't true yet, but it will be one day.)

We define this as a struct instead of a class to guarantee byte placement within the object, so that (particularly for the trivial implementation) the inherited struct's data is likely to be placed by the compiler at the "this" pointer.

Definition at line 93 of file pipelineCycler.h.


Constructor & Destructor Documentation

template<class CycleDataType>
PipelineCycler< CycleDataType >::PipelineCycler Pipeline pipeline = NULL  )  [inline]
 

Definition at line 167 of file pipelineCycler.I.

References PipelineCycler< CycleDataType >::_typed_data, and INLINE.

template<class CycleDataType>
PipelineCycler< CycleDataType >::PipelineCycler const PipelineCycler< CycleDataType > &  copy  )  [inline]
 

Definition at line 182 of file pipelineCycler.I.


Member Function Documentation

template<class CycleDataType>
CycleDataType * PipelineCycler< CycleDataType >::cheat  )  const [inline]
 

Returns a pointer without counting it.

This is only intended for use as the return value for certain nassertr() functions, so the application can recover after a failure to manage the read and write pointers correctly. You should never call this function directly.

Reimplemented from PipelineCyclerBase.

Definition at line 279 of file pipelineCycler.I.

CycleData * PipelineCyclerBase::elevate_read const CycleData pointer  )  [inline, inherited]
 

Elevates a currently-held read pointer into a write pointer.

This may or may not change the value of the pointer. It is only valid to do this if this is the only currently-outstanding read pointer on the current stage.

Definition at line 562 of file pipelineCyclerBase.I.

template<class CycleDataType>
CycleDataType * PipelineCycler< CycleDataType >::elevate_read const CycleDataType *  pointer  )  [inline]
 

See PipelineCyclerBase::elevate_read().

Definition at line 241 of file pipelineCycler.I.

int PipelineCyclerBase::get_num_stages  )  [inline, inherited]
 

Returns the number of stages in the pipeline.

Definition at line 593 of file pipelineCyclerBase.I.

Referenced by PandaNode::parents_changed().

int PipelineCyclerBase::get_read_count  )  const [inline, inherited]
 

Returns the number of handles currently outstanding to read the current stage of the data.

This should only be used for debugging purposes.

Definition at line 691 of file pipelineCyclerBase.I.

int PipelineCyclerBase::get_write_count  )  const [inline, inherited]
 

Returns the number of handles currently outstanding to read the current stage of the data.

This will normally only be either 0 or 1. This should only be used for debugging purposes.

Definition at line 710 of file pipelineCyclerBase.I.

void PipelineCyclerBase::increment_read const CycleData pointer  )  const [inline, inherited]
 

Increments the count on a pointer previously retrieved by read(); now the pointer will need to be released twice.

Definition at line 489 of file pipelineCyclerBase.I.

References PipelineCyclerBase::_data, and INLINE.

bool PipelineCyclerBase::is_stage_unique int  n  )  const [inline, inherited]
 

Returns true if the nth stage is a different pointer than the previous stage, or false if its pointer is shared with the previous one.

Definition at line 610 of file pipelineCyclerBase.I.

Referenced by PandaNode::parents_changed().

template<class CycleDataType>
void PipelineCycler< CycleDataType >::operator= const PipelineCycler< CycleDataType > &  copy  )  [inline]
 

Definition at line 198 of file pipelineCycler.I.

References PipelineCycler< CycleDataType >::_typed_data, and INLINE.

template<class CycleDataType>
const CycleDataType * PipelineCycler< CycleDataType >::read  )  const [inline]
 

See PipelineCyclerBase::read().

Reimplemented from PipelineCyclerBase.

Definition at line 213 of file pipelineCycler.I.

References PipelineCycler< CycleDataType >::_typed_data, and INLINE.

void PipelineCyclerBase::release_read const CycleData pointer  )  const [inline, inherited]
 

Releases a pointer previously obtained via a call to read().

Definition at line 503 of file pipelineCyclerBase.I.

References INLINE.

void PipelineCyclerBase::release_write CycleData pointer  )  [inline, inherited]
 

Releases a pointer previously obtained via a call to write().

Definition at line 581 of file pipelineCyclerBase.I.

void PipelineCyclerBase::release_write_stage int  n,
CycleData pointer
[inline, inherited]
 

Releases a pointer previously obtained via a call to write_stage().

Definition at line 648 of file pipelineCyclerBase.I.

Referenced by PandaNode::parents_changed().

template<class CycleDataType>
CycleDataType * PipelineCycler< CycleDataType >::write  )  [inline]
 

See PipelineCyclerBase::write().

Reimplemented from PipelineCyclerBase.

Definition at line 227 of file pipelineCycler.I.

template<class CycleDataType>
CycleDataType * PipelineCycler< CycleDataType >::write_stage int  n  )  [inline]
 

See PipelineCyclerBase::write_stage().

Reimplemented from PipelineCyclerBase.

Definition at line 255 of file pipelineCycler.I.


Member Data Documentation

CycleData* PipelineCyclerBase::_data [inherited]
 

Definition at line 92 of file pipelineCyclerBase.h.

Referenced by PipelineCyclerBase::increment_read(), and PipelineCyclerBase::PipelineCyclerBase().

template<class CycleDataType>
CycleDataType PipelineCycler< CycleDataType >::_typed_data [private]
 

Definition at line 110 of file pipelineCycler.h.

Referenced by PipelineCycler< CycleDataType >::operator=(), PipelineCycler< CycleDataType >::PipelineCycler(), and PipelineCycler< CycleDataType >::read().


The documentation for this struct was generated from the following files:
Generated on Fri May 2 00:53:42 2003 for Panda by doxygen1.3