Voxomap
A C++11 voxel container.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
voxomap::ArraySuperContainer< T_Container > Struct Template Reference

Super container used in leaves of the VoxelOctree. Based on a fixed size 3D array, useful for high density of voxels. More...

#include <ArraySuperContainer.hpp>

Public Types

using Container = T_Container
 
using VoxelData = typename Container::VoxelData
 
using VoxelContainer = typename Container::VoxelContainer
 
using iterator = supercontainer_iterator< ArraySuperContainer< Container > >
 

Public Member Functions

 ArraySuperContainer ()=default
 Default constructor. More...
 
 ArraySuperContainer (ArraySuperContainer const &other)
 Copy constructor. More...
 
 ArraySuperContainer (ArraySuperContainer &&other)=default
 Default move constructor. More...
 
 ~ArraySuperContainer ()=default
 Default destructor. More...
 
void init (VoxelNode< ArraySuperContainer< Container >> const &)
 Initialization method, do nothing. More...
 
uint32_t getNbVoxel () const
 Returns number of voxels. More...
 
template<typename Iterator >
VoxelDatafindVoxel (Iterator &it)
 Find voxel. More...
 
template<typename Iterator >
VoxelData const * findVoxel (Iterator &it) const
 Find voxel. More...
 
bool hasContainer (uint8_t x) const
 Check if there is sub-container. More...
 
bool hasContainer (uint8_t x, uint8_t y) const
 Check if there is sub-container. More...
 
bool hasContainer (uint8_t x, uint8_t y, uint8_t z) const
 Check if there is sub-container. More...
 
ContainerfindContainer (uint8_t x, uint8_t y, uint8_t z)
 Find sub-container. More...
 
Container const * findContainer (uint8_t x, uint8_t y, uint8_t z) const
 Find sub-container. More...
 
template<typename Iterator , typename... Args>
bool addVoxel (Iterator &it, Args &&... args)
 Add a voxel, don't update an existing voxel. More...
 
template<typename Iterator , typename... Args>
bool updateVoxel (Iterator &it, Args &&... args)
 Update an existing voxel, don't create a new one. More...
 
template<typename Iterator , typename... Args>
void putVoxel (Iterator &it, Args &&... args)
 Add or update a voxel. More...
 
template<typename Iterator , typename... Args>
bool removeVoxel (Iterator const &it, Args &&... args)
 Remove an existing voxel. More...
 
void serialize (std::string &str) const
 Serialize the structure. More...
 
size_t unserialize (char const *str, size_t size)
 Unserialize str inside this. More...
 
template<typename Iterator >
void exploreVoxel (Iterator &it, std::function< void(Iterator const &)> const &predicate) const
 Go through all voxels of the container and call the predicate for each. More...
 
void exploreVoxelContainer (std::function< void(typename Container::VoxelContainer const &)> const &predicate) const
 

Static Public Attributes

static const uint32_t NB_CONTAINERS = 8
 
static const uint32_t CONTAINER_MASK = NB_CONTAINERS - 1
 
static const uint32_t NB_VOXELS = NB_CONTAINERS * Container::NB_VOXELS
 
static const uint32_t COORD_MASK = ~(NB_VOXELS - 1)
 
static const uint32_t VOXEL_MASK = Container::VOXEL_MASK
 
static const uint32_t NB_SUPERCONTAINER = 1 + Container::NB_SUPERCONTAINER
 
static const uint32_t SUPERCONTAINER_ID = NB_SUPERCONTAINER - 1
 

Private Attributes

std::unique_ptr< Container_containerArray [NB_CONTAINERS][NB_CONTAINERS][NB_CONTAINERS] = { 0 }
 Array of voxel containers. More...
 
uint32_t _nbVoxels = 0
 Number of voxels. More...
 

Detailed Description

template<class T_Container>
struct voxomap::ArraySuperContainer< T_Container >

Super container used in leaves of the VoxelOctree. Based on a fixed size 3D array, useful for high density of voxels.

  • Advantage:
    • Good global performances
  • Disadvantage:
    • Big memory footprint (RAM and serialized), same footprint with 1 or 512 voxel/super sub-container.

Definition at line 30 of file ArraySuperContainer.hpp.

Member Typedef Documentation

◆ Container

template<class T_Container >
using voxomap::ArraySuperContainer< T_Container >::Container = T_Container

