Skip to content

File internal.hh

FileList > ase > internal.hh

Namespaces

Type Name
namespace Ase
The Anklang C++ API namespace.
namespace Test
Helper namespace for unit testing.

Classes

Type Name
struct IntegrityCheck

Macros

Type Name
define ALIGNED16 (pointer) ASE_ALIGNED16 (pointer)
Check if a pointer address is 16-Byte aligned.
define ALIGNMENT16 (pointer) ASE_ALIGNMENT16 (pointer)
Yield 16-Byte alignment of a pointer address.
define APPLY_IDL_PROPERTY (lvalue, rvalue) ASE_OBJECT_APPLY_IDL_PROPERTY(lvalue, rvalue)
Constrain, apply, notify and implement a property change, the property name must equal __func__ .
define ARRAY_SIZE (array) ASE_ARRAY_SIZE (array)
Yield the number of C array elements.
define CLAMP (v, mi, ma) ((v) < (mi) ? (mi) : ((v) > (ma) ? (ma) : (v)))
Yield v clamped to[mi … ma] .
define CQUOTE (str) ASE_CQUOTE(str)
Produce a const char* string, wrapping str into C-style double quotes.
define ISLIKELY (cond) ASE_ISLIKELY (cond)
Hint to the compiler to optimize for cond == TRUE.
define JSONIPC_INHERIT (IMPL, INTERFACE)
Register IMPL with Jsonipc and indicate it inherits fromINTERFACE .
define MAX (a, b) ((a) >= (b) ? (a) : (b))
Yield maximum of a andb .
define MIN (a, b) ((a) <= (b) ? (a) : (b))
Yield minimum of a andb .
define N_ (str) (str)
Mark a string for translation, passed through verbatim by the preprocessor.
define STRING_VECTOR_FROM_ARRAY (ConstCharArray) ASE_STRING_VECTOR_FROM_ARRAY(ConstCharArray)
Create a Ase::StringVector, from a const char* C-style array.
define TEST_BENCHMARK (FUNC)
Register func as a benchmark test.
define TEST_INTEGRITY (FUNC)
Register func as an integrity test.
define UNLIKELY (cond) ASE_UNLIKELY (cond)
Hint to the compiler to optimize for cond == FALSE.
define _ (...) ::Ase::ase_gettext (__VA_ARGS__)
Retrieve the translation of a C or C++ string.
define assert_paranoid (expr) do { if (expr) [[likely]] break; ::Ase::assertion_failed (#expr); } while (0)
Issue an assertion warning if expr evaluates to false, check might be disabled in production.
define assert_return (expr, ...) do { if (expr) [[likely]] break; ::Ase::assertion_failed (#expr); return __VA_ARGS__; } while (0)
Return from the current function if expr is unmet and issue an assertion warning.
define assert_return_unreached (...) do { ::Ase::assertion_failed (""); return __VA_ARGS__; } while (0)
Return from the current function and issue an assertion warning.
define assert_unreached () __builtin_unreachable()
Explicitely mark unreachable code locations.
define assert_warn (expr) do { if (expr) [[likely]] break; ::Ase::assertion_failed (#expr); } while (0)
Issue an assertion warning if expr evaluates to false.
define if_constexpr if constexpr
Indentation helper for editors that cannot (yet) decipher if constexpr __
define return_unless (cond, ...) ASE_RETURN_UNLESS (cond, __VA_ARGS__)
Return silently if cond does not evaluate to true with return value___ ..._

Macro Definition Documentation

define ALIGNED16

#define ALIGNED16 (
    pointer
) ASE_ALIGNED16 (pointer)

define ALIGNMENT16

#define ALIGNMENT16 (
    pointer
) ASE_ALIGNMENT16 (pointer)

define APPLY_IDL_PROPERTY

#define APPLY_IDL_PROPERTY (
    lvalue,
    rvalue
) ASE_OBJECT_APPLY_IDL_PROPERTY(lvalue, rvalue)

define ARRAY_SIZE

#define ARRAY_SIZE (
    array
) ASE_ARRAY_SIZE (array)

define CLAMP

#define CLAMP (
    v,
    mi,
    ma
) ((v) < (mi) ? (mi) : ((v) > (ma) ? (ma) : (v)))

define CQUOTE

#define CQUOTE (
    str
) ASE_CQUOTE(str)

define ISLIKELY

#define ISLIKELY (
    cond
) ASE_ISLIKELY (cond)

define JSONIPC_INHERIT

#define JSONIPC_INHERIT (
    IMPL,
    INTERFACE
) [[maybe_unused]] static bool ASE_CPP_PASTE2 (ase_inherit__, __COUNTER__) =   \
    ( Jsonipc::Class< IMPL >().inherit< INTERFACE >() , 0 )

define MAX

#define MAX (
    a,
    b
) ((a) >= (b) ? (a) : (b))

define MIN

#define MIN (
    a,
    b
) ((a) <= (b) ? (a) : (b))

define N_

#define N_ (
    str
) (str)

define STRING_VECTOR_FROM_ARRAY

#define STRING_VECTOR_FROM_ARRAY (
    ConstCharArray
) ASE_STRING_VECTOR_FROM_ARRAY(ConstCharArray)

define TEST_BENCHMARK

#define TEST_BENCHMARK (
    FUNC
) static void FUNC() __attribute__ ((__cold__, __unused__)); \
  static ::Ase::Test::IntegrityCheck ASE_CPP_PASTE2 (__Ase__Test__IntegrityCheck__line, __LINE__) { #FUNC, FUNC, 'B' }

define TEST_INTEGRITY

#define TEST_INTEGRITY (
    FUNC
) static void FUNC() __attribute__ ((__cold__, __unused__)); \
  static ::Ase::Test::IntegrityCheck ASE_CPP_PASTE2 (__Ase__Test__IntegrityCheck__line, __LINE__) { #FUNC, FUNC, 'I' }

define UNLIKELY

#define UNLIKELY (
    cond
) ASE_UNLIKELY (cond)

define _

#define _ (
    ...
) ::Ase::ase_gettext (__VA_ARGS__)

define assert_paranoid

#define assert_paranoid (
    expr
) do { if (expr) [[likely]] break; ::Ase::assertion_failed (#expr); } while (0)

define assert_return

#define assert_return (
    expr,
    ...
) do { if (expr) [[likely]] break; ::Ase::assertion_failed (#expr); return __VA_ARGS__; } while (0)

define assert_return_unreached

#define assert_return_unreached (
    ...
) do { ::Ase::assertion_failed (""); return __VA_ARGS__; } while (0)

define assert_unreached

#define assert_unreached (

) __builtin_unreachable()

define assert_warn

#define assert_warn (
    expr
) do { if (expr) [[likely]] break; ::Ase::assertion_failed (#expr); } while (0)

define if_constexpr

#define if_constexpr if constexpr

define return_unless

#define return_unless (
    cond,
    ...
) ASE_RETURN_UNLESS (cond, __VA_ARGS__)


The documentation for this class was generated from the following file /__w/anklang/anklang/ase/internal.hh