KDSPDSetup
Small library to initialize spdlog loggers from a toml configuration file.
KDSPDSetup::details::SPDMaps Class Reference

This class contains maps that associate string names to sink pointers, format strings, and thread pool information. This enables simple access of these objects by name when constructing loggers. There are no instances of the class - it is composed entirely of static members. More...

#include <details.h>

Static Public Member Functions

static auto sinkMap () -> std::map< toml::string, spdlog::sink_ptr > const &
 Getter method for the private member KDSPDSetup::details::SPDMaps::mSinkMap. Used to index the map and obtain a sink pointer by name when constructing loggers. More...
 
static auto patternMap () -> std::map< toml::string, toml::string > const &
 Getter method for the private member KDSPDSetup::details::SPDMaps::mPatternMap. Used to index the map and obtain a format string by name, to pass into spdlog::set_pattern when constructing sinks or loggers. More...
 
static auto threadPoolMap () -> std::map< toml::string, std::pair< std::size_t, std::size_t >> const &
 Getter method for the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. Used to index the map by thread pool name when constructing asynchronous loggers, to obtain a pair containing queue size and thread count. More...
 
static void emplaceSinkMap (std::pair< toml::string, spdlog::sink_ptr > &&_pr)
 Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called after a sink pointer is created in KDSPDSetup::setup::setupSink, to make it accessible by name when constructing loggers that will use it. More...
 
static void emplacePatternMap (std::pair< toml::string, toml::string > &&_pr)
 Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called by KDSPDSetup::setup::setupPatterns when reading a pattern table from a configuration file. The pattern string is associated with its name so it can be accessed by name when constructing sinks or loggers that will use the string to format messages. More...
 
static void emplaceThreadPoolMap (std::pair< toml::string, std::pair< std::size_t, std::size_t >> &&_pr)
 Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. This function is called by KDSPDSetup::setup::setupThreadPools when reading a thread_pool table from a configuration file. The thread pool's name is associated with its corresponding queue size and thread count, so they can be used later to construct asynchronous loggers. More...
 

Static Private Attributes

static std::map< toml::string, spdlog::sink_ptr > mSinkMap {}
 Map that associates string names to sink pointers. When sink pointers are created from sink tables in a configuration file, they are added here. Then they can be specified by name and looked up from the map when constructing loggers. More...
 
static std::map< toml::string, toml::string > mPatternMap {}
 Map that associates string names to pattern strings. When pattern tables are read from a configuration file, they are added here. Then they can be specified by name and looked up from the map when constructing loggers and sinks. More...
 
static std::map< toml::string, std::pair< std::size_t, std::size_t > > mThreadPoolMap {}
 Map that associates string names to pairs of thread pool fields. The pairs represent the queue size and thread count of the thread pool, respectively. When thread_pool tables are read from a configuration file, their associated fields are added here. Then they can be specified by name, and their corresponding queue size and thread count can be looked up from the map when constructing asynchronous loggers. More...
 

Detailed Description

This class contains maps that associate string names to sink pointers, format strings, and thread pool information. This enables simple access of these objects by name when constructing loggers. There are no instances of the class - it is composed entirely of static members.

Definition at line 129 of file details.h.

Member Function Documentation

◆ emplacePatternMap()

void KDSPDSetup::details::SPDMaps::emplacePatternMap ( std::pair< toml::string, toml::string > &&  _pr)
static

Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called by KDSPDSetup::setup::setupPatterns when reading a pattern table from a configuration file. The pattern string is associated with its name so it can be accessed by name when constructing sinks or loggers that will use the string to format messages.

Parameters
_prAn rvalue reference pair containing name and pattern string, to be emplaced in KDSPDSetup::details::SPDMaps::mPatternMap.

Definition at line 30 of file details.cpp.

31 {
32  mPatternMap.emplace(_pr);
33 }
static std::map< toml::string, toml::string > mPatternMap
Map that associates string names to pattern strings. When pattern tables are read from a configuratio...
Definition: details.h:209
Here is the caller graph for this function:

◆ emplaceSinkMap()

void KDSPDSetup::details::SPDMaps::emplaceSinkMap ( std::pair< toml::string, spdlog::sink_ptr > &&  _pr)
static

Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mSinkMap. This function is called after a sink pointer is created in KDSPDSetup::setup::setupSink, to make it accessible by name when constructing loggers that will use it.

Parameters
_prAn rvalue reference pair containing name and a sink pointer, to be emplaced in KDSPDSetup::details::SPDMaps::mSinkMap.

