Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Grid< T > Class Template Reference

Basic 2D array, intended for storing tile data, plus support for lazy updates by ICmpObstructionManager. More...

#include <Grid.h>

Public Types

using value_type = T
 

Public Member Functions

 Grid ()
 
 Grid (std::uint16_t w, std::uint16_t h)
 
 Grid (const Grid &g)
 
Grid & operator= (const Grid &g)
 
void swap (Grid &g)
 
 ~Grid ()
 
bool operator== (const Grid &g) const
 
bool operator!= (const Grid &g) const
 
bool blank () const
 
std::uint16_t width () const
 
std::uint16_t height () const
 
bool any_set_in_square (int i0, int j0, int i1, int j1) const
 
void reset ()
 
void clear ()
 
void resize (std::uint16_t w, std::uint16_t h)
 
void add (const Grid &g)
 
void bitwise_or (const Grid &g)
 
void set (int i, int j, const T &value)
 
T & operator[] (std::pair< std::uint16_t, std::uint16_t > coords)
 
T & get (std::pair< std::uint16_t, std::uint16_t > coords)
 
T & operator[] (std::pair< std::uint16_t, std::uint16_t > coords) const
 
T & get (std::pair< std::uint16_t, std::uint16_t > coords) const
 
T & get (int i, int j)
 
T & get (int i, int j) const
 
template<typename U >
bool compare_sizes (const Grid< U > *g) const
 

Public Attributes

std::uint16_t m_W
 
std::uint16_t m_H
 
T * m_Data
 

Friends

struct SerializeHelper< Grid< T > >
 

Detailed Description

template<typename T>
class Grid< T >

Basic 2D array, intended for storing tile data, plus support for lazy updates by ICmpObstructionManager.

T must be a POD type that can be initialised with 0s.

Member Typedef Documentation

◆ value_type

template<typename T >
using Grid< T >::value_type = T

Constructor & Destructor Documentation

◆ Grid() [1/3]

template<typename T >
Grid< T >::Grid ( )
inline

◆ Grid() [2/3]

template<typename T >
Grid< T >::Grid ( std::uint16_t  w,
std::uint16_t  h 
)
inline

◆ Grid() [3/3]

template<typename T >
Grid< T >::Grid ( const Grid< T > &  g)
inline

◆ ~Grid()

template<typename T >
Grid< T >::~Grid ( )
inline

Member Function Documentation

◆ add()

template<typename T >
void Grid< T >::add ( const Grid< T > &  g)
inline

◆ any_set_in_square()

template<typename T >
bool Grid< T >::any_set_in_square ( int  i0,
int  j0,
int  i1,
int  j1 
) const
inline

◆ bitwise_or()

template<typename T >
void Grid< T >::bitwise_or ( const Grid< T > &  g)
inline

◆ blank()

template<typename T >
bool Grid< T >::blank ( ) const
inline

◆ clear()

template<typename T >
void Grid< T >::clear ( )
inline

◆ compare_sizes()

template<typename T >
template<typename U >
bool Grid< T >::compare_sizes ( const Grid< U > *  g) const
inline

◆ get() [1/4]

template<typename T >
T & Grid< T >::get ( int  i,
int  j 
)
inline

◆ get() [2/4]

template<typename T >
T & Grid< T >::get ( int  i,
int  j 
) const
inline

◆ get() [3/4]

template<typename T >
T & Grid< T >::get ( std::pair< std::uint16_t, std::uint16_t >  coords)
inline

◆ get() [4/4]

template<typename T >
T & Grid< T >::get ( std::pair< std::uint16_t, std::uint16_t >  coords) const
inline

◆ height()

template<typename T >
std::uint16_t Grid< T >::height ( ) const
inline

◆ operator!=()

template<typename T >
bool Grid< T >::operator!= ( const Grid< T > &  g) const
inline

◆ operator=()

template<typename T >
Grid & Grid< T >::operator= ( const Grid< T > &  g)
inline

◆ operator==()

template<typename T >
bool Grid< T >::operator== ( const Grid< T > &  g) const
inline

◆ operator[]() [1/2]

template<typename T >
T & Grid< T >::operator[] ( std::pair< std::uint16_t, std::uint16_t >  coords)
inline

◆ operator[]() [2/2]

template<typename T >
T & Grid< T >::operator[] ( std::pair< std::uint16_t, std::uint16_t >  coords) const
inline

◆ reset()

template<typename T >
void Grid< T >::reset ( )
inline

◆ resize()

template<typename T >
void Grid< T >::resize ( std::uint16_t  w,
std::uint16_t  h 
)
inline

◆ set()

template<typename T >
void Grid< T >::set ( int  i,
int  j,
const T &  value 
)
inline

◆ swap()

template<typename T >
void Grid< T >::swap ( Grid< T > &  g)
inline

◆ width()

template<typename T >
std::uint16_t Grid< T >::width ( ) const
inline

Friends And Related Function Documentation

◆ SerializeHelper< Grid< T > >

template<typename T >
friend struct SerializeHelper< Grid< T > >
friend

Member Data Documentation

◆ m_Data

template<typename T >
T* Grid< T >::m_Data

◆ m_H

template<typename T >
std::uint16_t Grid< T >::m_H

◆ m_W

template<typename T >
std::uint16_t Grid< T >::m_W

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