Panda3D
Public Member Functions | List of all members
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"

Public Member Functions

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

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 40 of file cycleDataLockedReader.h.

Member Function Documentation

◆ get_current_thread()

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 237 of file cycleDataLockedReader.I.

◆ operator ->()

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

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

Definition at line 205 of file cycleDataLockedReader.I.

◆ operator const CycleDataType *()

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 215 of file cycleDataLockedReader.I.

◆ take_pointer()

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 227 of file cycleDataLockedReader.I.


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