Tatooine
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Friends | List of all members
tatooine::gl::buffer< ArrayType, T > Class Template Reference

buffer base class for each of the OpenGL buffer types More...

#include <buffer.h>

Inheritance diagram for tatooine::gl::buffer< ArrayType, T >:
[legend]
Collaboration diagram for tatooine::gl::buffer< ArrayType, T >:
[legend]

Public Types

using parent_type = id_holder< GLuint >
 
using this_type = buffer< array_type, T >
 
using value_type = T
 
using read_only_element_type = rbuffer_map_element< array_type, T >
 
using read_write_element_type = rwbuffer_map_element< array_type, T >
 
using write_only_element_type = wbuffer_map_element< array_type, T >
 
using iterator = buffer_iterator< array_type, T >
 
using const_iterator = cbuffer_iterator< array_type, T >
 
using read_map_type = rbuffer_map< array_type, T >
 
using write_map_type = wbuffer_map< array_type, T >
 
using read_write_map_type = rwbuffer_map< array_type, T >
 

Public Member Functions

 buffer (buffer_usage usage)
 
 buffer (const buffer &other)
 
 buffer (buffer &&other) noexcept
 
auto operator= (const buffer &other) -> buffer &
 
auto operator= (buffer &&other) noexcept -> buffer &
 
auto operator= (const std::vector< T > &data) -> buffer &
 
 buffer (GLsizei n, buffer_usage usage)
 
 buffer (GLsizei n, const T &initial, buffer_usage usage)
 
 buffer (const std::vector< T > &data, buffer_usage usage)
 
 ~buffer ()
 
auto create_handle () -> void
 
auto destroy_handle () -> void
 
auto upload_data (const T &data) -> void
 
auto upload_data (const std::vector< T > &data) -> void
 
auto download_data () const -> std::vector< T >
 
auto bind () const -> void
 
auto copy (const this_type &other) -> void
 
auto empty () const -> bool
 
auto size () const
 
auto capacity () const
 
auto reserve (GLsizei size) -> void
 
auto resize (GLsizei size) -> void
 
auto clear ()
 
auto gpu_malloc (GLsizei n) -> void
 
auto gpu_malloc (GLsizei n, const T &initial) -> void
 
auto set_usage (buffer_usage) -> void
 
auto push_back (T const &) -> void
 
auto pop_back () -> void
 
template<typename... Ts>
auto emplace_back (Ts &&...) -> void
 
auto read_write_element_at (std::size_t idx)
 
auto read_element_at (std::size_t idx) const
 
auto write_only_element_at (std::size_t idx)
 
auto at (std::size_t idx)
 
auto at (std::size_t idx) const
 
auto operator[] (std::size_t idx)
 
auto operator[] (std::size_t idx) const
 
auto front ()
 
auto front () const
 
auto back ()
 
auto back () const
 
auto begin ()
 
auto end ()
 
auto begin () const
 
auto end () const
 
auto rmap () const
 
auto wmap ()
 
auto rwmap ()
 
auto map ()
 
auto map () const
 
auto map (std::size_t offset, std::size_t length)
 
auto map (std::size_t offset, std::size_t length) const
 
template<typename... Ts>
auto emplace_back (Ts &&... ts) -> void
 
- Public Member Functions inherited from tatooine::gl::id_holder< GLuint >
 id_holder ()
 
 id_holder (GLuint _id)
 
 id_holder (id_holder const &other)=delete
 
 id_holder (id_holder &&other) noexcept
 
auto operator= (id_holder const &other) -> id_holder &=delete
 
auto operator= (id_holder &&other) noexcept -> id_holder &
 
 ~id_holder ()=default
 
auto id () const
 
void swap (id_holder &other)
 

Static Public Member Functions

static auto unbind () -> void
 

Static Public Attributes

static constexpr auto array_type = ArrayType
 
static constexpr GLsizei data_size = static_cast<GLsizei>(sizeof(T))
 
- Static Public Attributes inherited from tatooine::gl::id_holder< GLuint >
static constexpr auto default_val
 

Private Attributes

GLsizei m_size = 0
 
GLsizei m_capacity = 0
 
buffer_usage m_usage
 

Friends

class rbuffer_map_element< ArrayType, T >
 
class rwbuffer_map_element< ArrayType, T >
 

Additional Inherited Members

- Protected Member Functions inherited from tatooine::gl::id_holder< GLuint >
void set_id (GLuint id)
 
auto id_ptr ()
 
auto id_ref () -> auto &
 

Detailed Description

template<GLsizei ArrayType, typename T>
class tatooine::gl::buffer< ArrayType, T >

buffer base class for each of the OpenGL buffer types

Member Typedef Documentation

◆ const_iterator

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::const_iterator = cbuffer_iterator<array_type, T>

◆ iterator

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::iterator = buffer_iterator<array_type, T>

◆ parent_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::parent_type = id_holder<GLuint>

◆ read_map_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::read_map_type = rbuffer_map<array_type, T>

◆ read_only_element_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::read_only_element_type = rbuffer_map_element<array_type, T>

◆ read_write_element_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::read_write_element_type = rwbuffer_map_element<array_type, T>

◆ read_write_map_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::read_write_map_type = rwbuffer_map<array_type, T>

◆ this_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::this_type = buffer<array_type, T>

◆ value_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::value_type = T

◆ write_map_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::write_map_type = wbuffer_map<array_type, T>

◆ write_only_element_type

template<GLsizei ArrayType, typename T >
using tatooine::gl::buffer< ArrayType, T >::write_only_element_type = wbuffer_map_element<array_type, T>

