Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
cNetworkLookup Class Reference

#include <NetworkLookup.h>

Inheritance diagram for cNetworkLookup:
Inheritance graph
[legend]
Collaboration diagram for cNetworkLookup:
Collaboration graph
[legend]

Public Member Functions

 cNetworkLookup ()
 
void ScheduleLookup (std::function< void()> a_Lookup)
 Schedule a lookup task for execution. More...
 
void Stop ()
 Cancels any scheduled lookups and joins the lookup thread. More...
 
virtual ~cNetworkLookup () override
 
- Public Member Functions inherited from cIsThread
 cIsThread (AString &&a_ThreadName)
 
bool IsCurrentThread (void) const
 Returns true if the thread calling this function is the thread contained within this object. More...
 
void Start (void)
 Starts the thread; returns without waiting for the actual start. More...
 
void Stop (void)
 Signals the thread to terminate and waits until it's finished. More...
 
virtual ~cIsThread ()
 

Protected Member Functions

virtual void Execute () override final
 Process the queue until the thread is stopped. More...
 

Private Attributes

cQueue< std::function< void()> > m_WorkQueue
 The queue of lookup tasks waiting to be executed. More...
 

Additional Inherited Members

- Protected Attributes inherited from cIsThread
std::atomic< bool > m_ShouldTerminate
 The overriden Execute() method should check this value periodically and terminate if this is true. More...
 

Detailed Description

Definition at line 17 of file NetworkLookup.h.

Constructor & Destructor Documentation

◆ cNetworkLookup()

cNetworkLookup::cNetworkLookup ( )

Definition at line 13 of file NetworkLookup.cpp.

◆ ~cNetworkLookup()

cNetworkLookup::~cNetworkLookup ( )
overridevirtual

Definition at line 22 of file NetworkLookup.cpp.

Member Function Documentation

◆ Execute()

void cNetworkLookup::Execute ( void  )
finaloverrideprotectedvirtual

Process the queue until the thread is stopped.

Implements cIsThread.

Definition at line 52 of file NetworkLookup.cpp.

◆ ScheduleLookup()

void cNetworkLookup::ScheduleLookup ( std::function< void()>  a_Lookup)

Schedule a lookup task for execution.

Definition at line 31 of file NetworkLookup.cpp.

◆ Stop()

void cNetworkLookup::Stop ( void  )

Cancels any scheduled lookups and joins the lookup thread.

Definition at line 40 of file NetworkLookup.cpp.

Member Data Documentation

◆ m_WorkQueue

cQueue<std::function<void()> > cNetworkLookup::m_WorkQueue
private

The queue of lookup tasks waiting to be executed.

Definition at line 39 of file NetworkLookup.h.


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