Definition at line 26 of file details.cpp.

27 {
28  mSinkMap.emplace(_pr);
29 }
static std::map< toml::string, spdlog::sink_ptr > mSinkMap
Map that associates string names to sink pointers. When sink pointers are created from sink tables in...
Definition: details.h:201
Here is the caller graph for this function:

◆ emplaceThreadPoolMap()

void KDSPDSetup::details::SPDMaps::emplaceThreadPoolMap ( std::pair< toml::string, std::pair< std::size_t, std::size_t >> &&  _pr)
static

Emplace a pair in the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. This function is called by KDSPDSetup::setup::setupThreadPools when reading a thread_pool table from a configuration file. The thread pool's name is associated with its corresponding queue size and thread count, so they can be used later to construct asynchronous loggers.

Parameters
_prAn rvalue reference pair containing name and a nested pair containing a queue size and thread count, to be emplaced in KDSPDSetup::details::SPDMaps::mThreadPoolMap.

Definition at line 34 of file details.cpp.

35 {
36  mThreadPoolMap.emplace(_pr);
37 }
static std::map< toml::string, std::pair< std::size_t, std::size_t > > mThreadPoolMap
Map that associates string names to pairs of thread pool fields. The pairs represent the queue size a...
Definition: details.h:219
Here is the caller graph for this function:

◆ patternMap()

auto KDSPDSetup::details::SPDMaps::patternMap ( ) -> std::map<toml::string, toml::string> const &
static

Getter method for the private member KDSPDSetup::details::SPDMaps::mPatternMap. Used to index the map and obtain a format string by name, to pass into spdlog::set_pattern when constructing sinks or loggers.

Returns
std::map<toml::string, toml::string> const& A const reference to the private data member KDSPDSetup::details::SPDMaps::mPatternMap.

Definition at line 18 of file details.cpp.

19 {
20  return mPatternMap;
21 }
Here is the caller graph for this function:

◆ sinkMap()

auto KDSPDSetup::details::SPDMaps::sinkMap ( ) -> std::map<toml::string, spdlog::sink_ptr> const &
static

Getter method for the private member KDSPDSetup::details::SPDMaps::mSinkMap. Used to index the map and obtain a sink pointer by name when constructing loggers.

Returns
std::map<toml::string, spdlog::sink_ptr> const& A const reference to the private data member KDSPDSetup::details::SPDMaps::mSinkMap.

Definition at line 14 of file details.cpp.

15 {
16  return mSinkMap;
17 }
Here is the caller graph for this function:

◆ threadPoolMap()

auto KDSPDSetup::details::SPDMaps::threadPoolMap ( ) -> std::map<toml::string, std::pair<std::size_t, std::size_t>> const &
static

Getter method for the private member KDSPDSetup::details::SPDMaps::mThreadPoolMap. Used to index the map by thread pool name when constructing asynchronous loggers, to obtain a pair containing queue size and thread count.

Returns
std::map<toml::string, std::pair<std::size_t, std::size_t>> const& A const reference to the private data member KDSPDSetup::details::SPDMaps::mThreadPoolMap.

Definition at line 22 of file details.cpp.

23 {
24  return mThreadPoolMap;
25 }
Here is the caller graph for this function:

Member Data Documentation

◆ mPatternMap

std::map<toml::string, toml::string> KDSPDSetup::details::SPDMaps::mPatternMap {}
inlinestaticprivate

Map that associates string names to pattern strings. When pattern tables are read from a configuration file, they are added here. Then they can be specified by name and looked up from the map when constructing loggers and sinks.

Definition at line 209 of file details.h.

◆ mSinkMap

std::map<toml::string, spdlog::sink_ptr> KDSPDSetup::details::SPDMaps::mSinkMap {}
inlinestaticprivate

Map that associates string names to sink pointers. When sink pointers are created from sink tables in a configuration file, they are added here. Then they can be specified by name and looked up from the map when constructing loggers.

Definition at line 201 of file details.h.

◆ mThreadPoolMap

std::map<toml::string, std::pair<std::size_t, std::size_t> > KDSPDSetup::details::SPDMaps::mThreadPoolMap {}
inlinestaticprivate

Map that associates string names to pairs of thread pool fields. The pairs represent the queue size and thread count of the thread pool, respectively. When thread_pool tables are read from a configuration file, their associated fields are added here. Then they can be specified by name, and their corresponding queue size and thread count can be looked up from the map when constructing asynchronous loggers.

Definition at line 219 of file details.h.


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