LLFIO v2.00
Loading...
Searching...
No Matches
llfio_v2_xxx::storage_profile::item_erased Struct Reference

A type erased tag-value item. More...

#include "storage_profile.hpp"

Inheritance diagram for llfio_v2_xxx::storage_profile::item_erased:
llfio_v2_xxx::storage_profile::item_base

Public Types

using handle_type = item_base::handle_type
 

Public Member Functions

 item_erased (const item_erased &)=delete
 
 item_erased (item_erased &&)=delete
 
item_erasedoperator= (const item_erased &)=delete
 
item_erasedoperator= (item_erased &&)=delete
 
template<class U >
auto invoke (U &&f) const
 Call the callable with the unerased type.
 
outcome< void > operator() (storage_profile &sp, handle_type &h) const
 Set this item if its value is default.
 

Public Attributes

char _padding [item_size - sizeof(item_base)]
 
const char * name
 The name of the item in colon delimited category format.
 
const char * description
 Some description of the item.
 
storage_types type
 The type of the value.
 

Static Public Attributes

static constexpr size_t item_size = item_base::item_size
 

Detailed Description

A type erased tag-value item.

Member Function Documentation

◆ invoke()

template<class U >
auto llfio_v2_xxx::storage_profile::item_erased::invoke ( U &&  f) const
inline

Call the callable with the unerased type.

147 {
148 switch(type)
149 {
150 case storage_types::extent_type:
151 return f(*reinterpret_cast<const item<byte_io_handle::extent_type> *>(static_cast<const item_base *>(this)));
152 case storage_types::unsigned_int:
153 return f(*reinterpret_cast<const item<unsigned int> *>(static_cast<const item_base *>(this)));
154 case storage_types::unsigned_long_long:
155 return f(*reinterpret_cast<const item<unsigned long long> *>(static_cast<const item_base *>(this)));
156 case storage_types::float_:
157 return f(*reinterpret_cast<const item<float> *>(static_cast<const item_base *>(this)));
158 case storage_types::string:
159 return f(*reinterpret_cast<const item<std::string> *>(static_cast<const item_base *>(this)));
160 case storage_types::unknown:
161 break;
162 }
163 LLFIO_EXCEPTION_THROW(std::invalid_argument("No type set in item")); // NOLINT
164 }
storage_types type
The type of the value.
Definition storage_profile.hpp:93

◆ operator()()

outcome< void > llfio_v2_xxx::storage_profile::item_erased::operator() ( storage_profile sp,
handle_type h 
) const
inline

Set this item if its value is default.

167 {
168 return invoke([&sp, &h](auto &item) { return item(sp, h); });
169 }
auto invoke(U &&f) const
Call the callable with the unerased type.
Definition storage_profile.hpp:146

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