#include <areastore.h>
Public Member Functions | |
virtual void | reserve (size_t count) |
virtual bool | insertArea (Area *a) |
Add an area to the store. | |
virtual bool | removeArea (u32 id) |
Removes an area from the store by ID. | |
virtual void | getAreasInArea (std::vector< Area * > *result, v3s16 minedge, v3s16 maxedge, bool accept_overlap) |
Finds areas that are completely contained inside the area defined by the passed edges. | |
Public Member Functions inherited from AreaStore | |
AreaStore () | |
virtual | ~AreaStore ()=default |
size_t | size () const |
void | getAreasForPos (std::vector< Area * > *result, v3s16 pos) |
Finds areas that the passed position is contained in. | |
void | setCacheParams (bool enabled, u8 block_radius, size_t limit) |
Sets cache parameters. | |
const Area * | getArea (u32 id) const |
Returns a pointer to the area coresponding to the passed ID, or NULL if it doesn't exist. | |
void | serialize (std::ostream &is) const |
Serializes the store's areas to a binary ostream. | |
void | deserialize (std::istream &is) |
Deserializes the Areas from a binary istream. | |
Protected Member Functions | |
virtual void | getAreasForPosImpl (std::vector< Area * > *result, v3s16 pos) |
Implementation of getAreasForPos. | |
Protected Member Functions inherited from AreaStore | |
void | invalidateCache () |
Invalidates the getAreasForPos cache. | |
u32 | getNextId () const |
Returns the next area ID and increments it. | |
Private Attributes | |
std::vector< Area * > | m_areas |
Additional Inherited Members | |
Static Public Member Functions inherited from AreaStore | |
static AreaStore * | getOptimalImplementation () |
Protected Types inherited from AreaStore | |
typedef std::map< u32, Area > | AreaMap |
Protected Attributes inherited from AreaStore | |
AreaMap | areas_map |
|
protectedvirtual |
Implementation of getAreasForPos.
getAreasForPos calls this if the cache is disabled.
Implements AreaStore.
References AST_CONTAINS_PT, and m_areas.
|
virtual |
Finds areas that are completely contained inside the area defined by the passed edges.
If accept_overlap
is true this finds any areas that intersect with the passed area at any point.
Implements AreaStore.
References AST_AREAS_OVERLAP, AST_CONTAINS_AREA, and m_areas.
|
virtual |
Add an area to the store.
Updates the area's ID if it hasn't already been set.
Implements AreaStore.
References AreaStore::areas_map, AreaStore::getNextId(), Area::id, AreaStore::invalidateCache(), m_areas, and U32_MAX.
Referenced by TestAreaStore::testSerialization().
|
virtual |
Removes an area from the store by ID.
Implements AreaStore.
References AreaStore::areas_map, AreaStore::invalidateCache(), and m_areas.
|
inlinevirtual |
|
private |
Referenced by getAreasForPosImpl(), getAreasInArea(), insertArea(), removeArea(), and reserve().