ALib C++ Library
Library Version: 2312 R0
Documentation generated by doxygen
Public Static Fields | Public Methods | Protected Methods | List of all members
ALox Class Reference

#include <aloxmodule.hpp>

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

Class Description


This is the module class for ALox logging library residing in namespace aworx::lib::lox.

This is a strict singleton class. The only instance is found with namespace variable aworx::lib::ALOX.

Definition at line 100 of file aloxmodule.hpp.

Public Static Fields

static ALIB_API lib::config::VariableDecl CODEPAGE
 

Public Methods

 ALox ()
 
ALIB_API LoxGet (const NString &name, CreateIfNotExists create=CreateIfNotExists::No)
 
ALIB_API void Register (Lox *lox, ContainerOp operation)
 
ALIB_API void Reset ()
 
- Public Methods inherited from Module
 Module (const Module &)=delete
 
 Module (int version, int revision, const NCString &resourceCategory, uint64_t compilationFlags=0)
 
 Module (Module &&)=delete
 
virtual ~Module ()
 
ALIB_API bool Bootstrap (BootstrapPhases targetPhase=BootstrapPhases::Final, int argc=0, const char **argvN=nullptr, const wchar_t **argvW=nullptr)
 
template<typename TChar >
bool Bootstrap (int argc, TChar **argv, BootstrapPhases targetPhase=BootstrapPhases::Final)
 
void BootstrapResource (const NString &name, const String &data)
 
void BootstrapSetConfig (config::Configuration *pConfig)
 
void BootstrapSetResourcePool (resources::ResourcePool *pool)
 
config::ConfigurationGetConfig ()
 
const StringGetResource (const NString &name)
 
ResourcePoolGetResourcePool ()
 
bool IsBootstrapped ()
 
void operator= (const Module &)=delete
 
void operator= (Module &&)=delete
 
ALIB_API void Shutdown (ShutdownPhases targetPhase=ShutdownPhases::Destruct)
 
const StringTryResource (const NString &name)
 
ALIB_API bool VerifyCompilationFlags (uint64_t compilationFlags)
 

Protected Methods

virtual void bootstrap (BootstrapPhases phase, int argc, const char **argv, const wchar_t **wargv) override
 
virtual void shutdown (ShutdownPhases phase) override
 

Additional Inherited Members

- Public Types inherited from Module
enum  BootstrapPhases { PrepareResources = 1, PrepareConfig = 2, Final = 3 }
 
enum  ShutdownPhases { Announce = 1, Destruct = 2 }
 
- Public Fields inherited from Module
std::vector< std::pair< const nchar *, uint64_t > > CompilationFlagMeanings
 
const uint64_t CompilationFlags
 
NCString ResourceCategory
 
const int Revision
 
const int Version
 
- Protected Static Fields inherited from Module
static bool microModulesInitialized = false
 
- Protected Fields inherited from Module
int bootstrapState = 0
 
config::Configurationconfig = nullptr
 
bool isConfigOwner = false
 
bool isResourceOwner = false
 
resources::ResourcePoolresourcePool = nullptr
 

Constructor & Destructor Documentation

◆ ALox()

ALox ( )

Constructor.
While this is public, it must not be invoked as this is a strict singleton type. (See notes in 3.2.1 Singletons).

Definition at line 73 of file aloxmodule.cpp.

Member Function Documentation

◆ bootstrap()

void bootstrap ( BootstrapPhases  phase,
int  argc,
const char **  argv,
const wchar_t **  wargv 
)
overrideprotectedvirtual

Implementation of Module::bootstrap.

In phase Module::BootstrapPhases::Final performs:

  • Adds box-function FAppend::Appendable for type Logger.
    Parameters
    phaseThe initialization phase to perform.
    argcThe number of command line arguments. Defaults to 0.
    argvList of command line arguments if given as single byte character strings.
    wargvList of command line arguments if given as multi-byte character strings.

Implements Module.

Definition at line 174 of file aloxmodule.cpp.

Here is the call graph for this function:

◆ Get()

Lox * Get ( const NString name,
CreateIfNotExists  create = CreateIfNotExists::No 
)

Returns a Lox with the given name. A Lox is only found if it was created and registered with ALox using Register. If not found, and parameter create is true (the default), a new Lox is created, registered and returned.

Parameters
nameThe name of the Lox to search and optionally to create. Comparison is case insensitive.
createDenotes whether a Lox that was not found is created. Optional and defaults to CreateIfNotExists::No.
Returns
The Lox found, nullptr in case of failure.

Definition at line 109 of file aloxmodule.cpp.

◆ Register()

void Register ( Lox lox,
ContainerOp  operation 
)

Registers or un-registers a Lox object statically with ALox. Once registered, any code entity of the same process is enabled to retrieve the Lox using Get.
No two objects with the same name must be registered. If this is done, the latter will not be registered and not be found by Get. In debug-compilations, an ALib error report is written (by default raises 'assert') if a name is registered twice.
Note that name comparison is performed case in-sensitive.

If debug-logging is enabled (depends on optional compiler symbols) and used, the singleton of type % Lox provided for debug-logging is registered. This uses the name "Log".

Registration is not mandatory but done by default by the constructor of class Lox. Therefore, to keep a Lox private, an optional parameter is available.

Parameters
loxThe Lox to register.
operationIf ContainerOp::Remove, the given Lox is deregistered. Defaults to ContainerOp::Insert.

Definition at line 131 of file aloxmodule.cpp.

Here is the call graph for this function:

◆ Reset()

void Reset ( )

Resets this object. Concretely the following steps are performed:

  • If the debug lox singleton exists, it is deleted.
  • It is asserted that no other lox object is registered
  • The ALOX section of the configuration plugins are deleted
  • It is asserted that not more than 4 plugins are in the configuration
Attention
This method was introduced to support resetting ALox in the unit tests. In real applications, this method should NOT be used. Side effects might appear using this method and it is not tested otherwise than used in tests!

Definition at line 379 of file aloxmodule.cpp.

Here is the call graph for this function:

◆ shutdown()

void shutdown ( ShutdownPhases  phase)
overrideprotectedvirtual

Terminates this module.

Parameters
phaseThe shutdown phase to perform.

Implements Module.

Definition at line 359 of file aloxmodule.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ CODEPAGE

Attributes of corresponding Configuration variable used by class WindowsConsoleLogger.

Definition at line 120 of file aloxmodule.hpp.


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