ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
Domain Class Reference

Description:

Objects of this class represent a Log Domain of ALox. This class is internally used by class Lox.

Definition at line 63 of file domain.inl.

Collaboration diagram for Domain:
[legend]

Inner Type Index:

struct  LoggerData
 Internal class that holds data stored per Logger. More...
 

Public Static Method Index:

static constexpr nchar Separator ()
 

Public Field Index:

integer CntLogCalls =0
 
bool ConfigurationAlreadyRead =false
 Flag which is set when verbosity configuration data was read.
 
StdVectorMono< LoggerDataData
 
NString FullPath
 The full path of the domain (set in the constructor once) .
 
NString Name
 The name of the domain. For root domains, this is nulled.
 
DomainParent
 The parent domain. For root domains, this is nullptr.
 
List< PoolAllocator, std::pair< PrefixLogable *, lang::Inclusion >, Recycling::None > PrefixLogables
 Prefix Logables associated with this domain.
 
List< MonoAllocator, Domain, Recycling::None > SubDomains
 A list of subdomains, sorted by name.
 

Public Method Index:

ALIB_API Domain (Domain *parent, const NString &name)
 
ALIB_API Domain (MonoAllocator &allocator, PoolAllocator &pool, const NString &name)
 
int AddLogger (detail::Logger *logger)
 
int CountLoggers ()
 
ALIB_API DomainFind (NSubstring domainPath, int maxCreate, bool *wasCreated)
 
int GetCount (int loggerNo)
 
detail::LoggerGetLogger (const NString &loggerName)
 
detail::LoggerGetLogger (int no)
 
int GetLoggerNo (const NString &loggerName)
 
int GetLoggerNo (detail::Logger *logger)
 
Priority GetPriority (int loggerNo)
 
DomainGetRoot ()
 
Verbosity GetVerbosity (int loggerNo)
 
bool IsActive (int loggerNo, Verbosity statement)
 
void RemoveLogger (int loggerNo)
 
ALIB_API Verbosity SetVerbosity (int loggerNo, Verbosity verbosity, Priority priority)
 
void ToString (NAString &target)
 

Protected Method Index:

ALIB_API void addLoggerRecursive (detail::Logger *logger)
 
DomainfindRecursive (NSubstring &domainPath, int maxCreate, bool *wasCreated)
 
ALIB_API void removeLoggerRecursive (int loggerNo)
 

Field Details:

◆ CntLogCalls

integer CntLogCalls =0

A counter for the quantity of calls on this domain. Counting does not include:

  • logs when no Logger was set
  • conditional logs that were suppressed Otherwise, it includes all log calls, even when no Logger was enabled on this domain.

Definition at line 124 of file domain.inl.

◆ ConfigurationAlreadyRead

bool ConfigurationAlreadyRead =false

Flag which is set when verbosity configuration data was read.

Definition at line 127 of file domain.inl.

◆ Data

Data stored per logger. The index is corresponding to the list of loggers in 'our' Lox.

Definition at line 111 of file domain.inl.

◆ FullPath

NString FullPath

The full path of the domain (set in the constructor once) .

Definition at line 100 of file domain.inl.

◆ Name

NString Name

The name of the domain. For root domains, this is nulled.

Definition at line 97 of file domain.inl.

◆ Parent

Domain* Parent

The parent domain. For root domains, this is nullptr.

Definition at line 103 of file domain.inl.

◆ PrefixLogables

List< PoolAllocator, std::pair<PrefixLogable*, lang::Inclusion>, Recycling::None> PrefixLogables

Prefix Logables associated with this domain.

Definition at line 117 of file domain.inl.

◆ SubDomains

List< MonoAllocator, Domain, Recycling::None> SubDomains

A list of subdomains, sorted by name.

Definition at line 107 of file domain.inl.

Constructor(s) / Destructor Details:

◆ Domain() [1/2]

Domain ( MonoAllocator & allocator,
PoolAllocator & pool,
const NString & name )

Constructor used for the root domain.

Parameters
allocatorThe monotonic allocator used allocation of permanent objects.
poolThe pool allocator used allocation of non-permanent objects.
nameThe name of this root domains

Definition at line 28 of file domain.cpp.

Here is the call graph for this function:

◆ Domain() [2/2]

Domain ( Domain * parent,
const NString & name )

Constructor

Parameters
parentThe parent domain. For root domains, this is nullptr.
nameThe name of the domain.

Definition at line 47 of file domain.cpp.

Here is the call graph for this function:

Method Details:

◆ AddLogger()

int AddLogger ( detail::Logger * logger)
inline

Adds a new entry in field Data and recursively demands the same from its Subdomains. Checks if a logger with the same name exists.

Parameters
loggerThe logger to add.
Returns
The number of the Logger, -1 if a logger with the same name exists already.

Definition at line 176 of file domain.inl.

Here is the call graph for this function:

◆ addLoggerRecursive()

void addLoggerRecursive ( detail::Logger * logger)
protected

Internal, recursive helper of AddLogger.

Parameters
loggerThe logger to add.

Definition at line 212 of file domain.cpp.

◆ CountLoggers()

int CountLoggers ( )
inline

Returns the number of loggers stored in this domain (the same for all domains within a tree).

Returns
The number of loggers attached.

