ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::variables::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 Variables.

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

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

Definition at line 73 of file configresourcepool.mpp.

Inheritance diagram for alib::variables::ConfigResourcePool:
[legend]
Collaboration diagram for alib::variables::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_DLL void BootstrapBulk (const nchar *category,...) override
 
ALIB_DLL const StringGet (const NString &category, const NString &name, bool dbgAssert) override
 
- Public Method Index: inherited from alib::resources::ResourcePool
virtual ~ResourcePool ()=default
 Virtual destructor.
 
void Bootstrap (const NString &category, const NString &name, const String &data)
 
virtual ALIB_DLL std::vector< std::pair< NString, integer > > DbgGetCategories ()
 
virtual ALIB_DLL std::vector< std::tuple< NString, NString, String, integer > > DbgGetList ()
 
const StringGet (const NString &category, const String &name, bool dbgAssert)
 
- Public Method Index: inherited from alib::variables::TSharedConfiguration< SharedLock >
 TSharedConfiguration ()=default
 Constructs an empty instance, hence a cleared automatic pointer.
 
 TSharedConfiguration ()=default
 Constructs an empty instance, hence a cleared automatic pointer.
 
 TSharedConfiguration (const TSharedConfiguration &)=default
 Defaulted copy-constructor.
 
 TSharedConfiguration (const TSharedConfiguration &)=default
 Defaulted copy-constructor.
 
 TSharedConfiguration (size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent=200, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
 TSharedConfiguration (size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent=200, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
 TSharedConfiguration (std::nullptr_t) noexcept
 
 TSharedConfiguration (std::nullptr_t) noexcept
 
 ~TSharedConfiguration ()
 
 ~TSharedConfiguration ()
 
void DbgCriticalSections (lang::Switch onOff)
 
void DbgCriticalSections (lang::Switch onOff)
 
TSharedConfigurationoperator= (const TSharedConfiguration &)=default
 
TSharedConfigurationoperator= (const TSharedConfiguration &)=default
 
void Reset (lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
void Reset (lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 
- Public Method Index: inherited from alib::monomem::TSharedMonoVal< T, TAllocator, TLock >
 TSharedMonoVal () noexcept
 Default Constructor. Leaves this object nulled.
 
 TSharedMonoVal (const TSharedMonoVal &other) noexcept
 
 TSharedMonoVal (size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent)
 
 TSharedMonoVal (std::nullptr_t) noexcept
 
 TSharedMonoVal (TAllocator &allocator, size_t initialBufferSizeInKB, unsigned int bufferGrowthInPercent)
 
 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
 
template<typename... TArgs>
void ConstructT (TArgs &&... args)
 
const T * Get () const noexcept
 
T * Get () noexcept
 
AllocatorTypeGetAllocator () noexcept
 
TLock & GetLock () const noexcept
 
bool IsNulled () const noexcept
 
 operator bool () const noexcept
 
bool operator!= (std::nullptr_t) const noexcept
 
const T & operator* () const noexcept
 
T & operator* () noexcept
 
const T * operator-> () const noexcept
 
T * operator-> () 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
 
template<typename... TArgs>
void Reset (TArgs &&... args)
 
const T & Self () const noexcept
 
T & Self () 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 alib::monomem::TSharedMonoVal< T, TAllocator, TLock >
using AllocatorType = TMonoAllocator<TAllocator>
 Exposes the monotonic allocator used. Equals to TMonoAllocator<TAllocator>.
 
using LockType = TLock
 Exposes the lock type specified with template parameter TLock.
 
using StoredType = T
 Exposes the stored type specified with template parameter T.
 
- Public Static Method Index: inherited from alib::monomem::TSharedMonoVal< T, TAllocator, TLock >
static constexpr size_t SizeOfAllocation ()
 
- Protected Type Index: inherited from alib::monomem::TSharedMonoVal< T, TAllocator, TLock >
using FieldMembers = std::conditional_t<std::same_as<void, TLock>, FieldMembersNoLock, FieldMembersWithLock>
 
- Protected Field Index: inherited from alib::monomem::TSharedMonoVal< T, TAllocator, TLock >
FieldMembersmembers
 

Constructor(s) / Destructor Details:

◆ ConfigResourcePool()

alib::variables::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 103 of file configresourcepool.mpp.

Here is the call graph for this function:

Method Details:

◆ BootstrapAddOrReplace()

bool alib::variables::ConfigResourcePool::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 alib::resources::ResourcePool.

Definition at line 42 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ BootstrapBulk()

void alib::variables::ConfigResourcePool::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 alib::resources::ResourcePool.

Definition at line 54 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ Get()

const String & alib::variables::ConfigResourcePool::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 error is raised if the resource was not found.
Returns
The resource string, respectively a nulled string on failure.

Implements alib::resources::ResourcePool.

Definition at line 97 of file configresourcepool.cpp.

Here is the call graph for this function:

◆ Reset()

void alib::variables::ConfigResourcePool::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 87 of file configresourcepool.mpp.

Here is the call graph for this function:

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