Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
node::Warnings Class Reference

Manages warning messages within a node. More...

#include <warnings.h>

Collaboration diagram for node::Warnings:
[legend]

Public Member Functions

 Warnings ()
 
 Warnings (const Warnings &)=delete
 A warnings instance should always be passed by reference, never copied. More...
 
Warningsoperator= (const Warnings &)=delete
 
bool Set (warning_type id, bilingual_str message) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 Set a warning message. More...
 
bool Unset (warning_type id) EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 Unset a warning message. More...
 
std::vector< bilingual_strGetMessages () const EXCLUSIVE_LOCKS_REQUIRED(!m_mutex)
 Return potential problems detected by the node, sorted by the warning_type id. More...
 

Private Types

typedef std::variant< kernel::Warning, node::Warningwarning_type
 

Private Member Functions

std::map< warning_type, bilingual_str > m_warnings GUARDED_BY (m_mutex)
 

Private Attributes

Mutex m_mutex
 

Detailed Description

Manages warning messages within a node.

The Warnings class provides mechanisms to set, unset, and retrieve warning messages. It updates the GUI when warnings are changed.

This class is designed to be non-copyable to ensure warnings are managed centrally.

Definition at line 39 of file warnings.h.

Member Typedef Documentation

◆ warning_type

Definition at line 41 of file warnings.h.

Constructor & Destructor Documentation

◆ Warnings() [1/2]

node::Warnings::Warnings ( )

Definition at line 20 of file warnings.cpp.

Here is the call graph for this function:

◆ Warnings() [2/2]

node::Warnings::Warnings ( const Warnings )
delete

A warnings instance should always be passed by reference, never copied.

Member Function Documentation

◆ GetMessages()

std::vector< bilingual_str > node::Warnings::GetMessages ( ) const

Return potential problems detected by the node, sorted by the warning_type id.

Definition at line 43 of file warnings.cpp.

Here is the caller graph for this function:

◆ GUARDED_BY()

std::map< warning_type, bilingual_str > m_warnings node::Warnings::GUARDED_BY ( m_mutex  )
private

◆ operator=()

Warnings & node::Warnings::operator= ( const Warnings )
delete

◆ Set()

bool node::Warnings::Set ( warning_type  id,
bilingual_str  message 
)

Set a warning message.

If a warning with the specified id is already active, false is returned and the new warning is ignored. If id does not yet exist, the warning is set, the UI is updated, and true is returned.

Parameters
[in]idUnique identifier of the warning.
[in]messageWarning message to be shown.
Returns
true if the warning was indeed set (i.e. there is no active warning with this id), otherwise false.

Definition at line 29 of file warnings.cpp.

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

◆ Unset()

bool node::Warnings::Unset ( warning_type  id)

Unset a warning message.

If a warning with the specified id is active, it is unset, the UI is updated, and true is returned. Otherwise, no warning is unset and false is returned.

Parameters
[in]idUnique identifier of the warning.
Returns
true if the warning was indeed unset (i.e. there is an active warning with this id), otherwise false.

Definition at line 36 of file warnings.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_mutex

Mutex node::Warnings::m_mutex
mutableprivate

Definition at line 43 of file warnings.h.


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