ASAPCabinetFE
 
Loading...
Searching...
No Matches
LoadingProgress Struct Reference

Tracks the loading progress state for ASAPCabinetFE. More...

#include <loading_progress.h>

+ Collaboration diagram for LoadingProgress:

Public Member Functions

void addLogMessage (const std::string &message)
 Adds a log message to the buffer for UI display.
 

Public Attributes

std::mutex mutex
 Mutex for thread-safe access to all members, used by loading and rendering threads.
 
int currentTablesLoaded = 0
 Number of tables currently loaded (used for per-table progress bar).
 
int totalTablesToLoad = 0
 Total number of tables to load (denominator for per-table progress bar).
 
int currentStage = 0
 Current overall progress stage (e.g., fetching VPSDB, scanning, matchmaking).
 
int totalStages = 11
 Total number of stages.
 
std::string currentTask = "Initializing..."
 Description of the current task (e.g., "Scanning Tables (5)").
 
int numMatched = 0
 Number of tables successfully matched with metadata (used for match progress bar).
 
int numNoMatch = 0
 Number of tables with no metadata match (displayed in UI stats).
 
std::deque< std::string > logMessages
 Buffer of recent log messages for display in the loading screen's mini terminal.
 
size_t maxLogMessages = 10
 Maximum number of log messages to store (keeps last 10, older messages are removed).
 

Detailed Description

Tracks the loading progress state for ASAPCabinetFE.

This struct stores the state of the loading process, including overall progress (stages like fetching, scanning, matchmaking), per-table loading progress, metadata matching statistics, and a log message buffer for UI display. It is designed to be shared between a loading thread and a rendering thread (e.g., LoadingScreen), with thread safety ensured via a mutex. The struct supports a mini terminal display in the UI by maintaining a capped deque of recent log messages.

Member Function Documentation

◆ addLogMessage()

void LoadingProgress::addLogMessage ( const std::string &  message)
inline

Adds a log message to the buffer for UI display.

Appends a new log message to the logMessages deque, maintaining a maximum size of maxLogMessages by removing the oldest message if necessary. This method is called by the loading thread to report progress or issues, and the messages are displayed in the LoadingScreen's mini terminal.

Parameters
messageThe log message to add (e.g., "DEBUG: Loaded table X").
Note
Thread safety must be ensured by locking the mutex before calling this method.

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