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

PipelineCyclerBase Struct Reference

This is the non-template part of the implementation of PipelineCycler. More...

#include <pipelineCyclerBase.h>

Inheritance diagram for PipelineCyclerBase:

PipelineCycler< CycleDataType > List of all members.

Public Member Functions

 PipelineCyclerBase (CycleData *initial_data, Pipeline *pipeline=NULL)
 PipelineCyclerBase (CycleData *initial_data, const PipelineCyclerBase &copy)
void operator= (const PipelineCyclerBase &copy)
 ~PipelineCyclerBase ()
const CycleDataread () const
 Returns a const CycleData pointer, filled with the data for the current stage of the pipeline as seen by this thread.

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().

CycleDatawrite ()
 Returns a non-const CycleData pointer, filled with a unique copy of the data for the current stage of the pipeline as seen by this thread.

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.

CycleDatawrite_stage (int n)
 Returns a pointer suitable for writing to the nth stage of the pipeline.

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

CycleDatacheat () const
 Returns a pointer without counting it.

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

Detailed Description

This is the non-template part of the implementation of PipelineCycler.

See PipelineCycler.

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 52 of file pipelineCyclerBase.h.


Constructor & Destructor Documentation

PipelineCyclerBase::PipelineCyclerBase CycleData initial_data,
Pipeline pipeline = NULL
[inline]
 

Definition at line 392 of file pipelineCyclerBase.I.

References _data, and INLINE.

PipelineCyclerBase::PipelineCyclerBase CycleData initial_data,
const PipelineCyclerBase &  copy
[inline]
 

Definition at line 418 of file pipelineCyclerBase.I.

References _data.

PipelineCyclerBase::~PipelineCyclerBase  )  [inline]
 

Definition at line 450 of file pipelineCyclerBase.I.

References INLINE.


Member Function Documentation

CycleData * PipelineCyclerBase::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 in PipelineCycler< CycleDataType >, and PipelineCycler< CData >.

Definition at line 670 of file pipelineCyclerBase.I.

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

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.

int PipelineCyclerBase::get_num_stages  )  [inline]
 

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]
 

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]
 

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]
 

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 _data, and INLINE.

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

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().

void PipelineCyclerBase::operator= const PipelineCyclerBase &  copy  )  [inline]
 

Definition at line 436 of file pipelineCyclerBase.I.

References INLINE.

const CycleData * PipelineCyclerBase::read  )  const [inline]
 

Returns a const CycleData pointer, filled with the data for the current stage of the pipeline as seen by this thread.

This pointer should eventually be released by calling release_read().

Reimplemented in PipelineCycler< CycleDataType >, and PipelineCycler< CData >.

Definition at line 468 of file pipelineCyclerBase.I.

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

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]
 

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]
 

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

Definition at line 648 of file pipelineCyclerBase.I.

Referenced by PandaNode::parents_changed().

CycleData * PipelineCyclerBase::write  )  [inline]
 

Returns a non-const CycleData pointer, filled with a unique copy of the data for the current stage of the pipeline as seen by this thread.

This pointer may now be used to write to the data, and that copy of the data will be propagate to all later stages of the pipeline. This pointer should eventually be released by calling release_write().

There may only be one outstanding write pointer on a given stage at a time, and if there is a write pointer there may be no read pointers on the same stage (but see elevate_read).

Reimplemented in PipelineCycler< CycleDataType >, and PipelineCycler< CData >.

Definition at line 537 of file pipelineCyclerBase.I.

CycleData * PipelineCyclerBase::write_stage int  n  )  [inline]
 

Returns a pointer suitable for writing to the nth stage of the pipeline.

This is for special applications that need to update the entire pipeline at once (for instance, to remove an invalid pointer). This pointer should later be released with release_write_stage().

Reimplemented in PipelineCycler< CycleDataType >, and PipelineCycler< CData >.

Definition at line 633 of file pipelineCyclerBase.I.


Member Data Documentation

CycleData* PipelineCyclerBase::_data
 

Definition at line 92 of file pipelineCyclerBase.h.

Referenced by increment_read(), and PipelineCyclerBase().


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