ALib C++ Library
Library Version: 2402 R1
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 82 of file domain.inl.

Collaboration diagram for Domain:
[legend]

Inner Type Index:

struct  LoggerData
 

Public Static Method Index:

static constexpr nchar Separator ()
 

Public Field Index:

integer CntLogCalls =0
 
bool ConfigurationAlreadyRead =false
 
std::vector< LoggerData, StdContMA< LoggerData > > Data
 
NString FullPath
 
NString Name
 
DomainParent
 
List< std::pair< PrefixLogable *, lang::Inclusion > > PrefixLogables
 
List< DomainSubDomains
 

Public Method Index:

ALIB_API Domain (Domain *parent, const NString &name)
 
ALIB_API Domain (MonoAllocator *allocator, const NString &name)
 
ALIB_API ~Domain ()
 
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)
 
Priorities 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, Priorities priority)
 
void ToString (NAString &target)
 

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 144 of file domain.inl.

◆ ConfigurationAlreadyRead

bool ConfigurationAlreadyRead =false

Flag which is set when verbosity configuration data was read.

Definition at line 147 of file domain.inl.

◆ Data

std::vector<LoggerData,StdContMA<LoggerData> > Data

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

Definition at line 132 of file domain.inl.

◆ FullPath

NString FullPath

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

Definition at line 122 of file domain.inl.

◆ Name

NString Name

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

Definition at line 119 of file domain.inl.

◆ Parent

Domain* Parent

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

Definition at line 125 of file domain.inl.

◆ PrefixLogables

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

Prefix Logables associated with this domain.

Definition at line 135 of file domain.inl.

◆ SubDomains

List<Domain> SubDomains

A list of sub domains, sorted by name.

Definition at line 128 of file domain.inl.

Constructor(s) / Destructor Details::

◆ Domain() [1/2]

Domain ( MonoAllocator * allocator,
const NString & name )

Constructor used for the root domain.

Parameters
allocatorThe monotonic allocator used allocation of permanent objects.
nameThe name of this root domains

Definition at line 40 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 61 of file domain.cpp.

Here is the call graph for this function:

◆ ~Domain()

~Domain ( )

Destroys the Log Domain object.

Definition at line 88 of file domain.cpp.

Method Details:

◆ AddLogger()

int AddLogger ( detail::Logger * logger)
inline

Adds a new entry in field Data and recursively demands the same from its sub-domains. 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 201 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 234 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 239 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 sub domains 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 97 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 sub domains 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 127 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 335 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 250 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 263 of file domain.inl.

◆ 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 275 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 288 of file domain.inl.

◆ GetPriority()

Priorities 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 324 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 186 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 314 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 348 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 sub-domains.

Parameters
loggerNoThe number of the Logger to be removed.

Definition at line 221 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 241 of file domain.cpp.

◆ Separator()

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

Definition at line 155 of file domain.inl.

◆ SetVerbosity()

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

Sets the verbosity for a logger of this domain of all its sub domains 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 220 of file domain.cpp.

◆ ToString()

void ToString ( NAString & target)

Creates a string representation of this object.

Parameters
targetThe target string.

Definition at line 248 of file domain.cpp.

Here is the call graph for this function:

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