Constructor & Destructor Documentation

◆ buffer() [1/6]

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::buffer ( buffer_usage  usage)
explicit

◆ buffer() [2/6]

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::buffer ( const buffer< ArrayType, T > &  other)

◆ buffer() [3/6]

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::buffer ( buffer< ArrayType, T > &&  other)
noexcept

◆ buffer() [4/6]

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::buffer ( GLsizei  n,
buffer_usage  usage 
)

◆ buffer() [5/6]

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::buffer ( GLsizei  n,
const T &  initial,
buffer_usage  usage 
)

◆ buffer() [6/6]

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::buffer ( const std::vector< T > &  data,
buffer_usage  usage 
)

◆ ~buffer()

template<GLsizei array_type, typename T >
tatooine::gl::buffer< array_type, T >::~buffer

Member Function Documentation

◆ at() [1/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::at ( std::size_t  idx)
inline

◆ at() [2/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::at ( std::size_t  idx) const
inline

◆ back() [1/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::back ( )
inline

◆ back() [2/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::back ( ) const
inline

◆ begin() [1/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::begin ( )
inline

◆ begin() [2/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::begin ( ) const
inline

◆ bind()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::bind

◆ capacity()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::capacity ( ) const
inline

◆ clear()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::clear ( )
inline

◆ copy()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::copy ( const this_type other) -> void

◆ create_handle()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::create_handle

◆ destroy_handle()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::destroy_handle

◆ download_data()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::download_data

◆ emplace_back() [1/2]

template<GLsizei ArrayType, typename T >
template<typename... Ts>
auto tatooine::gl::buffer< ArrayType, T >::emplace_back ( Ts &&...  ts) -> void

◆ emplace_back() [2/2]

template<GLsizei ArrayType, typename T >
template<typename... Ts>
auto tatooine::gl::buffer< ArrayType, T >::emplace_back ( Ts &&  ...) -> void

◆ empty()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::empty ( ) const -> bool
inline

◆ end() [1/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::end ( )
inline

◆ end() [2/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::end ( ) const
inline

◆ front() [1/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::front ( )
inline

◆ front() [2/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::front ( ) const
inline

◆ gpu_malloc() [1/2]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::gpu_malloc ( GLsizei  n) -> void

◆ gpu_malloc() [2/2]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::gpu_malloc ( GLsizei  n,
const T &  initial 
) -> void

◆ map() [1/4]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::map ( )
inline

◆ map() [2/4]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::map ( ) const
inline

◆ map() [3/4]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::map ( std::size_t  offset,
std::size_t  length 
)
inline

◆ map() [4/4]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::map ( std::size_t  offset,
std::size_t  length 
) const
inline

◆ operator=() [1/3]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::operator= ( buffer< ArrayType, T > &&  other) -> buffer&
noexcept

◆ operator=() [2/3]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::operator= ( const buffer< ArrayType, T > &  other) -> buffer&

◆ operator=() [3/3]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::operator= ( const std::vector< T > &  data) -> buffer&

◆ operator[]() [1/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::operator[] ( std::size_t  idx)
inline

◆ operator[]() [2/2]

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::operator[] ( std::size_t  idx) const
inline

◆ pop_back()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::pop_back

◆ push_back()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::push_back ( T const &  t) -> void

◆ read_element_at()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::read_element_at ( std::size_t  idx) const
inline

◆ read_write_element_at()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::read_write_element_at ( std::size_t  idx)
inline

◆ reserve()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::reserve ( GLsizei  size) -> void

◆ resize()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::resize ( GLsizei  size) -> void

◆ rmap()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::rmap ( ) const
inline

◆ rwmap()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::rwmap ( )
inline

◆ set_usage()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::set_usage ( buffer_usage  u) -> void

◆ size()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::size ( ) const
inline

◆ unbind()

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::unbind
static

◆ upload_data() [1/2]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::upload_data ( const std::vector< T > &  data) -> void

◆ upload_data() [2/2]

template<GLsizei array_type, typename T >
auto tatooine::gl::buffer< array_type, T >::upload_data ( const T &  data) -> void

◆ wmap()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::wmap ( )
inline

◆ write_only_element_at()

template<GLsizei ArrayType, typename T >
auto tatooine::gl::buffer< ArrayType, T >::write_only_element_at ( std::size_t  idx)
inline

Friends And Related Function Documentation

◆ rbuffer_map_element< ArrayType, T >

template<GLsizei ArrayType, typename T >
friend class rbuffer_map_element< ArrayType, T >
friend

◆ rwbuffer_map_element< ArrayType, T >

template<GLsizei ArrayType, typename T >
friend class rwbuffer_map_element< ArrayType, T >
friend

Member Data Documentation

◆ array_type

template<GLsizei ArrayType, typename T >
constexpr auto tatooine::gl::buffer< ArrayType, T >::array_type = ArrayType
staticconstexpr

◆ data_size

template<GLsizei ArrayType, typename T >
constexpr GLsizei tatooine::gl::buffer< ArrayType, T >::data_size = static_cast<GLsizei>(sizeof(T))
staticconstexpr

◆ m_capacity

template<GLsizei ArrayType, typename T >
GLsizei tatooine::gl::buffer< ArrayType, T >::m_capacity = 0
private

◆ m_size

template<GLsizei ArrayType, typename T >
GLsizei tatooine::gl::buffer< ArrayType, T >::m_size = 0
private

◆ m_usage

template<GLsizei ArrayType, typename T >
buffer_usage tatooine::gl::buffer< ArrayType, T >::m_usage
private

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