Definition at line 214 of file domain.inl.

◆ Find()

Domain * Find ( NSubstring domainPath,
int maxCreate,
bool * wasCreated )

Searches a domain. If not found, the domain is (or path of domains are) created in the domain tree. If the path string starts with the character defined with Separator, then the search (and creation) is done starting from the root domain of this domain and not from this domain.

Parameters
domainPathPath and domain to search.
maxCreateThe maximum number of subdomains that are created if not found at the end of the path.
[out]wasCreatedOutput parameter that is set true if domain was not found and hence created. If nullptr, it is ignored.
Returns
The domain found or created.

Definition at line 75 of file domain.cpp.

Here is the call graph for this function:

◆ findRecursive()

Domain * findRecursive ( NSubstring & domainPath,
int maxCreate,
bool * wasCreated )
protected

Internal, recursive helper of Find.

Parameters
domainPathPath to search.
maxCreateThe maximum number of subdomains that are created if not found at the end of the path.
[out]wasCreatedOutput parameter that is set true if domain was not found and hence created. If nullptr, it is ignored.
Returns
The domain found or created.

Definition at line 105 of file domain.cpp.

Here is the call graph for this function:

◆ GetCount()

int GetCount ( int loggerNo)
inline

Returns the number of log calls for this domain and logger.

Parameters
loggerNoThe number of the Logger whose Verbosity is requested.
Returns
The number of calls executed by this logger on this domain.

Definition at line 310 of file domain.inl.

◆ GetLogger() [1/2]

detail::Logger * GetLogger ( const NString & loggerName)
inline

Searches and returns the Logger given by name.

Parameters
loggerNameThe logger to search.
Returns
The Logger found corresponding to given name. If the Logger does not exist, nullptr is returned.

Definition at line 225 of file domain.inl.

Here is the call graph for this function:

◆ GetLogger() [2/2]

detail::Logger * GetLogger ( int no)
inline

Returns logger of given number.

Parameters
noThe number of the Logger to return.
Returns
The Logger found with number no.

Definition at line 238 of file domain.inl.

Here is the call graph for this function:

◆ GetLoggerNo() [1/2]

int GetLoggerNo ( const NString & loggerName)
inline

Returns the number of the Logger specified by name.

Parameters
loggerNameThe logger name to search.
Returns
The number of the Logger found corresponding to given name. If the Logger does not exist, -1 is returned.

Definition at line 250 of file domain.inl.

Here is the call graph for this function:

◆ GetLoggerNo() [2/2]

int GetLoggerNo ( detail::Logger * logger)
inline

Returns the number of the Logger.

Parameters
loggerThe logger to search.
Returns
The number of the Logger. If the Logger does not exist, -1 is returned.

Definition at line 263 of file domain.inl.

◆ GetPriority()

Priority GetPriority ( int loggerNo)
inline

Returns the priority of the Verbosity setting for the given logger number.

Parameters
loggerNoThe number of the Logger whose Verbosity is requested.
Returns
The priority.

Definition at line 299 of file domain.inl.

◆ GetRoot()

Domain * GetRoot ( )
inline

Returns the root domain of this object.

Returns
The root domain of this object

Definition at line 161 of file domain.inl.

◆ GetVerbosity()

Verbosity GetVerbosity ( int loggerNo)
inline

Returns the Log Domain's Verbosity for the given logger number.

Parameters
loggerNoThe number of the Logger whose Verbosity is requested.
Returns
The found/defined domain Verbosity.

Definition at line 289 of file domain.inl.

◆ IsActive()

bool IsActive ( int loggerNo,
Verbosity statement )
inline

Determines if the domain is active in respect to the given Verbosity.

Parameters
loggerNoThe number of the Logger whose Verbosity is to be evaluated against statement.
statementThe Verbosity to check.
Returns
true if domain is active (log should be performed)

Definition at line 323 of file domain.inl.

Here is the call graph for this function:

◆ RemoveLogger()

void RemoveLogger ( int loggerNo)
inline

Removes an new entry in field Data and recursively demands the same from its Subdomains.

Parameters
loggerNoThe number of the Logger to be removed.

Definition at line 196 of file domain.inl.

Here is the call graph for this function:

◆ removeLoggerRecursive()

void removeLoggerRecursive ( int loggerNo)
protected

Internal, recursive helper of RemoveLogger.

Parameters
loggerNoThe number of the Logger to be removed.

Definition at line 219 of file domain.cpp.

◆ Separator()

static constexpr nchar Separator ( )
inlinestaticconstexpr
Returns
Returns the domain path separation character.

Definition at line 135 of file domain.inl.

◆ SetVerbosity()

Verbosity SetVerbosity ( int loggerNo,
Verbosity verbosity,
Priority priority )

Sets the verbosity for a logger of this domain of all its subdomains to the specified value. If given priority is lower than those actually stored, nothing is set and recursion is stopped.

Parameters
loggerNoThe number of the Logger to set the Verbosity for.
verbosityThe verbosity value to set.
priorityThe priority of the setting.
Returns
The new Verbosity.

Definition at line 198 of file domain.cpp.

◆ ToString()

void ToString ( NAString & target)

Creates a string representation of this object.

Parameters
targetThe target string.

Definition at line 226 of file domain.cpp.

Here is the call graph for this function:

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