Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
VectorAreaStore Class Reference

#include <areastore.h>

+ Inheritance diagram for VectorAreaStore:
+ Collaboration diagram for VectorAreaStore:

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 AreagetArea (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 AreaStoregetOptimalImplementation ()
 
- Protected Types inherited from AreaStore
typedef std::map< u32, AreaAreaMap
 
- Protected Attributes inherited from AreaStore
AreaMap areas_map
 

Member Function Documentation

◆ getAreasForPosImpl()

void VectorAreaStore::getAreasForPosImpl ( std::vector< Area * > * result,
v3s16 pos )
protectedvirtual

Implementation of getAreasForPos.

getAreasForPos calls this if the cache is disabled.

Implements AreaStore.

References AST_CONTAINS_PT, and m_areas.

◆ getAreasInArea()

void VectorAreaStore::getAreasInArea ( std::vector< Area * > * result,
v3s16 minedge,
v3s16 maxedge,
bool accept_overlap )
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.

◆ insertArea()

bool VectorAreaStore::insertArea ( Area * a)
virtual

Add an area to the store.

Updates the area's ID if it hasn't already been set.

Returns
Whether the area insertion was successful.

Implements AreaStore.

References AreaStore::areas_map, AreaStore::getNextId(), Area::id, AreaStore::invalidateCache(), m_areas, and U32_MAX.

Referenced by TestAreaStore::testSerialization().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeArea()

bool VectorAreaStore::removeArea ( u32 id)
virtual

Removes an area from the store by ID.

Returns
Whether the area was in the store and removed.

Implements AreaStore.

References AreaStore::areas_map, AreaStore::invalidateCache(), and m_areas.

+ Here is the call graph for this function:

◆ reserve()

virtual void VectorAreaStore::reserve ( size_t count)
inlinevirtual

Reimplemented from AreaStore.

References m_areas.

Member Data Documentation

◆ m_areas

std::vector<Area *> VectorAreaStore::m_areas
private

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