#include <Activity.h>
template<typename ACTIVITY>
class Stroika::Foundation::Execution::DeclareActivity< ACTIVITY >
Push the argument Activity onto the current thread's Activity stack in the constructor, and pop it off in the destructor.
- Example Usage
static constexpr Activity kBuildingThingy_ {
"building thingy"sv };
try {
doBuildThing ();
}
catch (...) {
Assert (exceptionMsg.Contains (kBuildingThingy_.AsString ());
}
String ToString(T &&t, ARGS... args)
Return a debug-friendly, display version of the argument: not guaranteed parsable or usable except fo...
- Note
- these activities are captured via CaptureCurrentActivities() - when an ExceptionStringHelper subclass (any of the Stroika Exception classes) is constructed. For 3rd-party exceptions, consider wrapping with NestedException.
Definition at line 149 of file Activity.h.
◆ DeclareActivity()
template<typename ACTIVITY >
The caller must always declare an Activity object whose address can be taken, and whose lifetime exceeds that of the DeclareActivity object.
- Note
- the Activity* argument MAY be nullptr, in which case this does nothing.
This is allowed to facilitate examples like:
\code
DeclareActivity declareActivity { flag? &kSomeActivity_? nullptr }; // so we only conditionally declare the activity
\endcode
I considered using optional<ACTIVITY> - but tricky since we pass in pointer - and really not much point. This has practically zero
overhead, and is easy enough to understand and use.
The documentation for this class was generated from the following files: