LogViewer
A modern log viewer with AI-assisted analysis (Qt 6)
Loading...
Searching...
No Matches
mvc::MainController Class Reference

#include <MainController.hpp>

Inheritance diagram for mvc::MainController:
Inheritance graph
Collaboration diagram for mvc::MainController:
Collaboration graph

Public Member Functions

 MainController (db::EventsContainer &events)
 
std::vector< std::string > GetSearchColumns () const override
 
void SearchEvents (const std::string &query, const std::vector< std::string > &columns, const std::function< void(const SearchResultRow &)> &onResult, std::function< void(size_t, size_t)> progressCallback={}) override
 
void LoadLogFile (const std::filesystem::path &filepath, parser::IDataParserObserver *observer) override
 Parses and loads the provided log file into the model.
 
uint32_t GetParserCurrentProgress () const override
 
uint32_t GetParserTotalProgress () const override
 
void ProgressUpdated () override
 Called when parsing progress is updated.
 
void NewEventFound (db::LogEvent &&event) override
 Called when a new event is discovered during parsing.
 
void NewEventBatchFound (std::vector< std::pair< int, db::LogEvent::EventItems > > &&eventBatch) override
 Called when a batch of new events is discovered during parsing.
 

Private Attributes

db::EventsContainer & m_events
 
std::unique_ptr< parser::IDataParser > m_activeParser
 

Constructor & Destructor Documentation

◆ MainController()

mvc::MainController::MainController ( db::EventsContainer &  events)
explicit

Member Function Documentation

◆ GetParserCurrentProgress()

uint32_t mvc::MainController::GetParserCurrentProgress ( ) const
overridevirtual
Returns
current parser progress (0 if idle).

Implements mvc::IController.

◆ GetParserTotalProgress()

uint32_t mvc::MainController::GetParserTotalProgress ( ) const
overridevirtual
Returns
parser total progress target (0 if unknown/idle).

Implements mvc::IController.

◆ GetSearchColumns()

std::vector< std::string > mvc::MainController::GetSearchColumns ( ) const
overridevirtual

Implements mvc::IController.

Here is the call graph for this function:

◆ LoadLogFile()

void mvc::MainController::LoadLogFile ( const std::filesystem::path &  filepath,
parser::IDataParserObserver *  observer 
)
overridevirtual

Parses and loads the provided log file into the model.

Implements mvc::IController.

Here is the call graph for this function:

◆ NewEventBatchFound()

void mvc::MainController::NewEventBatchFound ( std::vector< std::pair< int, db::LogEvent::EventItems > > &&  eventBatch)
overridevirtual

Called when a batch of new events is discovered during parsing.

For performance reasons, parsers may collect multiple events before notifying observers. This method delivers a batch of events at once.

Parameters
eventBatchVector of (id, items) pairs representing the events
Note
This method is preferred over NewEventFound for high-throughput scenarios

Implements parser::IDataParserObserver.

Here is the call graph for this function:

◆ NewEventFound()

void mvc::MainController::NewEventFound ( db::LogEvent &&  event)
overridevirtual

Called when a new event is discovered during parsing.

Parameters
eventThe newly parsed LogEvent (moved to avoid copying)
Note
Implementations should be efficient as this may be called very frequently during parsing of large files

Implements parser::IDataParserObserver.

Here is the call graph for this function:

◆ ProgressUpdated()

void mvc::MainController::ProgressUpdated ( )
overridevirtual

Called when parsing progress is updated.

This method is invoked periodically during parsing operations to allow observers to update progress indicators in the user interface.

Note
Implementations should be efficient as this may be called frequently

Implements parser::IDataParserObserver.

◆ SearchEvents()

void mvc::MainController::SearchEvents ( const std::string &  query,
const std::vector< std::string > &  columns,
const std::function< void(const SearchResultRow &)> &  onResult,
std::function< void(size_t, size_t)>  progressCallback = {} 
)
overridevirtual

Implements mvc::IController.

Here is the call graph for this function:

Member Data Documentation

◆ m_activeParser

std::unique_ptr<parser::IDataParser> mvc::MainController::m_activeParser
private

◆ m_events

db::EventsContainer& mvc::MainController::m_events
private

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