header_utils
Loading...
Searching...
No Matches
ghassanpl::default_symbol_provider_t< TAG > Struct Template Reference

The default symbol provider usable for most symbol implementations. More...

#include <symbol.h>

Public Types

using internal_value_type
using hash_type

Public Member Functions

void clear () noexcept
size_t size () const noexcept
size_t count () const noexcept
auto const & values () const noexcept
auto empty_string () const noexcept

Static Public Member Functions

static default_symbol_provider_t & instance () noexcept
static internal_value_type empty_value () noexcept
static internal_value_type insert (std::string_view val)
static std::string_view string_for (internal_value_type val) noexcept
static hash_type hash_for (internal_value_type val) noexcept
static std::strong_ordering compare (internal_value_type a, internal_value_type b) noexcept

Protected Member Functions

 default_symbol_provider_t (default_symbol_provider_t const &)=delete
default_symbol_provider_t & operator= (default_symbol_provider_t const &)=delete

Protected Attributes

std::set< std::string, std::less<> > m_values
std::string const * m_empty_string

Detailed Description

template<typename TAG = void>
struct ghassanpl::default_symbol_provider_t< TAG >

The default symbol provider usable for most symbol implementations.

NOT THREAD SAFE. Uses a TAG type parameter if you want to create different "namespaces" of symbols.

This class can be easily made thread-safe, just wrap all operations that touch m_values in a mutex (specifically insert and clear).

Definition at line 122 of file symbol.h.

Member Typedef Documentation

◆ hash_type

template<typename TAG = void>
using ghassanpl::default_symbol_provider_t< TAG >::hash_type

Definition at line 131 of file symbol.h.

◆ internal_value_type

template<typename TAG = void>
using ghassanpl::default_symbol_provider_t< TAG >::internal_value_type

Definition at line 130 of file symbol.h.

Member Function Documentation

◆ clear()

template<typename TAG = void>
void ghassanpl::default_symbol_provider_t< TAG >::clear ( )
inlinenoexcept

Definition at line 153 of file symbol.h.

◆ compare()

template<typename TAG = void>
std::strong_ordering ghassanpl::default_symbol_provider_t< TAG >::compare ( internal_value_type a,
internal_value_type b )
inlinestaticnodiscardnoexcept

Definition at line 147 of file symbol.h.

◆ count()

template<typename TAG = void>
size_t ghassanpl::default_symbol_provider_t< TAG >::count ( ) const
inlinenodiscardnoexcept

Definition at line 162 of file symbol.h.

◆ empty_string()

template<typename TAG = void>
auto ghassanpl::default_symbol_provider_t< TAG >::empty_string ( ) const
inlinenodiscardnoexcept

Definition at line 165 of file symbol.h.

◆ empty_value()

template<typename TAG = void>
internal_value_type ghassanpl::default_symbol_provider_t< TAG >::empty_value ( )
inlinestaticnodiscardnoexcept

Definition at line 132 of file symbol.h.

◆ hash_for()

template<typename TAG = void>
hash_type ghassanpl::default_symbol_provider_t< TAG >::hash_for ( internal_value_type val)
inlinestaticnodiscardnoexcept

Definition at line 145 of file symbol.h.

◆ insert()

template<typename TAG = void>
internal_value_type ghassanpl::default_symbol_provider_t< TAG >::insert ( std::string_view val)
inlinestaticnodiscard

Definition at line 133 of file symbol.h.

◆ instance()

template<typename TAG = void>
default_symbol_provider_t & ghassanpl::default_symbol_provider_t< TAG >::instance ( )
inlinestaticnoexcept

Definition at line 124 of file symbol.h.

◆ size()

template<typename TAG = void>
size_t ghassanpl::default_symbol_provider_t< TAG >::size ( ) const
inlinenodiscardnoexcept

Definition at line 161 of file symbol.h.

◆ string_for()

template<typename TAG = void>
std::string_view ghassanpl::default_symbol_provider_t< TAG >::string_for ( internal_value_type val)
inlinestaticnodiscardnoexcept

Definition at line 144 of file symbol.h.

◆ values()

template<typename TAG = void>
auto const & ghassanpl::default_symbol_provider_t< TAG >::values ( ) const
inlinenodiscardnoexcept

Definition at line 164 of file symbol.h.

Member Data Documentation

◆ m_empty_string

template<typename TAG = void>
std::string const* ghassanpl::default_symbol_provider_t< TAG >::m_empty_string
protected

Definition at line 170 of file symbol.h.

◆ m_values

template<typename TAG = void>
std::set<std::string, std::less<> > ghassanpl::default_symbol_provider_t< TAG >::m_values
protected

Definition at line 169 of file symbol.h.