ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
ConfigResourcePool Class Reference

Description:


This class provides an implementation of abstract interface class ResourcePool , which does externalize resources by using the mechanics provided with module ALib Configuration .

A (shared) instance of this class can be attached to each ALib Module , with customization the bootstrapping of ALib.

See also
Please consult the Programmer's Manual of module ALib BaseCamp for details on the concept of resources. Details on this specific type are given in chapter 3.4.2 Class ConfigResourcePool.

Definition at line 44 of file configresourcepool.hpp.

#include <configresourcepool.hpp>

Inheritance diagram for ConfigResourcePool:
[legend]
Collaboration diagram for ConfigResourcePool:
[legend]

Public Field Index:

config::Configuration Config
 
- Public Field Index: inherited from ThreadLock
NCString DbgOwnerFile =nullptr
 
NCString DbgOwnerFunc =nullptr
 
int DbgOwnerLine
 
uint16_t DbgRecursionWarningThreshold =10
 
integer DbgWarningAfterWaitTimeInMillis =2000L
 

Public Method Index:

ALIB_API ConfigResourcePool ()
 
ALIB_API ~ConfigResourcePool () override
 
bool BootstrapAddOrReplace (const NString &category, const NString &name, const String &data) override
 
virtual ALIB_API void BootstrapBulk (const nchar *category,...) override
 
NALIB_API const StringGet (const NString &category, const NString &name, bool dbgAssert) override
 
- Public Method Index: inherited from ResourcePool
virtual ~ResourcePool ()
 
void Bootstrap (const NString &category, const NString &name, const String &data)
 
virtual ALIB_API std::vector< std::pair< NString, integer > > DbgGetCategories ()
 
virtual ALIB_API std::vector< std::tuple< NString, NString, String, integer > > DbgGetList ()
 
const StringGet (const NString &category, const String &name, bool dbgAssert)
 
- Public Method Index: inherited from ThreadLock
ALIB_API ThreadLock (lang::Safeness safeness=lang::Safeness::Safe)
 
ALIB_API ~ThreadLock ()
 
ALIB_API void Acquire (const NCString &dbgFile, int dbgLine, const NCString &dbgFunc)
 
int CountAcquirements () const
 
ThreadGetOwner () const
 
lang::Safeness GetSafeness () const
 
bool IsOwnedByCurrentThread () const
 
ALIB_API void Release ()
 defined(ALIB_DOX)
 
ALIB_API void SetSafeness (lang::Safeness safeness)
 
bool WillRelease () const
 

Additional Inherited Members

- Public Static Method Index: inherited from ResourcePool
static ALIB_API AString DbgDump (std::vector< std::tuple< NString, NString, String, integer > > &list, const NString &catFilter=nullptr, const String &format=A_CHAR("({3:}) {1}={2!TAB20!ESC<!Q}\n"))
 

Field Details:

◆ allocator

MonoAllocator allocator
protected

Monotonic allocator used for the hash map.

Definition at line 57 of file configresourcepool.hpp.

◆ cache

detail::CachingResourceMap cache
protected

A hash map used to store resources that have been acquired. While this also improves performance, a cache is needed to assure persistence of the values.

Definition at line 62 of file configresourcepool.hpp.

◆ Config

The configuration object for custom resource data.

Definition at line 72 of file configresourcepool.hpp.

◆ variable

config::Variable variable
protected

An only locally used object. Declared as field member to be reusable.

Definition at line 65 of file configresourcepool.hpp.

Constructor(s) / Destructor Details::

◆ ConfigResourcePool()

Constructor. Creates a configuration object without one plug-in of type InMemoryPlugin with alib::config;Priorities;Priorities::DefaultValues;default priority "config;Priorities;Priorities::DefaultValues;default priority" . After construction, one or more custom plug-ins have to be added. Those may be emplaced in this object's MonoAllocator

Definition at line 25 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ ~ConfigResourcePool()

~ConfigResourcePool ( )
override

Destructor.

Definition at line 35 of file configresourcepool.cpp.

Here is the call graph for this function:

Method Details:

◆ BootstrapAddOrReplace()

bool BootstrapAddOrReplace ( const NString & category,
const NString & name,
const String & data )
overridevirtual

Implements abstract method ResourcePool::BootstrapAddOrReplace .

Parameters
categoryCategory string of the resource.
nameName string of the resource
dataThe resource string.
Returns
true if the resource did exist and was replaced, false if it was an insertion.

Implements ResourcePool.

Definition at line 42 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ BootstrapBulk()

void BootstrapBulk ( const nchar * category,
... )
overridevirtual

Implements abstract method ResourcePool::BootstrapBulk .

Parameters
categoryCategory string of the resource. For technical reasons, this has to be of type const nchar*.
...A list of pairs of const nchar* and const character* keys and data.

Implements ResourcePool.

Definition at line 58 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ Get()

const String & Get ( const NString & category,
const NString & name,
bool dbgAssert )
overridevirtual

Implements abstract method ResourcePool::Get .

Parameters
categoryCategory string of the resource.
nameName string of the resource
dbgAssertThis parameter is available only in debug mode. If true, an assertion is raised if the resource was not found.
Returns
The resource string, respectively a nulled string on failure.

Implements ResourcePool.

Definition at line 80 of file configresourcepool.cpp.

Here is the call graph for this function:

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