NDEVR
API Documentation
Logfinal

Serves as the primary program interface for processes to report issues and allows any number of LogStreams to subscribe and receive the log information in real-time. More...

Inheritance diagram for Log:
[legend]
Collaboration diagram for Log:
[legend]

Public Member Functions

 Log (const Log &log)
 Copy constructs a Log from another Log.
 Log (uint08 id=0)
 Constructs a Log with the given identifier.
virtual ~Log ()
 Destructor.
void addInput (const StringView &s) final override
 Provides input text, automatically resolving the input guard index.
void addInput (const StringView &s, uint04 idx) final override
 Provides input text for a specific input guard by index.
void addMessage (uint04 id, const LogMessage &message) final override
 Adds a single LogMessage to the log and notifies all subscribed streams.
void addMessage (uint04 id, const StringView &message, uint01 log_level=10) final override
 Adds a message from a string view with a specified log level.
void addMessage (uint04 id, const TranslatedString &message, uint01 log_level=10) final override
 Adds a translated message with a specified log level.
void addMessages (uint04 id, const Buffer< LogMessage > &messages) final override
 Adds multiple LogMessages to the log and notifies all subscribed streams.
void addStream (LogStream *stream, bool add_all) final override
 Subscribes a LogStream to receive log messages.
void concatenate (const Log &log)
 Appends all messages from another Log into this one.
void insertMessages (uint04 index, const Buffer< LogMessage > &messages)
 Inserts multiple LogMessages at a specific index in the log buffer.
fltp04 progressIdx (uint04 idx) const final override
 Retrieves the current progress percentage for a tracked progress source.
void removeStream (LogStream *stream) final override
 Unsubscribes a LogStream so it no longer receives log messages.
void setProgressIdx (uint04 idx, fltp04 percent) final override
 Sets the progress percentage for a tracked progress source.
void sortMessagesByPriority ()
 Sorts all stored messages by their priority level.
void sortMessagesByTime ()
 Sorts all stored messages by their timestamp.
Public Member Functions inherited from Buffer< LogMessage >
constexpr Buffer () noexcept
 Creates an empty buffer.
 ~Buffer ()
void add (LogMessage &&object)
 Adds object to the end of the buffer.
void addSpace (t_index_type space_to_add)
 Adds a space to the end of the buffer.
operator decltype auto () const
 Gets the first location of type* in the array.
sint04 compare (const Buffer &value) const
 Compares this Buffer to another to determine their relative ordering.
Buffer< t_other_type, t_other_memory_manager > getAs () const
 Gets a copy of this buffer, with filled objects t_other_type, where all objects are created using the contents of this buffer.
void insert (t_index_type location, const LogMessage &object)
 Adds an object to a specific location.
void removeAllOrdered (const LogMessage &object)
 Removes all instances of the object.
void removeAllOrderedFn (const t_functor &functor)
 Removes all items based on the functor.
void removeAllUnordered (const LogMessage &object)
 Removes all unordered described by object.

Protected Attributes

Dictionary< uint04, Stringm_input
 Maps input guard indices to their stored input strings.
Dictionary< uint04, ProgressSourcem_progress
 Maps progress source indices to their progress tracking data.
Dictionary< uint04, bool > m_request_cancel
 Maps cancel guard indices to their cancellation request state.

Private Member Functions

uint04 addCancelGuard (const TranslatedString &name) final override
 Registers a new cancel guard with a display name.
virtual void addCancelGuard (const TranslatedString &name, uint04 idx) final override
 Registers a new cancel guard at a specific index with a display name.
uint04 addInputGuard (const TranslatedString &name) final override
 Registers a new input guard with a display name, returning the assigned index.
void addInputGuard (const TranslatedString &name, uint04 idx) final override
 Registers a new input guard at a specific index with a display name.
uint04 addProgressSource (const TranslatedString &name, fltp04 progress) final override
 Registers a new progress source with a display name and initial progress.
virtual void addProgressSource (const TranslatedString &name, uint04 idx, fltp04 progress) final override
 Registers a new progress source at a specific index with a display name and initial progress.
bool cancelRequested () const final override
 Checks whether any cancel has been requested across all guards.
bool cancelRequestedIdx (uint04 idx) const final override
 Checks whether cancel has been requested for a specific guard.
void clearInputIdx (uint04 idx) final override
 Clears the stored input for a specific input guard.
void getInputIdx (String &s, uint04 idx, bool clear) final override
 Retrieves the input string for a specific input guard.
void removeCancelGuard (uint04 idx) final override
 Removes a previously registered cancel guard.
void removeInputGuard (uint04 idx) final override
 Removes a previously registered input guard.
void removeProgressSource (uint04 idx) final override
 Removes a previously registered progress source.
void requestCancel () final override
 Requests cancellation of all active operations.
void requestCancel (uint04) final override
 Requests cancellation of a specific operation by index.

Detailed Description

Serves as the primary program interface for processes to report issues and allows any number of LogStreams to subscribe and receive the log information in real-time.


Definition at line 49 of file Log.h.

Constructor & Destructor Documentation

◆ Log() [1/2]

Log::Log ( uint08 id = 0)
explicit

Constructs a Log with the given identifier.

Parameters
[in]idThe unique identifier for this log instance.

Referenced by Log(), and concatenate().

◆ Log() [2/2]

Log::Log ( const Log & log)

Copy constructs a Log from another Log.

Parameters
[in]logThe log instance to copy from.

References Log().

◆ ~Log()

virtual Log::~Log ( )
virtual

Destructor.

Cleans up log resources and detaches streams.

Member Function Documentation

◆ addCancelGuard() [1/2]

uint04 Log::addCancelGuard ( const TranslatedString & name)
finaloverrideprivatevirtual

Registers a new cancel guard with a display name.

Parameters
[in]nameThe display name for the cancellable operation.
Returns
The index assigned to the new cancel guard.

Implements InfoPipe.

References addCancelGuard().

Referenced by addCancelGuard(), and addCancelGuard().

◆ addCancelGuard() [2/2]

virtual void Log::addCancelGuard ( const TranslatedString & name,
uint04 idx )
finaloverrideprivatevirtual

Registers a new cancel guard at a specific index with a display name.

Parameters
[in]nameThe display name for the cancellable operation.
[in]idxThe index to assign to the cancel guard.

Implements InfoPipe.

References addCancelGuard().

◆ addInput() [1/2]

void Log::addInput ( const StringView & s)
finaloverridevirtual

Provides input text, automatically resolving the input guard index.

Parameters
[in]sThe input string to supply.

Implements InfoPipe.

References addInput().

◆ addInput() [2/2]

void Log::addInput ( const StringView & s,
uint04 idx )
finaloverridevirtual

Provides input text for a specific input guard by index.

Parameters
[in]sThe input string to supply.
[in]idxThe index of the input guard.

Implements InfoPipe.

References addInput().

Referenced by addInput(), and addInput().

◆ addInputGuard() [1/2]

uint04 Log::addInputGuard ( const TranslatedString & name)
finaloverrideprivatevirtual

Registers a new input guard with a display name, returning the assigned index.

Parameters
[in]nameThe display name for the input request.
Returns
The index assigned to the new input guard.

Implements InfoPipe.

References addInputGuard().

Referenced by addInputGuard(), and addInputGuard().

◆ addInputGuard() [2/2]

void Log::addInputGuard ( const TranslatedString & name,
uint04 idx )
finaloverrideprivatevirtual

Registers a new input guard at a specific index with a display name.

Parameters
[in]nameThe display name for the input request.
[in]idxThe index to assign to the input guard.

Implements InfoPipe.

References addInputGuard().

◆ addMessage() [1/3]

void Log::addMessage ( uint04 id,
const LogMessage & message )
finaloverridevirtual

Adds a single LogMessage to the log and notifies all subscribed streams.

Parameters
[in]idThe source identifier for the message.
[in]messageThe LogMessage to add.

Implements InfoPipe.

Referenced by addMessage().

◆ addMessage() [2/3]

void Log::addMessage ( uint04 id,
const StringView & message,
uint01 log_level = 10 )
finaloverridevirtual

Adds a message from a string view with a specified log level.

Parameters
[in]idThe source identifier for the message.
[in]messageThe message text.
[in]log_levelThe severity level of the message.

Implements InfoPipe.

◆ addMessage() [3/3]

void Log::addMessage ( uint04 id,
const TranslatedString & message,
uint01 log_level = 10 )
finaloverridevirtual

Adds a translated message with a specified log level.

Parameters
[in]idThe source identifier for the message.
[in]messageThe translated message text.
[in]log_levelThe severity level of the message.

Implements InfoPipe.

References addMessage().

◆ addMessages()

void Log::addMessages ( uint04 id,
const Buffer< LogMessage > & messages )
finaloverride

Adds multiple LogMessages to the log and notifies all subscribed streams.

Parameters
[in]idThe source identifier for the messages.
[in]messagesThe buffer of LogMessages to add.

References Buffer< LogMessage >::Buffer(), and addMessages().

Referenced by addMessages().

◆ addProgressSource() [1/2]

uint04 Log::addProgressSource ( const TranslatedString & name,
fltp04 progress )
finaloverrideprivatevirtual

Registers a new progress source with a display name and initial progress.

Parameters
[in]nameThe display name of the progress source.
[in]progressThe initial progress value.
Returns
The index assigned to the new progress source.

Implements InfoPipe.

References addProgressSource().

Referenced by addProgressSource(), and addProgressSource().

◆ addProgressSource() [2/2]

