Minetest  5.4.0
MinimapUpdateThread Class Reference

#include <minimap.h>

+ Inheritance diagram for MinimapUpdateThread:
+ Collaboration diagram for MinimapUpdateThread:

Public Member Functions

 MinimapUpdateThread ()
 
virtual ~MinimapUpdateThread ()
 
void getMap (v3s16 pos, s16 size, s16 height)
 
void enqueueBlock (v3s16 pos, MinimapMapblock *data)
 
bool pushBlockUpdate (v3s16 pos, MinimapMapblock *data)
 
bool popBlockUpdate (QueuedMinimapUpdate *update)
 
- Public Member Functions inherited from UpdateThread
 UpdateThread (const std::string &name)
 
 ~UpdateThread ()=default
 
void deferUpdate ()
 
void stop ()
 
void * run ()
 
- Public Member Functions inherited from Thread
 Thread (const std::string &name="")
 
virtual ~Thread ()
 
bool start ()
 
bool stop ()
 
bool wait ()
 
bool isCurrentThread ()
 
bool isRunning ()
 
bool stopRequested ()
 
std::thread::id getThreadId ()
 
bool getReturnValue (void **ret)
 
bool bindToProcessor (unsigned int proc_number)
 
bool setPriority (int prio)
 

Public Attributes

MinimapDatadata = nullptr
 

Protected Member Functions

virtual void doUpdate ()
 

Private Attributes

std::mutex m_queue_mutex
 
std::deque< QueuedMinimapUpdatem_update_queue
 
std::map< v3s16, MinimapMapblock * > m_blocks_cache
 

Additional Inherited Members

- Static Public Member Functions inherited from Thread
static void setName (const std::string &name)
 
static unsigned int getNumberOfProcessors ()
 
- Protected Attributes inherited from Thread
std::string m_name
 

Constructor & Destructor Documentation

◆ MinimapUpdateThread()

MinimapUpdateThread::MinimapUpdateThread ( )
inline

◆ ~MinimapUpdateThread()

MinimapUpdateThread::~MinimapUpdateThread ( )
virtual

References m_blocks_cache, and m_update_queue.

Member Function Documentation

◆ doUpdate()

void MinimapUpdateThread::doUpdate ( )
protectedvirtual

Implements UpdateThread.

References QueuedMinimapUpdate::data, data, getMap(), m_blocks_cache, MinimapData::map_invalidated, MinimapModeDef::map_size, MINIMAP_TYPE_RADAR, MINIMAP_TYPE_SURFACE, MinimapData::mode, popBlockUpdate(), MinimapData::pos, QueuedMinimapUpdate::pos, MinimapModeDef::scan_height, and MinimapModeDef::type.

+ Here is the call graph for this function:

◆ enqueueBlock()

void MinimapUpdateThread::enqueueBlock ( v3s16  pos,
MinimapMapblock data 
)

References data, UpdateThread::deferUpdate(), and pushBlockUpdate().

Referenced by Minimap::addBlock().

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

◆ getMap()

void MinimapUpdateThread::getMap ( v3s16  pos,
s16  size,
s16  height 
)

References MinimapPixel::air_count, componentwise_max(), componentwise_min(), CONTENT_AIR, MinimapMapblock::data, data, getNodeBlockPos(), MinimapPixel::height, m_blocks_cache, MAP_BLOCKSIZE, MinimapData::minimap_scan, MinimapPixel::n, and MapNode::param0.

Referenced by doUpdate().

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

◆ popBlockUpdate()

bool MinimapUpdateThread::popBlockUpdate ( QueuedMinimapUpdate update)

References m_queue_mutex, and m_update_queue.

Referenced by doUpdate().

+ Here is the caller graph for this function:

◆ pushBlockUpdate()

bool MinimapUpdateThread::pushBlockUpdate ( v3s16  pos,
MinimapMapblock data 
)

References QueuedMinimapUpdate::data, data, m_queue_mutex, m_update_queue, and QueuedMinimapUpdate::pos.

Referenced by enqueueBlock().

+ Here is the caller graph for this function:

Member Data Documentation

◆ data

MinimapData* MinimapUpdateThread::data = nullptr

◆ m_blocks_cache

std::map<v3s16, MinimapMapblock *> MinimapUpdateThread::m_blocks_cache
private

◆ m_queue_mutex

std::mutex MinimapUpdateThread::m_queue_mutex
private

Referenced by popBlockUpdate(), and pushBlockUpdate().

◆ m_update_queue

std::deque<QueuedMinimapUpdate> MinimapUpdateThread::m_update_queue
private

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