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.
Definition at line 44 of file configresourcepool.hpp.
#include <configresourcepool.hpp>
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 String & | Get (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 String & | Get (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 |
Thread * | GetOwner () 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")) |
|
protected |
Monotonic allocator used for the hash map.
Definition at line 57 of file configresourcepool.hpp.
|
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::Configuration Config |
The configuration object for custom resource data.
Definition at line 72 of file configresourcepool.hpp.
|
protected |
An only locally used object. Declared as field member to be reusable.
Definition at line 65 of file configresourcepool.hpp.
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.
|
override |
Destructor.
Definition at line 35 of file configresourcepool.cpp.
|
overridevirtual |
Implements abstract method ResourcePool::BootstrapAddOrReplace .
category | Category string of the resource. |
name | Name string of the resource |
data | The resource string. |
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.
|
overridevirtual |
Implements abstract method ResourcePool::BootstrapBulk .
category | Category 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.
|
overridevirtual |
Implements abstract method ResourcePool::Get .
category | Category string of the resource. |
name | Name string of the resource |
dbgAssert | This parameter is available only in debug mode. If true , an assertion is raised if the resource was not found. |
Implements ResourcePool.
Definition at line 80 of file configresourcepool.cpp.