Cogs.Core
Public Member Functions | Private Attributes | List of all members
Cogs::Core::MappedTexture< Element > Class Template Reference

Wrapper for mapped texture data, ensuring RAII behavior of stream map/unmap operations. More...

#include <Texture.h>

Public Member Functions

 MappedTexture (Texture *texture, Element *data)
 Constructs a texture data wrapper.
 
 MappedTexture (MappedTexture &other)=delete
 Deleted copy constructor.
 
 MappedTexture (MappedTexture &&other)=default
 Move construct the wrapper from other.
 
 ~MappedTexture ()
 Destructs the texture wrapper.
 
Element & operator[] (const size_t index)
 Access the element at offset index.
 
 operator Element * ()
 Cast the wrapper to a Element pointer, returning the held data pointer.
 
Element * data ()
 Get the pointer to the mapped data.
 

Private Attributes

Element * elements
 Pointer to the mapped data.
 
Texturetexture
 Pointer to the texture the data was mapped from.
 

Detailed Description

template<typename Element>
class Cogs::Core::MappedTexture< Element >

Wrapper for mapped texture data, ensuring RAII behavior of stream map/unmap operations.

Definition at line 33 of file Texture.h.

Constructor & Destructor Documentation

◆ MappedTexture()

template<typename Element >
Cogs::Core::MappedTexture< Element >::MappedTexture ( Texture texture,
Element *  data 
)
inline

Constructs a texture data wrapper.

Parameters
texturePointer to the texture the data was mapped from.
dataPointer to the texture data.

Definition at line 42 of file Texture.h.

◆ ~MappedTexture()

template<typename Element >
Cogs::Core::MappedTexture< Element >::~MappedTexture

Destructs the texture wrapper.

If the wrapper owns a mapped data segment, the texture data will be unmapped.

Definition at line 205 of file Texture.h.

Member Function Documentation

◆ data()

template<typename Element >
Element * Cogs::Core::MappedTexture< Element >::data ( )
inline

Get the pointer to the mapped data.

Definition at line 66 of file Texture.h.

References Cogs::Core::MappedTexture< Element >::elements.

Referenced by Cogs::Core::MappedTexture< Element >::operator Element *().

◆ operator Element *()

template<typename Element >
Cogs::Core::MappedTexture< Element >::operator Element * ( )
inlineexplicit

Cast the wrapper to a Element pointer, returning the held data pointer.

Definition at line 63 of file Texture.h.

References Cogs::Core::MappedTexture< Element >::data().

◆ operator[]()

template<typename Element >
Element & Cogs::Core::MappedTexture< Element >::operator[] ( const size_t  index)
inline

Access the element at offset index.

Definition at line 57 of file Texture.h.

References Cogs::Core::MappedTexture< Element >::elements.

Member Data Documentation

◆ elements

template<typename Element >
Element* Cogs::Core::MappedTexture< Element >::elements
private

◆ texture

template<typename Element >
Texture* Cogs::Core::MappedTexture< Element >::texture
private

Pointer to the texture the data was mapped from.

Definition at line 73 of file Texture.h.


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