Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
G3D::Grid< Cell > Class Template Reference

A dense 3D grid of templated Cells. More...

Inherits G3D::ReferenceCountedObject.

Public Member Functions

 Grid ()
 
virtual ~Grid ()
 
void clearAndResize (const Vector3int32 &size, const Cell &emptyValue)
 
void clearAndResize (const Vector3int32 &size)
 
const Cell & emptyValue () const
 The value to clear new cells to on clearAndResize and to return from get() when using WrapMode::ZERO. More...
 
const Cell & get (const Point3int32 &p, WrapMode m=WrapMode::ERROR) const
 
bool inBounds (const Point3int32 &p) const
 
const Cell & operator[] (const Point3int32 &p) const
 Assumes that p is in bounds. More...
 
Cell & operator[] (const Point3int32 &p)
 Assumes that p is in bounds. More...
 
void set (const Point3int32 &p, const Cell &value, WrapMode m=WrapMode::ERROR)
 
void setEmptyValue (const Cell &e)
 
const Vector3int32size () const
 

Static Public Member Functions

static shared_ptr< Gridcreate ()
 A grid can also be directly constructed as an object instead of a pointer...see the public constructor. More...
 

Protected Member Functions

 Grid (const Grid &g)
 
Gridoperator= (const Grid &g)
 

Static Protected Member Functions

template<class T , class ... ArgTypes>
static shared_ptr< T > createShared (ArgTypes &&... args)
 Like std::make_shared, but works for protected constructors. More...
 

Protected Attributes

Cell * m_cell
 m_cell[x][y][z] More...
 
Cell m_empty
 
Vector3int32 m_size
 

Detailed Description

template<typename Cell>
class G3D::Grid< Cell >

A dense 3D grid of templated Cells.

See also
Array, RayGridIterator, PointHashGrid, FastPointHashGrid

Constructor & Destructor Documentation

◆ Grid() [1/2]

template<typename Cell >
G3D::Grid< Cell >::Grid ( const Grid< Cell > &  g)
protected

◆ Grid() [2/2]

template<typename Cell >
G3D::Grid< Cell >::Grid ( )
inline
See also
create

Referenced by G3D::Grid< Cell >::create().

◆ ~Grid()

template<typename Cell >
virtual G3D::Grid< Cell >::~Grid ( )
inlinevirtual

Member Function Documentation

◆ clearAndResize() [1/2]

template<typename Cell >
void G3D::Grid< Cell >::clearAndResize ( const Vector3int32 size,
const Cell &  emptyValue 
)
inline

◆ clearAndResize() [2/2]

template<typename Cell >
void G3D::Grid< Cell >::clearAndResize ( const Vector3int32 size)
inline

◆ create()

template<typename Cell >
static shared_ptr<Grid> G3D::Grid< Cell >::create ( )
inlinestatic

A grid can also be directly constructed as an object instead of a pointer...see the public constructor.

◆ createShared()

template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared ( ArgTypes &&...  args)
inlinestaticprotectedinherited

Like std::make_shared, but works for protected constructors.

Call as createShared<myclass>.

◆ emptyValue()

template<typename Cell >
const Cell& G3D::Grid< Cell >::emptyValue ( ) const
inline

The value to clear new cells to on clearAndResize and to return from get() when using WrapMode::ZERO.

Referenced by G3D::Grid< Cell >::clearAndResize().

◆ get()

template<typename Cell >
const Cell& G3D::Grid< Cell >::get ( const Point3int32 p,
WrapMode  m = WrapMode::ERROR 
) const
inline

◆ inBounds()

template<typename Cell >
bool G3D::Grid< Cell >::inBounds ( const Point3int32 p) const
inline

◆ operator=()

template<typename Cell >
Grid& G3D::Grid< Cell >::operator= ( const Grid< Cell > &  g)
protected

◆ operator[]() [1/2]

template<typename Cell >
const Cell& G3D::Grid< Cell >::operator[] ( const Point3int32 p) const
inline

Assumes that p is in bounds.

◆ operator[]() [2/2]

template<typename Cell >
Cell& G3D::Grid< Cell >::operator[] ( const Point3int32 p)
inline

Assumes that p is in bounds.

◆ set()

template<typename Cell >
void G3D::Grid< Cell >::set ( const Point3int32 p,
const Cell &  value,
WrapMode  m = WrapMode::ERROR 
)
inline

◆ setEmptyValue()

template<typename Cell >
void G3D::Grid< Cell >::setEmptyValue ( const Cell &  e)
inline

◆ size()

template<typename Cell >
const Vector3int32& G3D::Grid< Cell >::size ( ) const
inline

Member Data Documentation

◆ m_cell

template<typename Cell >
Cell* G3D::Grid< Cell >::m_cell
protected

◆ m_empty

template<typename Cell >
Cell G3D::Grid< Cell >::m_empty
protected

◆ m_size

template<typename Cell >
Vector3int32 G3D::Grid< Cell >::m_size
protected

documentation generated on Wed Nov 24 2021 08:01:56 using doxygen 1.8.15