Panda3D
Public Member Functions
CycleDataLockedReader< CycleDataType > Class Template Reference

This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read() in the destructor. More...

#include "cycleDataLockedReader.h"

List of all members.

Public Member Functions

 CycleDataLockedReader (const PipelineCycler< CycleDataType > &cycler, Thread *current_thread=Thread::get_current_thread())
 CycleDataLockedReader (const CycleDataLockedReader< CycleDataType > &copy)
Threadget_current_thread () const
 Returns the Thread pointer of the currently-executing thread, as passed to the constructor of this object.
 operator const CycleDataType * () const
 This allows the CycleDataLockedReader to be passed to any function that expects a const CycleDataType pointer.
const CycleDataType * operator-> () const
 This provides an indirect member access to the actual CycleData data.
void operator= (const CycleDataLockedReader< CycleDataType > &copy)
const CycleDataType * take_pointer ()
 This is intended to be called only from CycleDataWriter when it elevates the pointer from read to write status.

Detailed Description

template<class CycleDataType>
class CycleDataLockedReader< CycleDataType >

This template class calls PipelineCycler::read() in the constructor and PipelineCycler::release_read() in the destructor.

In the interim, it provides a transparent read-only access to the CycleData.

Since a lock is held on the data while the instance of this class exists, no other thread may modify any stage of the pipeline during that time. Thus, this class is appropriate to use for cases in which you might want to read and then modify the data. It is possible to pass an instance of CycleDataLockedReader to the CycleDataWriter constructor, which automatically elevates the read lock into a write lock.

It exists as a syntactic convenience to access the data in the CycleData. It also allows the whole system to compile down to nothing if DO_PIPELINING is not defined.

Definition at line 47 of file cycleDataLockedReader.h.


Member Function Documentation

template<class CycleDataType >
Thread * CycleDataLockedReader< CycleDataType >::get_current_thread ( ) const [inline]

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

Definition at line 236 of file cycleDataLockedReader.I.

References Thread::get_current_thread().

template<class CycleDataType >
CycleDataLockedReader< CycleDataType >::operator const CycleDataType * ( ) const [inline]

This allows the CycleDataLockedReader to be passed to any function that expects a const CycleDataType pointer.

Definition at line 208 of file cycleDataLockedReader.I.

template<class CycleDataType >
const CycleDataType * CycleDataLockedReader< CycleDataType >::operator-> ( ) const [inline]

This provides an indirect member access to the actual CycleData data.

Definition at line 196 of file cycleDataLockedReader.I.

template<class CycleDataType >
const CycleDataType * CycleDataLockedReader< CycleDataType >::take_pointer ( ) [inline]

This is intended to be called only from CycleDataWriter when it elevates the pointer from read to write status.

This function returns the reader's pointer and relinquishes ownership of the pointer, rendering the reader invalid for future reads.

Definition at line 224 of file cycleDataLockedReader.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations