AMSmartProperties  201
Core library
Static Public Member Functions | List of all members
AMSmartProperties::AMVariableNames Class Reference

Simple sigleton, that assign address in memory to human readable name. Function is implicitly disabled, so impact to computing power is minimal. More...

#include <AMVariableNames.h>

Collaboration diagram for AMSmartProperties::AMVariableNames:
Collaboration graph
[legend]

Static Public Member Functions

static void setEnabled (bool)
 enable or disable this function. Typically called on on initialisation. Default state is false - disabled. More...
 
static void setVariableName (const void *ptr, const char *prefix, const char *delimiter, const char *name)
 assign variable name with address. Stored string value is prefix+delimiter+name. reasin for split it into threee paramaters is avoid cocatenate string in case that varible name are disabled. More...
 
static void setVariableName (const void *ptr, std::string name, bool enabled)
 assign variable name with adsress and with force enabled parameter. This function does as same as previous (static void setVariableName(const void* ptr, const char * prefix, const char * delimiter, const char * name)), but enabled depend by parameter. So you may force add it. Usage is for examle when you constructs static object, and this class cannot by enabled by calling enable(). More...
 
static std::string getVariableName (const void *ptr)
 string with variable name and address. In case, that variable names is allowed and name was previously added to AMVariableNames, returns something as "NAME(0xADDRESS)". In other cases, such as AMVariableNames is disabled or was disabled when was called setVariableName or setVariableName was not callet with this address, returns something as "(0xADDRESS)". More...
 
static const char * getVariableNameCStr (const void *ptr)
 string with variable name and address. In case, that variable names is allowed and name was previously added to AMVariableNames, returns something as "NAME". In other cases, such as AMVariableNames is disabled or was disabled when was called setVariableName or setVariableName was not callet with this address, returns nullptr. More...
 
static bool isEnabled ()
 get info that function is enabled. More...
 

Detailed Description

Simple sigleton, that assign address in memory to human readable name. Function is implicitly disabled, so impact to computing power is minimal.

Member Function Documentation

◆ getVariableName()

static std::string AMSmartProperties::AMVariableNames::getVariableName ( const void *  ptr)
static

string with variable name and address. In case, that variable names is allowed and name was previously added to AMVariableNames, returns something as "NAME(0xADDRESS)". In other cases, such as AMVariableNames is disabled or was disabled when was called setVariableName or setVariableName was not callet with this address, returns something as "(0xADDRESS)".

Returns
varible name

◆ getVariableNameCStr()

static const char* AMSmartProperties::AMVariableNames::getVariableNameCStr ( const void *  ptr)
static

string with variable name and address. In case, that variable names is allowed and name was previously added to AMVariableNames, returns something as "NAME". In other cases, such as AMVariableNames is disabled or was disabled when was called setVariableName or setVariableName was not callet with this address, returns nullptr.

Returns
varible name or null

◆ isEnabled()

static bool AMSmartProperties::AMVariableNames::isEnabled ( )
inlinestatic

get info that function is enabled.

Returns
enabled

◆ setEnabled()

static void AMSmartProperties::AMVariableNames::setEnabled ( bool  )
static

enable or disable this function. Typically called on on initialisation. Default state is false - disabled.

Parameters
newvalue

◆ setVariableName() [1/2]

static void AMSmartProperties::AMVariableNames::setVariableName ( const void *  ptr,
const char *  prefix,
const char *  delimiter,
const char *  name 
)
static

assign variable name with address. Stored string value is prefix+delimiter+name. reasin for split it into threee paramaters is avoid cocatenate string in case that varible name are disabled.

Parameters
ptrpointer assigned to variable name
prefixfirst part of variable name
delimitersecond part of variable name
namelast part of variable name

◆ setVariableName() [2/2]

static void AMSmartProperties::AMVariableNames::setVariableName ( const void *  ptr,
std::string  name,
bool  enabled 
)
static

assign variable name with adsress and with force enabled parameter. This function does as same as previous (static void setVariableName(const void* ptr, const char * prefix, const char * delimiter, const char * name)), but enabled depend by parameter. So you may force add it. Usage is for examle when you constructs static object, and this class cannot by enabled by calling enable().

Parameters
ptrpointer assigned to variable name
nameof variable name
enabledforce enabled state

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