Definition at line 32 of file ArraySuperContainer.hpp.

◆ VoxelData

template<class T_Container >
using voxomap::ArraySuperContainer< T_Container >::VoxelData = typename Container::VoxelData

Definition at line 33 of file ArraySuperContainer.hpp.

◆ VoxelContainer

template<class T_Container >
using voxomap::ArraySuperContainer< T_Container >::VoxelContainer = typename Container::VoxelContainer

Definition at line 34 of file ArraySuperContainer.hpp.

◆ iterator

template<class T_Container >
using voxomap::ArraySuperContainer< T_Container >::iterator = supercontainer_iterator<ArraySuperContainer<Container> >

Definition at line 35 of file ArraySuperContainer.hpp.

Constructor & Destructor Documentation

◆ ArraySuperContainer() [1/3]

template<class T_Container >
voxomap::ArraySuperContainer< T_Container >::ArraySuperContainer ( )
default

Default constructor.

◆ ArraySuperContainer() [2/3]

template<class T_Container >
voxomap::ArraySuperContainer< T_Container >::ArraySuperContainer ( ArraySuperContainer< T_Container > const &  other)

Copy constructor.

◆ ArraySuperContainer() [3/3]

template<class T_Container >
voxomap::ArraySuperContainer< T_Container >::ArraySuperContainer ( ArraySuperContainer< T_Container > &&  other)
default

Default move constructor.

◆ ~ArraySuperContainer()

template<class T_Container >
voxomap::ArraySuperContainer< T_Container >::~ArraySuperContainer ( )
default

Default destructor.

Member Function Documentation

◆ init()

template<class T_Container >
void voxomap::ArraySuperContainer< T_Container >::init ( VoxelNode< ArraySuperContainer< Container >> const &  )

Initialization method, do nothing.

Definition at line 66 of file ArraySuperContainer.hpp.

◆ getNbVoxel()

template<class T_Container >
uint32_t voxomap::ArraySuperContainer< T_Container >::getNbVoxel ( ) const

Returns number of voxels.

◆ findVoxel() [1/2]

template<class T_Container >
template<typename Iterator >
VoxelData* voxomap::ArraySuperContainer< T_Container >::findVoxel ( Iterator &  it)

Find voxel.

Parameters
itIterator containing voxel position information
Returns
The voxel if exists, otherwise nullptr

◆ findVoxel() [2/2]

template<class T_Container >
template<typename Iterator >
VoxelData const* voxomap::ArraySuperContainer< T_Container >::findVoxel ( Iterator &  it) const

Find voxel.

Parameters
itIterator containing voxel position information
Returns
The voxel if exists, otherwise nullptr

◆ hasContainer() [1/3]

template<class T_Container >
bool voxomap::ArraySuperContainer< T_Container >::hasContainer ( uint8_t  x) const

Check if there is sub-container.

Parameters
xX index
Returns
True if there is sub-container

◆ hasContainer() [2/3]

template<class T_Container >
bool voxomap::ArraySuperContainer< T_Container >::hasContainer ( uint8_t  x,
uint8_t  y 
) const

Check if there is sub-container.

Parameters
xX index
yY index
Returns
True if there is sub-container

◆ hasContainer() [3/3]

template<class T_Container >
bool voxomap::ArraySuperContainer< T_Container >::hasContainer ( uint8_t  x,
uint8_t  y,
uint8_t  z 
) const

Check if there is sub-container.

Parameters
xX index
yY index
zZ index
Returns
True if there is sub-container

◆ findContainer() [1/2]

template<class T_Container >
Container* voxomap::ArraySuperContainer< T_Container >::findContainer ( uint8_t  x,
uint8_t  y,
uint8_t  z 
)

Find sub-container.

Parameters
xX index
yY index
zZ index
Returns
Pointer on the sub-container if exists, otherwise nullptr

◆ findContainer() [2/2]

template<class T_Container >
Container const* voxomap::ArraySuperContainer< T_Container >::findContainer ( uint8_t  x,
uint8_t  y,
uint8_t  z 
) const

Find sub-container.

Parameters
xX index
yY index
zZ index
Returns
Pointer on the sub-container if exists, otherwise nullptr

◆ addVoxel()