virtual void Log::addProgressSource ( const TranslatedString & name,
uint04 idx,
fltp04 progress )
finaloverrideprivatevirtual

Registers a new progress source at a specific index with a display name and initial progress.

Parameters
[in]nameThe display name of the progress source.
[in]idxThe index to assign to the progress source.
[in]progressThe initial progress value.

Implements InfoPipe.

References addProgressSource().

◆ addStream()

void Log::addStream ( LogStream * stream,
bool add_all )
finaloverridevirtual

Subscribes a LogStream to receive log messages.

Parameters
[in]streamThe LogStream to add as a subscriber.
[in]add_allWhether to replay all existing messages to the new stream.

Reimplemented from InfoPipe.

◆ cancelRequested()

bool Log::cancelRequested ( ) const
finaloverrideprivatevirtual

Checks whether any cancel has been requested across all guards.

Returns
True if a cancellation has been requested.

Implements InfoPipe.

References cancelRequested().

Referenced by cancelRequested().

◆ cancelRequestedIdx()

bool Log::cancelRequestedIdx ( uint04 idx) const
finaloverrideprivatevirtual

Checks whether cancel has been requested for a specific guard.

Parameters
[in]idxThe index of the cancel guard to check.
Returns
True if cancellation was requested for the given index.

Implements InfoPipe.

References cancelRequestedIdx().

Referenced by cancelRequestedIdx().

◆ clearInputIdx()

void Log::clearInputIdx ( uint04 idx)
finaloverrideprivatevirtual

Clears the stored input for a specific input guard.

Parameters
[in]idxThe index of the input guard to clear.

Implements InfoPipe.

References clearInputIdx().

Referenced by clearInputIdx().

◆ concatenate()

void Log::concatenate ( const Log & log)

Appends all messages from another Log into this one.

Parameters
[in]logThe log whose messages will be concatenated.

References Log(), and concatenate().

Referenced by concatenate().

◆ getInputIdx()

void Log::getInputIdx ( String & s,
uint04 idx,
bool clear )
finaloverrideprivatevirtual

Retrieves the input string for a specific input guard.

Parameters
[in]sThe string to populate with the input value.
[in]idxThe index of the input guard.
[in]clearWhether to clear the stored input after retrieval.

Reimplemented from InfoPipe.

References getInputIdx().

Referenced by getInputIdx().

◆ insertMessages()

void Log::insertMessages ( uint04 index,
const Buffer< LogMessage > & messages )

Inserts multiple LogMessages at a specific index in the log buffer.

Parameters
[in]indexThe position at which to insert the messages.
[in]messagesThe buffer of LogMessages to insert.

References Buffer< LogMessage >::Buffer(), and insertMessages().

Referenced by insertMessages().

◆ progressIdx()

fltp04 Log::progressIdx ( uint04 idx) const
finaloverridevirtual

Retrieves the current progress percentage for a tracked progress source.

Parameters
[in]idxThe index of the progress source.
Returns
The current progress value as a fraction (0.0 to 1.0).

Reimplemented from InfoPipe.

References progressIdx().

Referenced by progressIdx().

◆ removeCancelGuard()

void Log::removeCancelGuard ( uint04 idx)
finaloverrideprivatevirtual

Removes a previously registered cancel guard.

Parameters
[in]idxThe index of the cancel guard to remove.

Implements InfoPipe.

References removeCancelGuard().

Referenced by removeCancelGuard().

◆ removeInputGuard()

void Log::removeInputGuard ( uint04 idx)
finaloverrideprivatevirtual

Removes a previously registered input guard.

Parameters
[in]idxThe index of the input guard to remove.

Implements InfoPipe.

References removeInputGuard().

Referenced by removeInputGuard().

◆ removeProgressSource()

void Log::removeProgressSource ( uint04 idx)
finaloverrideprivatevirtual

Removes a previously registered progress source.

Parameters
[in]idxThe index of the progress source to remove.

Implements InfoPipe.

References removeProgressSource().

Referenced by removeProgressSource().

◆ removeStream()

void Log::removeStream ( LogStream * stream)
finaloverridevirtual

Unsubscribes a LogStream so it no longer receives log messages.

Parameters
[in]streamThe LogStream to remove.

Reimplemented from InfoPipe.

◆ requestCancel()

void Log::requestCancel ( uint04 )
finaloverrideprivatevirtual

Requests cancellation of a specific operation by index.

Parameters
[in]idxThe index of the cancel guard to cancel.

Implements InfoPipe.

References requestCancel().

◆ setProgressIdx()

void Log::setProgressIdx ( uint04 idx,
fltp04 percent )
finaloverridevirtual

Sets the progress percentage for a tracked progress source.

Parameters
[in]idxThe index of the progress source.
[in]percentThe progress value as a fraction (0.0 to 1.0).

Implements InfoPipe.

References setProgressIdx().

Referenced by setProgressIdx().


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