Pyrogenesis  trunk
Classes | Public Types | Public Member Functions | Public Attributes | Protected Types | Friends | List of all members
Grid< T > Class Template Reference

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

#include <TerritoryBoundary.h>

Collaboration diagram for Grid< T >:
Collaboration graph
[legend]

Classes

struct  default_type
 
struct  has_value_type
 
struct  has_value_type< U, decltype(std::declval< typename U::value_type >(), 0)>
 
struct  is_container
 
struct  is_pod
 

Public Types

using value_type = T
 

Public Member Functions

 Grid ()
 
 Grid (u16 w, u16 h)
 
 Grid (const Grid &g)
 
void copy_data (T *o, default_type)
 
void copy_data (T *o, is_pod)
 
Gridoperator= (const Grid &g)
 
void swap (Grid &g)
 
 ~Grid ()
 
bool compare_data (T *o, default_type) const
 
bool compare_data (T *o, is_pod) const
 
bool operator== (const Grid &g) const
 
bool operator!= (const Grid &g) const
 
bool blank () const
 
u16 width () const
 
u16 height () const
 
bool _any_set_in_square (int, int, int, int, default_type) const
 
bool _any_set_in_square (int i0, int j0, int i1, int j1, is_pod) const
 
bool any_set_in_square (int i0, int j0, int i1, int j1) const
 
void reset_data (default_type)
 
void reset_data (is_pod)
 
void reset ()
 
void clear ()
 
void resize (u16 w, u16 h)
 
void add (const Grid &g)
 
void bitwise_or (const Grid &g)
 
void set (int i, int j, const T &value)
 
Toperator[] (std::pair< u16, u16 > coords)
 
Tget (std::pair< u16, u16 > coords)
 
Toperator[] (std::pair< u16, u16 > coords) const
 
Tget (std::pair< u16, u16 > coords) const
 
Tget (int i, int j)
 
Tget (int i, int j) const
 
template<typename U >
bool compare_sizes (const Grid< U > *g) const
 

Public Attributes

u16 m_W
 
u16 m_H
 
Tm_Data
 

Protected Types

template<typename U , typename A , typename B >
using if_ = typename std::conditional< U::value, A, B >::type
 
template<typename U >
using dispatch = if_< std::is_pod< U >, is_pod, if_< has_value_type< U >, is_container, default_type > >
 

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

◆ dispatch

template<typename T>
template<typename U >
using Grid< T >::dispatch = if_< std::is_pod<U>, is_pod, if_<has_value_type<U>, is_container, default_type> >
protected

◆ if_

template<typename T>
template<typename U , typename A , typename B >
using Grid< T >::if_ = typename std::conditional<U::value, A, B>::type
protected

◆ 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 ( u16  w,
u16  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

◆ _any_set_in_square() [1/2]

template<typename T>
bool Grid< T >::_any_set_in_square ( int  ,
int  ,
int  ,
int  ,
default_type   
) const
inline

◆ _any_set_in_square() [2/2]

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

◆ 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_data() [1/2]

template<typename T>
bool Grid< T >::compare_data ( T o,
default_type   
) const
inline

◆ compare_data() [2/2]

template<typename T>
bool Grid< T >::compare_data ( T o,
is_pod   
) const
inline

◆ compare_sizes()

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

◆ copy_data() [1/2]

template<typename T>
void Grid< T >::copy_data ( T o,
default_type   
)
inline

◆ copy_data() [2/2]

template<typename T>
void Grid< T >::copy_data ( T o,
is_pod   
)
inline

◆ get() [1/4]

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

◆ get() [2/4]

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

◆ get() [3/4]

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

◆ get() [4/4]

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

◆ height()

template<typename T>
u16 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< u16, u16 coords)
inline

◆ operator[]() [2/2]

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

◆ reset()

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

◆ reset_data() [1/2]

template<typename T>
void Grid< T >::reset_data ( default_type  )
inline

◆ reset_data() [2/2]

template<typename T>
void Grid< T >::reset_data ( is_pod  )
inline

◆ resize()

template<typename T>
void Grid< T >::resize ( u16  w,
u16  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>
u16 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>
u16 Grid< T >::m_H

◆ m_W

template<typename T>
u16 Grid< T >::m_W

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