commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
Loading...
Searching...
No Matches
comms::OriginKind< Kind, Derived > Class Template Reference

CRTP base wiring kind(), clone(), and info() from a compile-time kind string and the concrete Derived type. More...

#include <origin.hpp>

Inheritance diagram for comms::OriginKind< Kind, Derived >:
Collaboration diagram for comms::OriginKind< Kind, Derived >:

Public Member Functions

std::string_view kind () const noexcept override
 The stable discriminator for this origin (e.g. "core").
 
std::unique_ptr< IOriginclone () const override
 A deep, independent copy.
 
const DisplayInfoinfo () const override
 Presentation metadata for this origin's kind (the description), sourced from the concrete type's static display_info().
 

Static Public Attributes

static constexpr std::string_view KIND = Kind.view()
 Compile-time discriminator.
 

Detailed Description

template<FixedString Kind, typename Derived>
class comms::OriginKind< Kind, Derived >

CRTP base wiring kind(), clone(), and info() from a compile-time kind string and the concrete Derived type.

Use it as class CoreOrigin final : public OriginKind<"core", CoreOrigin> { ... };. Derived must be copy-constructible (for clone()) and expose a static const DisplayInfo& display_info() (for info()).


The documentation for this class was generated from the following file: