ALib C++ Framework
by
Library Version: 2511 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 4.2 Class ConfigResourcePool.

Definition at line 75 of file configresourcepool.mpp.

Inheritance diagram for alib::variables::ConfigResourcePool:
alib::resources::ResourcePool alib::variables::TSharedConfiguration< SharedLock > alib::monomem::TSharedMonoVal< T, TAllocator, TLock >

Public Method Index:

 ConfigResourcePool (size_t initialBufferSizeInKB=4, unsigned bufferGrowthInPercent=200)
virtual ~ConfigResourcePool () override=default
 Default Destructor.
bool BootstrapAddOrReplace (const NString &category, const NString &name, const String &data) override
virtual void BootstrapBulk (const nchar *category,...) override
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 std::vector< std::pair< NString, integer > > DbgGetCategories ()
virtual 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 (const TSharedConfiguration &)=default
 Defaulted copy-constructor.
 TSharedConfiguration (size_t initialBufferSizeInKB, unsigned bufferGrowthInPercent=200, lang::CreateDefaults createDefaults=lang::CreateDefaults::Yes)
 TSharedConfiguration (std::nullptr_t) noexcept
 ~TSharedConfiguration ()
void DbgCriticalSections (lang::Switch onOff)
TSharedConfigurationoperator= (const TSharedConfiguration &)=default
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 bufferGrowthInPercent)
 TSharedMonoVal (std::nullptr_t) noexcept
 TSharedMonoVal (TAllocator &allocator, size_t initialBufferSizeInKB, unsigned 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 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 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 105 of file configresourcepool.mpp.

Method Details:

◆ BootstrapAddOrReplace()

bool alib::variables::ConfigResourcePool::BootstrapAddOrReplace ( const NString & category,
const NString & name,
const String & data )
overridevirtual

Implements abstract method virtual bool BootstrapAddOrReplace(const NString&, const NString&, const String&) =0.

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.

◆ BootstrapBulk()

void alib::variables::ConfigResourcePool::BootstrapBulk ( const nchar * category,
... )
overridevirtual

Implements abstract method virtual void BootstrapBulk(const nchar*, ...) =0. All variables are written using 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 53 of file configresourcepool.cpp.

◆ Get()

const String & alib::variables::ConfigResourcePool::Get ( const NString & category,
const NString & name,
bool dbgAssert )
overridevirtual

Implements abstract method const String & Get(const NString&, const String&, bool) .

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

◆ 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 89 of file configresourcepool.mpp.


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