Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Public Attributes | List of all members
ChunkDataStore< ElementType, ElementCount, DefaultValue > Struct Template Reference

#include <ChunkData.h>

Public Types

using Type = std::array< ElementType, ElementCount >
 

Public Member Functions

void Assign (const ChunkDataStore< ElementType, ElementCount, DefaultValue > &a_Other)
 Copy assign from another ChunkDataStore. More...
 
ElementType Get (Vector3i a_Position) const
 Gets one value at the given position. More...
 
TypeGetSection (size_t a_Y) const
 Returns a raw pointer to the internal representation of the specified section. More...
 
void Set (Vector3i a_Position, ElementType a_Value)
 Sets one value at the given position. More...
 
void SetAll (const ElementType(&a_Source)[cChunkDef::NumSections *ElementCount])
 Copies the data from the specified flat array into the internal representation. More...
 
void SetSection (const ElementType(&a_Source)[ElementCount], size_t a_Y)
 Copies the data from the specified flat section array into the internal representation. More...
 

Public Attributes

std::unique_ptr< TypeStore [cChunkDef::NumSections]
 Contains all the sections this ChunkDataStore manages. More...
 

Detailed Description

template<class ElementType, size_t ElementCount, ElementType DefaultValue>
struct ChunkDataStore< ElementType, ElementCount, DefaultValue >

Definition at line 20 of file ChunkData.h.

Member Typedef Documentation

◆ Type

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
using ChunkDataStore< ElementType, ElementCount, DefaultValue >::Type = std::array<ElementType, ElementCount>

Definition at line 22 of file ChunkData.h.

Member Function Documentation

◆ Assign()

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
void ChunkDataStore< ElementType, ElementCount, DefaultValue >::Assign ( const ChunkDataStore< ElementType, ElementCount, DefaultValue > &  a_Other)

Copy assign from another ChunkDataStore.

Definition at line 55 of file ChunkData.cpp.

◆ Get()

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
ElementType ChunkDataStore< ElementType, ElementCount, DefaultValue >::Get ( Vector3i  a_Position) const

Gets one value at the given position.

Returns DefaultValue if the section is not allocated.

Definition at line 73 of file ChunkData.cpp.

◆ GetSection()

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
ChunkDataStore< ElementType, ElementCount, DefaultValue >::Type * ChunkDataStore< ElementType, ElementCount, DefaultValue >::GetSection ( size_t  a_Y) const

Returns a raw pointer to the internal representation of the specified section.

Will be nullptr if the section is not allocated.

Definition at line 98 of file ChunkData.cpp.

◆ Set()

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
void ChunkDataStore< ElementType, ElementCount, DefaultValue >::Set ( Vector3i  a_Position,
ElementType  a_Value 
)

Sets one value at the given position.

Allocates a section if needed for the operation.

Definition at line 108 of file ChunkData.cpp.

◆ SetAll()

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
void ChunkDataStore< ElementType, ElementCount, DefaultValue >::SetAll ( const ElementType(&)  a_Source[cChunkDef::NumSections *ElementCount])

Copies the data from the specified flat array into the internal representation.

Allocates sections that are needed for the operation.

Definition at line 160 of file ChunkData.cpp.

◆ SetSection()

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
void ChunkDataStore< ElementType, ElementCount, DefaultValue >::SetSection ( const ElementType(&)  a_Source[ElementCount],
size_t  a_Y 
)

Copies the data from the specified flat section array into the internal representation.

Allocates a section if needed for the operation.

Definition at line 139 of file ChunkData.cpp.

Member Data Documentation

◆ Store

template<class ElementType , size_t ElementCount, ElementType DefaultValue>
std::unique_ptr<Type> ChunkDataStore< ElementType, ElementCount, DefaultValue >::Store[cChunkDef::NumSections]

Contains all the sections this ChunkDataStore manages.

Definition at line 48 of file ChunkData.h.


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