template<class T_Container >
template<typename Iterator , typename... Args>
bool voxomap::ArraySuperContainer< T_Container >::addVoxel ( Iterator &  it,
Args &&...  args 
)

Add a voxel, don't update an existing voxel.

Parameters
itIterator that contains the informations
argsArguments to forward to voxel constructor
Returns
True if success and update it

◆ updateVoxel()

template<class T_Container >
template<typename Iterator , typename... Args>
bool voxomap::ArraySuperContainer< T_Container >::updateVoxel ( Iterator &  it,
Args &&...  args 
)

Update an existing voxel, don't create a new one.

Parameters
itIterator that contains the informations
argsArguments to forward to voxel constructor
Returns
True if success

◆ putVoxel()

template<class T_Container >
template<typename Iterator , typename... Args>
void voxomap::ArraySuperContainer< T_Container >::putVoxel ( Iterator &  it,
Args &&...  args 
)

Add or update a voxel.

Parameters
itIterator that contains the informations
argsArguments to forward to voxel constructor

◆ removeVoxel()

template<class T_Container >
template<typename Iterator , typename... Args>
bool voxomap::ArraySuperContainer< T_Container >::removeVoxel ( Iterator const &  it,
Args &&...  args 
)

Remove an existing voxel.

Parameters
itIterator that contains the informations
argsArguments to forward to removeVoxel method of the container
Returns
True if success

◆ serialize()

template<class T_Container >
void voxomap::ArraySuperContainer< T_Container >::serialize ( std::string &  str) const

Serialize the structure.

Parameters
strString use for save the serialization

◆ unserialize()

template<class T_Container >
size_t voxomap::ArraySuperContainer< T_Container >::unserialize ( char const *  str,
size_t  size 
)

Unserialize str inside this.

Parameters
strString that contains data
sizeSize of the string
Returns
Number of bytes read inside str

◆ exploreVoxel()

template<class T_Container >
template<typename Iterator >
void voxomap::ArraySuperContainer< T_Container >::exploreVoxel ( Iterator &  it,
std::function< void(Iterator const &)> const &  predicate 
) const

Go through all voxels of the container and call the predicate for each.

Parameters
itBegin iterator
predicateFunction called for each voxel found

◆ exploreVoxelContainer()

template<class T_Container >
void voxomap::ArraySuperContainer< T_Container >::exploreVoxelContainer ( std::function< void(typename Container::VoxelContainer const &)> const &  predicate) const

Member Data Documentation

◆ NB_CONTAINERS

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::NB_CONTAINERS = 8
static

Definition at line 37 of file ArraySuperContainer.hpp.

◆ CONTAINER_MASK

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::CONTAINER_MASK = NB_CONTAINERS - 1
static

Definition at line 38 of file ArraySuperContainer.hpp.

◆ NB_VOXELS

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::NB_VOXELS = NB_CONTAINERS * Container::NB_VOXELS
static

Definition at line 39 of file ArraySuperContainer.hpp.

◆ COORD_MASK

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::COORD_MASK = ~(NB_VOXELS - 1)
static

Definition at line 40 of file ArraySuperContainer.hpp.

◆ VOXEL_MASK

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::VOXEL_MASK = Container::VOXEL_MASK
static

Definition at line 41 of file ArraySuperContainer.hpp.

◆ NB_SUPERCONTAINER

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::NB_SUPERCONTAINER = 1 + Container::NB_SUPERCONTAINER
static

Definition at line 42 of file ArraySuperContainer.hpp.

◆ SUPERCONTAINER_ID

template<class T_Container >
const uint32_t voxomap::ArraySuperContainer< T_Container >::SUPERCONTAINER_ID = NB_SUPERCONTAINER - 1
static

Definition at line 43 of file ArraySuperContainer.hpp.

◆ _containerArray

template<class T_Container >
std::unique_ptr<Container> voxomap::ArraySuperContainer< T_Container >::_containerArray[NB_CONTAINERS][NB_CONTAINERS][NB_CONTAINERS] = { 0 }
private

Array of voxel containers.

Definition at line 180 of file ArraySuperContainer.hpp.

◆ _nbVoxels

template<class T_Container >
uint32_t voxomap::ArraySuperContainer< T_Container >::_nbVoxels = 0
private

Number of voxels.

Definition at line 181 of file ArraySuperContainer.hpp.


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