ALib C++ Library
Library Version: 2412 R0
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 36 of file configresourcepool.hpp.

#include <configresourcepool.hpp>

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

Public Method Index:

 ConfigResourcePool (size_t initialBufferSizeInKB=4, unsigned int bufferGrowthInPercent=200)
 
virtual ~ConfigResourcePool () override=default
 Default Destructor.
 
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 ()=default
 Virtual destructor.
 
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 TSharedConfiguration< SharedLock >
 TSharedConfiguration ()=default
 Constructs an empty instance, hence a cleared automatic pointer.
 
 TSharedConfiguration (size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent=200, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
 TSharedConfiguration (std::nullptr_t) noexcept
 
 ~TSharedConfiguration ()
 
void DbgCriticalSections (lang::Switch onOff)
 
void Reset (lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
- Public Method Index: inherited from TSharedMonoVal< Configuration, HeapAllocator, SharedLock >
 TSharedMonoVal () noexcept
 Default Constructor. Leaves this object nulled.
 
 TSharedMonoVal (const TSharedMonoVal &other) noexcept
 
 TSharedMonoVal (HeapAllocator &allocator, size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent)
 
 TSharedMonoVal (size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent)
 
 TSharedMonoVal (std::nullptr_t) noexcept
 
 TSharedMonoVal (TSharedMonoVal &&other) noexcept
 
 ~TSharedMonoVal ()
 
void Acquire (const CallerInfo &ci) const noexcept
 
void AcquireRecursive (const CallerInfo &ci) const noexcept
 
void AcquireShared (const CallerInfo &ci) const noexcept
 
void ConstructT (TArgs &&... args)
 
const ConfigurationGet () const noexcept
 
ConfigurationGet () noexcept
 
AllocatorTypeGetAllocator () noexcept
 
SharedLockGetLock () const noexcept
 
bool IsNulled () const noexcept
 
 operator bool () const noexcept
 
bool operator!= (std::nullptr_t) const noexcept
 
const Configurationoperator* () const noexcept
 
Configurationoperator* () noexcept
 
const Configurationoperator-> () const noexcept
 
Configurationoperator-> () noexcept
 
TSharedMonoValoperator= (const TSharedMonoVal &other) noexcept
 
void operator= (std::nullptr_t)
 Assignment of nullptr. Same as SetNulled.
 
TSharedMonoValoperator= (TSharedMonoVal &&other) noexcept
 
bool operator== (std::nullptr_t) const noexcept
 
void Release (const CallerInfo &ci) const noexcept
 
void ReleaseRecursive (const CallerInfo &ci) const noexcept
 
void ReleaseShared (const CallerInfo &ci) const noexcept
 
void Reset (TArgs &&... args)
 
const ConfigurationSelf () const noexcept
 
ConfigurationSelf () noexcept
 
void SetNulled () noexcept
 
bool TryAcquire (const CallerInfo &ci) const noexcept
 
bool TryAcquireShared (const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks &pointInTime, const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks::Duration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks::Duration::TDuration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireSharedTimed (const Ticks::TTimePoint &pointInTime, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks &pointInTime, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks::Duration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks::Duration::TDuration &waitDuration, const CallerInfo &ci) const noexcept
 
bool TryAcquireTimed (const Ticks::TTimePoint &pointInTime, const CallerInfo &ci) const noexcept
 
bool Unique () const noexcept
 
unsigned int UseCount () const noexcept
 

Protected Method Index:

void Reset (lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 

Additional Inherited Members

- Public Type Index: inherited from TSharedMonoVal< Configuration, HeapAllocator, SharedLock >
using AllocatorType
 Exposes the monotonic allocator used. Equals to TMonoAllocator<TAllocator>.
 
using LockType
 Exposes the lock type specified with template parameter TLock.
 
using StoredType
 Exposes the stored type specified with template parameter T.
 
- 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"))
 
- Public Static Method Index: inherited from TSharedMonoVal< Configuration, HeapAllocator, SharedLock >
static constexpr size_t SizeOfAllocation ()
 
- Protected Type Index: inherited from TSharedMonoVal< Configuration, HeapAllocator, SharedLock >
using FieldMembers
 
- Protected Field Index: inherited from TSharedMonoVal< Configuration, HeapAllocator, SharedLock >
FieldMembersmembers
 

Constructor(s) / Destructor Details:

◆ ConfigResourcePool()

ConfigResourcePool ( size_t initialBufferSizeInKB = 4,
unsigned int bufferGrowthInPercent = 200 )
inline

Constructor. Creates a configuration object without any default plug-ins. After construction, the "resource data", in this case variable values, has to be added.

Parameters
initialBufferSizeInKBThe initial size of memory buffers. Defaults to 16. Passed to the constructor parent Configuration.
bufferGrowthInPercentOptional growth factor in percent, applied to the buffer size with each next buffer allocation. Should be set to 200, to double the size with each allocation. Defaults to 200. Passed to the constructor parent Configuration.

Definition at line 66 of file configresourcepool.hpp.

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 19 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ BootstrapBulk()

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

Implements abstract method ResourcePool::BootstrapBulk. All variables are written using Priority::DefaultValues.

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 31 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 (and to be passed) 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 73 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ Reset()

void Reset ( lang::CreateDefaults createDefaults = lang::CreateDefaults::Yes)
inlineprotected

Protected definition of inherited method.

Parameters
createDefaultsDetermines if default plug-ins are to be created. Defaults to Yes.

Definition at line 50 of file configresourcepool.hpp.

Here is the call graph for this function:

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