Skip to content

Commit 23854f8

Browse files
committed
refactor: make MainSignalsInstance() a class
and use Doxygen documentation for it, per our developer notes. Context: MainSignalsInstance was created in 3a19fed 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 d6815a2 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.
1 parent 1ad5d50 commit 23854f8

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/validationinterface.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@
1616
#include <unordered_map>
1717
#include <utility>
1818

19-
//! The MainSignalsInstance manages a list of shared_ptr<CValidationInterface>
20-
//! callbacks.
21-
//!
22-
//! A std::unordered_map is used to track what callbacks are currently
23-
//! registered, and a std::list is to used to store the callbacks that are
24-
//! currently registered as well as any callbacks that are just unregistered
25-
//! and about to be deleted when they are done executing.
26-
struct MainSignalsInstance {
19+
/**
20+
* MainSignalsInstance manages a list of shared_ptr<CValidationInterface> callbacks.
21+
*
22+
* A std::unordered_map is used to track what callbacks are currently
23+
* registered, and a std::list is used to store the callbacks that are
24+
* currently registered as well as any callbacks that are just unregistered
25+
* and about to be deleted when they are done executing.
26+
*/
27+
class MainSignalsInstance
28+
{
2729
private:
2830
Mutex m_mutex;
2931
//! List entries consist of a callback pointer and reference count. The

src/validationinterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class CValidationInterface {
177177
friend class ValidationInterfaceTest;
178178
};
179179

180-
struct MainSignalsInstance;
180+
class MainSignalsInstance;
181181
class CMainSignals {
182182
private:
183183
std::unique_ptr<MainSignalsInstance> m_internals;

0 commit comments

Comments
 (0)