Panda3D

Loading...
Searching...
No Matches
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 CycleDataLockedReader< CycleDataType > &copy)
| CycleDataLockedReader (const PipelineCycler< CycleDataType > &cycler, Thread *current_thread=Thread::get_current_thread())
| CycleDataLockedReader (CycleDataLockedReader< CycleDataType > &&from) noexcept
Thread * | get_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)
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.

## 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.

## Constructor & Destructor Documentation

## ◆ CycleDataLockedReader() [1/2]

template<class CycleDataType>

CycleDataLockedReader< CycleDataType >::CycleDataLockedReader | ( | const PipelineCycler< CycleDataType > & | cycler,
|  | Thread * | current_thread = Thread::get_current_thread() )
| inline

Definition at line 156 of file cycleDataLockedReader.I.

## ◆ CycleDataLockedReader() [2/2]

template<class CycleDataType>

CycleDataLockedReader< CycleDataType >::CycleDataLockedReader | ( | const CycleDataLockedReader< CycleDataType > & | copy | ) |
| inline

Definition at line 165 of file cycleDataLockedReader.I.

## ◆ ~CycleDataLockedReader()

template<class CycleDataType>

CycleDataLockedReader< CycleDataType >::~CycleDataLockedReader | ( |  | ) |
| inline

Definition at line 196 of file cycleDataLockedReader.I.

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

References Thread::get_current_thread.

## ◆ 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 214 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 204 of file cycleDataLockedReader.I.

## ◆ operator=() [1/2]

template<class CycleDataType>

void CycleDataLockedReader< CycleDataType >::operator= | ( | const CycleDataLockedReader< CycleDataType > & | copy | ) |
| inline

Definition at line 175 of file cycleDataLockedReader.I.

## ◆ operator=() [2/2]

template<class CycleDataType>

void CycleDataLockedReader< CycleDataType >::operator= | ( | CycleDataLockedReader< CycleDataType > && | from | ) |
| inline noexcept

Definition at line 184 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 226 of file cycleDataLockedReader.I.

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

- panda/src/pipeline/cycleDataLockedReader.h
- panda/src/pipeline/cycleDataLockedReader.I