libUTL++
|
Various preprocessor macros. More...
Macros | |
#define | self (*this) |
Reference to the object the method was invoked on. | |
#define | const_self (static_cast<const std::decay<decltype(*this)>::type&>(*this)) |
Reference to the object the method was invoked on (adding const qualifier). | |
#define | const_this (&const_cast_self) |
Pointer to the object the method was invoked on (adding const qualifier). | |
#define | const_cast_self (const_cast<std::decay<decltype(*this)>::type&>(*this)) |
Reference to the object the method was invoked on (casting away const). | |
#define | const_cast_this (&const_cast_self) |
Pointer to the object the method was invoked on (casting away const). | |
#define | ASSERT(x) if (!(x)) utl::abort(__FILE__, __LINE__, "assertion failed: " #x) |
Declares a defect if x is false (or 0). | |
#define | ABORT() utl::abort(__FILE__, __LINE__) |
Immediately terminates the program. | |
#define | DIE(text) utl::die(__FILE__, __LINE__, text) |
Terminates with an error message. | |
#define | BREAKPOINT |
Expands to a no-op - sometimes useful when debugging. | |
#define | UTL_ANONYMOUS_VARIABLE(str) UTL_CONCATENATE(str, __LINE__) |
Expands to the name of an anonymous local variable. | |
#define | UTL_CONCATENATE_IMPL(a, b) a##b |
Concatenate the given arguments (which must be strings). | |
#define | UTL_CONCATENATE(a, b) UTL_CONCATENATE_IMPL(a, b) |
Concatenate the given arguments (both of which may be subject to macro expansion themselves). | |
#define | likely(x) __builtin_expect(!!(x), 1) |
Conditional hint: indicate to the compiler that condition x is very likely to be true. | |
#define | unlikely(x) __builtin_expect(!!(x), 0) |
Conditional hint: indicate to the compiler that condition x is very likely to be false. | |
#define | UTL_PRINT(x) cout << #x " = " << x << endl |
Print a value (useful when debugging) | |
#define | ASSERTD ASSERT |
Do an assertion in DEBUG mode only. | |
#define | ASSERTFNZ(x) ASSERT(x == 0) |
Evaluate x, and in DEBUG mode, assert that x is zero. | |
#define | ASSERTFNP(x) ASSERT(x != 0) |
Evaluate x, and in DEBUG mode, assert that x is non-zero. | |
#define | IFDEBUG(x) x |
Do x in DEBUG mode only. | |
#define | INLINE |
Expands to inline in RELEASE mode only. | |
#define | UTL_INSTANTIATE_TPL(className, T) |
Instantiate a template class with the given parameter. | |
#define | UTL_INSTANTIATE_TPL2(className, T1, T2) |
Instantiate a template class with two given parameters. | |
#define | UTL_INSTANTIATE_TPLxTPL2(className, TC, T1, T2) |
Instantiate a template class with a single parameter, which itself is a template class with two parameters. | |
#define | UTL_EINTR_LOOP(SyscallFn) |
Execute the given system call function until its return value is non-negative or not EINTR. More... | |
#define | UTL_MAIN(appName) |
A standard UTL++ implementation of main() . | |
#define | UTL_MAIN_RL(appName) |
A standard UTL++ implementation of main() with a check for memory leaks in DEBUG mode. | |
#define | for_each_ln(head, var_type, var_name) |
Iterate over the objects in a double-linked list. More... | |
#define | for_each_sln(head, var_type, var_name) |
Iterate over the objects in a single-linked list. More... | |
#define | for_each_end |
Terminate a forEach block. | |
#define | UTL_CLASS_NO_COMPARE |
Declare that a class cannot do compare(). | |
#define | UTL_CLASS_NO_COPY |
Declare that a class cannot do copy(). | |
#define | UTL_CLASS_NO_KEY(className) |
Declare that a class has no key. | |
#define | UTL_CLASS_NO_SERIALIZE |
Declare that a class cannot do serialize(). | |
#define | UTL_CLASS_NO_VCLONE |
Declare that a class cannot do vclone(). | |
#define | UTL_CLASS_TYPE(className) |
Typedef for a class's own type, where the class has zero or one template parameters. | |
#define | UTL_CLASS_TYPE_TPL2(className, T1, T2) |
Typedef for a class's own type, where the class has two template parameters. | |
#define | UTL_CLASS_SUPER(baseClassName) |
"super" typedef for a base class with zero or one template parameters. | |
#define | UTL_CLASS_SUPER_TPL2(baseClassName, T1, T2) |
"super" typedef for a base class with two template parameters. | |
#define | UTL_CLASS_SUPER_TPL2_TPLxTPL2(baseClassName, T, T1, T2) |
"super" typedef for a base class with one template parameter, which itself is a class with two template parameters. | |
#define | UTL_CLASS_CONSTRUCT(className) |
Default constructor - calls init(). | |
#define | UTL_CLASS_COPYCONSTRUCT(className) |
Copy constructor - calls init(), then calls vclone(rhs). | |
#define | UTL_CLASS_MOVECONSTRUCT(className) |
Copy constructor - calls init(), then calls steal(rhs). | |
#define | UTL_CLASS_DESTRUCT(className) |
Virtual destructor - calls deInit(). | |
#define | UTL_CLASS_DEFID |
Default init() and deInit() (which are merely place-holders). | |
#define | UTL_CLASS_DECL_CREATE |
Create a new instance of self's type (member function declaration). | |
#define | UTL_CLASS_DECL_CLONE |
Create a new copy of self (member function declaration). | |
#define | UTL_CLASS_EQUALS(rhsClassName) |
operator=(rhs) simply calls Object::copy(rhs). | |
#define | UTL_CLASS_EQUALS_MOVE |
operator=(rhs) for the case where rhs is a temporary. | |
#define | UTL_CLASS_POINTER |
Conversion to pointer. | |
#define | UTL_CLASS_CONSTPOINTER |
Conversion to const pointer. | |
#define | UTL_CLASS_SERIALIZE(className) |
Implement serialize() for a class. | |
#define | UTL_TYPE_NO_SERIALIZE(typeName) |
Declare that a type cannot be serialized. | |
#define | UTL_CLASS_DECL_ABC(DC, BC) |
Declaration of standard UTL++ functionality for an abstract base class (ABC). | |
#define | UTL_CLASS_DECL_CMN(DC) |
Declaration of standard UTL++ class functionality. | |
#define | UTL_CLASS_DECL(DC, BC) |
Declaration of standard UTL++ functionality for a non-template class. | |
#define | UTL_CLASS_DECL_NT_TPL2(DC, BC, T1, T2) |
Declaration of standard UTL++ functionality for a non-template class that inherits from a template class with two parameters. | |
#define | UTL_CLASS_DECL_TPL(DC, T, BC) |
Declaration of standard UTL++ functionality for a template class with one parameter. | |
#define | UTL_CLASS_DECL_TPL2(DC, T1, T2, BC) |
Declaration of standard UTL++ functionality for a template class with two parameters, where the base class has zero or one template parameters. | |
#define | UTL_CLASS_DECL_TPL2_TPL2(DC, DC_T1, DC_T2, BC, BC_T1, BC_T2) |
Declaration of standard UTL++ functionality for a template class with two parameters, where the base class also has two template parameters. | |
#define | UTL_CLASS_DECL_TPL2_TPLxTPL2(DC, DC_T1, DC_T2, BC, BC_BT, BC_T1, BC_T2) |
Declaration of standard UTL++ functionality for a template class with two parameters, where the base class has one template parameter, which itself is a class with two template parameters. | |
#define | UTL_CLASS_IMPL_CREATE_ABC(className) |
Create a new instance of self's type (implementation for abstract class). | |
#define | UTL_CLASS_IMPL_CREATE(className) |
Create a new instance of self's type (implementation for concrete class). | |
#define | UTL_CLASS_IMPL_CREATE_TPL(className, T) |
Create a new instance of self's type (implementation for template class with one parameter). | |
#define | UTL_CLASS_IMPL_CREATE_TPL2(className, T1, T2) |
Create a new instance of self's type (implementation for template class with two parameters). | |
#define | UTL_CLASS_IMPL_CLONE_ABC(className) |
Create a new copy of self (implementation for abstract class). | |
#define | UTL_CLASS_IMPL_CLONE(className) |
Create a new copy of self (implementation for concrete class). | |
#define | UTL_CLASS_IMPL_CLONE_TPL(className, T) |
Create a new copy of self (implementation for template class with one parameter). | |
#define | UTL_CLASS_IMPL_CLONE_TPL2(className, T1, T2) |
Create a new copy of self (implementation for template class with two parameters). | |
#define | UTL_CLASS_IMPL_ABC(className) |
Implementation of standard UTL++ functionality for an abstract base class (ABC). | |
#define | UTL_CLASS_IMPL(className) |
Implementation of standard UTL++ class functionality. | |
#define | UTL_CLASS_IMPL_TPL(className, T) |
Implementation of standard UTL++ functionality for a template class. | |
#define | UTL_CLASS_IMPL_TPL2(className, T1, T2) |
Implementation of standard UTL++ functionality for a template class with two parameters. | |
#define | SCOPE_EXIT auto UTL_ANONYMOUS_VARIABLE(scopeExit) = utl::ScopeExitMacroHelper() + [&]() noexcept |
Run some code when exiting the current scope (no matter what). More... | |
#define | SCOPE_FAIL auto UTL_ANONYMOUS_VARIABLE(scopeFail) = utl::ScopeFailMacroHelper() + [&]() noexcept |
Run some code when exiting the current scope due to an exception being thrown. More... | |
#define | SCOPE_SUCCESS auto UTL_ANONYMOUS_VARIABLE(scopeSuccess) = utl::ScopeSuccessMacroHelper() + [&]() noexcept |
Run some code when exiting the current scope normally (without any exception being thrown). More... | |
Various preprocessor macros.
#define UTL_EINTR_LOOP | ( | SyscallFn | ) |
Execute the given system call function until its return value is non-negative or not EINTR.
The return value of the function is stored in the variable err
in the current scope.
#define for_each_ln | ( | head, | |
var_type, | |||
var_name | |||
) |
Iterate over the objects in a double-linked list.
head | head node |
var_type | contained type (e.g. MyClass) |
var_name | name of current object (e.g. myObject) |
#define for_each_sln | ( | head, | |
var_type, | |||
var_name | |||
) |
Iterate over the objects in a single-linked list.
head | head node |
var_type | contained type (e.g. MyClass) |
var_name | name of current object (e.g. myObject) |
#define SCOPE_EXIT auto UTL_ANONYMOUS_VARIABLE(scopeExit) = utl::ScopeExitMacroHelper() + [&]() noexcept |
Run some code when exiting the current scope (no matter what).
Definition at line 22 of file ScopeGuard.h.
#define SCOPE_FAIL auto UTL_ANONYMOUS_VARIABLE(scopeFail) = utl::ScopeFailMacroHelper() + [&]() noexcept |
Run some code when exiting the current scope due to an exception being thrown.
Definition at line 38 of file ScopeGuard.h.
#define SCOPE_SUCCESS auto UTL_ANONYMOUS_VARIABLE(scopeSuccess) = utl::ScopeSuccessMacroHelper() + [&]() noexcept |
Run some code when exiting the current scope normally (without any exception being thrown).
Definition at line 54 of file ScopeGuard.h.