Struct command_context_base
Defined in File command.h
Inheritance Relationships
Derived Type
public liberate::concurrency::command::command_context< paramsT, resultsT >
(Template Struct command_context)
Struct Documentation
-
struct command_context_base
The commmand_context_base is a simple base type for
command_context
, which largely exists for providing a virtual destructor so that derived types destruct properly.Concrete command contexts are specializations of a template based on the command parameters, which means providing a different means for a virtual base type is not possible.
Subclassed by liberate::concurrency::command::command_context< paramsT, resultsT >
Public Functions
-
inline explicit command_context_base(command_type _type)
Constructor for the context; takes a command type.
- Parameters
_type – [in] the command type for this context.
-
virtual ~command_context_base() = default
Virtual destructor
-
template<typename derivedT>
inline derivedT *as(command_type const &target_type) Cast this command_context_base into the given type if the argument matches the enclosed type.
- Parameters
target_type – [in] The type we expect.
- Returns
a raw pointer to the derived type, or nullptr on mismatch.
-
template<typename derivedT>
inline derivedT const *as(command_type const &target_type) const Cast this command_context_base into the given type if the argument matches the enclosed type.
- Parameters
target_type – [in] The type we expect.
- Returns
a raw pointer to the derived type, or nullptr on mismatch.
Public Members
-
command_type const type
The context’s type is a publicly accessible member.
-
void *context = nullptr
Command contexts can also hold context state; this pointer is for that purpose.
-
inline explicit command_context_base(command_type _type)