This class is used by ALib to
Typically, every "bigger" and "higher level" ALib Module disposes about a type derived from this class. The singleton instances of these types are collected in namespace alib and are named in capital letters, for example alib::ALOX, alib::EXPRESSIONS, etc.
Types found in an ALib Module , will use methods GetResourcePool and GetConfig of that singleton to access resources and to read and write configuration data. With that, it has to be kept in mind that these objects most probably are shared with other camps. As a consequence, clear and understandable resource and variable categories and names are to be used, to avoid conflicting entries.
The ALib Programmer's Manual provides several chapters that explain how 4. Bootstrapping And Shutting Down ALib is performed with the help of this class.
Furthermore, source code sample is given with the tutorial of ALib Module CLI.
Often, types that comprise a "camp singleton" (as the derived types shown in the inheritance diagram above) incorporate some further functionality specific to the field of application that a "module" respectively "camp" covers.
#include <camp.hpp>
Public Field Index: | |
NCString | ResourceCategory |
Public Method Index: | |
Camp (Camp &&)=delete | |
Camp (const Camp &)=delete | |
Camp (const NCString &resourceCategory) | |
virtual | ~Camp () |
void | BootstrapResource (const NString &name, const String &data) |
void | BootstrapSetConfig (config::Configuration *pConfig) |
void | BootstrapSetResourcePool (lang::resources::ResourcePool *pool) |
config::Configuration & | GetConfig () |
const String & | GetResource (const NString &name) |
resources::ResourcePool & | GetResourcePool () |
bool | IsBootstrapped () |
void | operator= (Camp &&)=delete |
void | operator= (const Camp &)=delete |
const String & | TryResource (const NString &name) |
|
protected |
|
protected |
Pointer to the configuration instance used to load variable configuration data. An instance is created and assigned with the invocation of one of the Bootstrap methods. This instance is then passed to all dependent libraries (recursively) and this way shared. Dependent libraries that are to an own dedicated instance, have to be initialized explicitly prior to initializing this ALib Camp .
Access to the field is provided with method GetConfig.
|
protected |
If a configuration instance has been created when this ALib Camp was initialized, this flag evaluates to true
and the instance stored in config will be deleted with destruction of this object.
|
protected |
If a default instance of type LocalResourcePool has been created when this camp was initialized, this flag evaluates to true
and the instance stored in resourcePool will be deleted with destruction of this object.
NCString ResourceCategory |
The name of the resource category of externalized string resources defined and used by this ALib Camp .
Special camp ALib BaseCamp uses "ALIB". Other ALib Camps use a short unique name.
|
protected |
Pointer to the resource pool. An instance is created and assigned with the invocation of one of the Bootstrap methods. This instance is then passed to all dependent camps (recursively) and this way shared. Dependent libraries that are to an own dedicated instance, have to be initialized explicitly prior to initializing this ALib Camp .
|
inlinevirtual |
|
protectedpure virtual |
Abstract method which is invoked during bootstrapping by function
alib::Bootstrap(BootstrapPhases targetPhase .
for each phase , and each camp found in list Camps .
For details on bootstrapping ALib Camps , see the detailed explanations in chapter 4.Bootstrapping And Shutting Down ALib of the ALib Programmer's Manual.
phase | The initialization phase to perform. |
Implemented in ALox, Cli, Config, Expressions, Files, and BaseCamp.
Shortcut method that invokes ResourcePool::Bootstrap on field resourcePool providing field ResourceCategory as parameter.
name | The resource name. |
data | The resource data string. |
Definition at line 20 of file camp_inlines.hpp.
|
inline |
Sets the configuration object of this ALib Camp .
pConfig | The external configuration object to use. |
|
inline |
Sets the resource pool of this camp.
pool | The external resource pool to use. |
|
inline |
Shortcut method that invokes ResourcePool::Get on field resourcePool providing field ResourceCategory as parameter.
With debug builds, this method asserts that a resource was found. If this is not wanted, use TryResource.
name | The resource name. |
Definition at line 21 of file camp_inlines.hpp.
|
inline |
|
inline |
Tests if this ALib Camp was completely initialized.
true
if the initialization state is either BootstrapPhases::Final or ShutdownPhases::Announce , false
otherwise.
|
delete |
Deleted move assignment.
|
delete |
Deleted copy assignment.
|
protectedpure virtual |
Abstract method which is invoked during bootstrapping by function
alib::Shutdown(ShutdownPhases targetPhase
for each phase , and each camp found in list Camps .
For details on bootstrapping ALib Camps , see the detailed explanations in chapter 4. Bootstrapping And Shutting Down ALib of the ALib Programmer's Manual.
phase | The termination level to perform. |
Implemented in ALox, Cli, Config, Expressions, BaseCamp, and Files.
Shortcut method that invokes ResourcePool::Get on field resourcePool providing field ResourceCategory as parameter.
name | The resource name. |
Definition at line 22 of file camp_inlines.hpp.