![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Macros to implement the Private State (PIMPL-like) idiom with value semantics. More...
Go to the source code of this file.
Macros | |
| #define | DFX_PRIVATE_STATE(Class, logger) |
| Declare a private implementation state for a class. | |
| #define | DFX_PRIVATE_STATE_DECLARE_RULE_OF_5(Class) |
| Declare Rule-of-5 special member functions using the private state pattern. | |
| #define | DFX_PRIVATE_STATE_DEFINE_RULE_OF_5(ns, Class) |
| Define Rule-of-5 special member functions for a private state class. | |
Macros to implement the Private State (PIMPL-like) idiom with value semantics.
This header provides a set of macros used to implement a private state pattern, where a public-facing class owns its implementation details via an opaque internal state object.
The primary goals of these macros are:
| #define DFX_PRIVATE_STATE | ( | Class, | |
| logger ) |
Declare a private implementation state for a class.
This macro declares an internal State type and a shared ownership wrapper around it. The wrapper is used to ensure that lambdas or callbacks capturing the state remain valid even if the owning object is moved.
Must be placed in the private section of a class.
| Class | Name of the owning class. |
| logger | Logger instance or expression used by the state. |
| #define DFX_PRIVATE_STATE_DECLARE_RULE_OF_5 | ( | Class | ) |
Declare Rule-of-5 special member functions using the private state pattern.
This macro declares:
Copy operations are disabled.
The destructor is not declared virtual as pimpl semantic with inheritance is messy.
| Class | Name of the owning class. |
| #define DFX_PRIVATE_STATE_DEFINE_RULE_OF_5 | ( | ns, | |
| Class ) |
Define Rule-of-5 special member functions for a private state class.
This macro provides the definitions for the functions declared by DFX_PRIVATE_STATE_DECLARE_RULE_OF_5 and must be used in a single TU.
| Class | Name of the owning class. |