## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# csRenderBufferLock< T, TbufferKeeper > Class Template Reference

Helper class for convenient locking/unlocking of an iRenderBuffer. More...

`#include <cstool/rbuflock.h>`

List of all members.

## Public Member Functions

| csRenderBufferLock (iRenderBuffer *buf, csRenderBufferLockType lock=CS_BUF_LOCK_NORMAL)
| Construct the helper.
T & | Get (size_t n) const
| Retrieve an item in the render buffer.
size_t | GetSize () const
| Retrieve number of items in buffer.
bool | IsValid () const
| Returns whether the buffer is valid (ie not null).
T * | Lock () const
| Lock the renderbuffer.
T & | operator * () const
| Get current element.
| operator T * () const
| Retrieve a pointer to the contained data.
PointerProxy | operator++ (int)
| Set current element to the next, post-increment version.
PointerProxy | operator++ ()
| Set current element to the next, pre-increment version.
PointerProxy | operator+= (int n)
| Add a value to the current element index.
T & | operator[] (size_t n) const
| Retrieve an item in the render buffer.
| ~csRenderBufferLock ()
| Destruct the helper.

## Detailed Description

### template<class T, class TbufferKeeper = iRenderBuffer*>
class csRenderBufferLock< T, TbufferKeeper >

Helper class for convenient locking/unlocking of an iRenderBuffer.

The buffer is locked upon construction of the csRenderBufferLock<> object and unlocked on destruction.

The contents can be accessed either directly, array-style or iterator-style in a typed way.

Remarks:
  The TbufferKeeper template argument can be used to have the lock store the buffer in a csRef<iRenderBuffer> (instead a iRenderBuffer*) in case there is a risk that the buffer gets destroyed while thelock exists.

Definition at line 44 of file rbuflock.h.

## Constructor & Destructor Documentation

template<class T, class TbufferKeeper = iRenderBuffer*>

csRenderBufferLock< T, TbufferKeeper >::csRenderBufferLock | ( | iRenderBuffer * | buf,
|  | csRenderBufferLockType | lock = `CS_BUF_LOCK_NORMAL` |
| ) |  |  | `[inline]`

Construct the helper.

Locks the buffer.

Definition at line 116 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

csRenderBufferLock< T, TbufferKeeper >::~csRenderBufferLock | ( |  | ) | `[inline]`

Destruct the helper.

Unlocks the buffer.

Definition at line 132 of file rbuflock.h.

## Member Function Documentation

template<class T, class TbufferKeeper = iRenderBuffer*>

T& csRenderBufferLock< T, TbufferKeeper >::Get | ( | size_t | n | ) | const`[inline]`

Retrieve an item in the render buffer.

Definition at line 190 of file rbuflock.h.

Referenced by csRenderBufferLock< unsigned char >::operator *(), and csRenderBufferLock< unsigned char >::operator[]().

template<class T, class TbufferKeeper = iRenderBuffer*>

size_t csRenderBufferLock< T, TbufferKeeper >::GetSize | ( |  | ) | const`[inline]`

Retrieve number of items in buffer.

Definition at line 197 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

bool csRenderBufferLock< T, TbufferKeeper >::IsValid | ( |  | ) | const`[inline]`

Returns whether the buffer is valid (ie not null).

Definition at line 203 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

T* csRenderBufferLock< T, TbufferKeeper >::Lock | ( |  | ) | const`[inline]`

Lock the renderbuffer.

Returns a pointer to the contained data.

Remarks:
  Watch the stride of the buffer.

Definition at line 141 of file rbuflock.h.

Referenced by csRenderBufferLock< unsigned char >::Get(), and csRenderBufferLock< unsigned char >::operator unsigned char *().

template<class T, class TbufferKeeper = iRenderBuffer*>

T& csRenderBufferLock< T, TbufferKeeper >::operator * | ( |  | ) | const`[inline]`

Get current element.

Definition at line 156 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

csRenderBufferLock< T, TbufferKeeper >::operator T * | ( |  | ) | const`[inline]`

Retrieve a pointer to the contained data.

Remarks:
  Watch the stride of the buffer.

Definition at line 150 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

PointerProxy csRenderBufferLock< T, TbufferKeeper >::operator++ | ( | int |  | ) | `[inline]`

Set current element to the next, post-increment version.

Definition at line 169 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

PointerProxy csRenderBufferLock< T, TbufferKeeper >::operator++ | ( |  | ) | `[inline]`

Set current element to the next, pre-increment version.

Definition at line 162 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

PointerProxy csRenderBufferLock< T, TbufferKeeper >::operator+= | ( | int | n | ) | `[inline]`

Add a value to the current element index.

Definition at line 177 of file rbuflock.h.

template<class T, class TbufferKeeper = iRenderBuffer*>

T& csRenderBufferLock< T, TbufferKeeper >::operator[] | ( | size_t | n | ) | const`[inline]`

Retrieve an item in the render buffer.

Definition at line 184 of file rbuflock.h.

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

- cstool/rbuflock.h