mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-21 01:11:43 +02:00
refactor: make MainSignalsInstance() a class
and use Doxygen documentation for it, per our developer notes. Context: MainSignalsInstance was created in 3a19fed9db5 and originally was a struct collection of boost::signals methods moved to validationinterface.cpp, in order to no longer need to include boost/signals in validationinterface.h. MainSignalsInstance then evolved in d6815a23131 to remove boost/signals2 and became class-like. [C.8: Use class rather than struct if any member is non-public](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-class) [C.2: Use class if the class has an invariant; use struct if the data members can vary independently](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c2-use-class-if-the-class-has-an-invariant-use-struct-if-the-data-members-can-vary-independently) A class also has the advantage of default private access, as opposed to public for a struct.
This commit is contained in:
parent
1ad5d5088d
commit
23854f8402
@ -16,14 +16,16 @@
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
//! The MainSignalsInstance manages a list of shared_ptr<CValidationInterface>
|
||||
//! callbacks.
|
||||
//!
|
||||
//! A std::unordered_map is used to track what callbacks are currently
|
||||
//! registered, and a std::list is to used to store the callbacks that are
|
||||
//! currently registered as well as any callbacks that are just unregistered
|
||||
//! and about to be deleted when they are done executing.
|
||||
struct MainSignalsInstance {
|
||||
/**
|
||||
* MainSignalsInstance manages a list of shared_ptr<CValidationInterface> callbacks.
|
||||
*
|
||||
* A std::unordered_map is used to track what callbacks are currently
|
||||
* registered, and a std::list is used to store the callbacks that are
|
||||
* currently registered as well as any callbacks that are just unregistered
|
||||
* and about to be deleted when they are done executing.
|
||||
*/
|
||||
class MainSignalsInstance
|
||||
{
|
||||
private:
|
||||
Mutex m_mutex;
|
||||
//! List entries consist of a callback pointer and reference count. The
|
||||
|
@ -177,7 +177,7 @@ protected:
|
||||
friend class ValidationInterfaceTest;
|
||||
};
|
||||
|
||||
struct MainSignalsInstance;
|
||||
class MainSignalsInstance;
|
||||
class CMainSignals {
|
||||
private:
|
||||
std::unique_ptr<MainSignalsInstance> m_internals;
|
||||
|
Loading…
x
Reference in New Issue
Block a user