Skip to content

File cxxaux.hh

FileList > ase > cxxaux.hh

  • #include <ase/sysconfig.h>
  • #include <sys/types.h>
  • #include <cstdint>
  • #include <string>
  • #include <functional>
  • #include <vector>
  • #include <memory>
  • #include <cmath>
  • #include <mutex>
  • #include <map>

Namespaces

Type Name
namespace Ase
The Anklang C++ API namespace.

Classes

Type Name
struct Id32
Helper class for integer IDs up to 32 Bit, possibly of enum type.
class Persistent <class Class>
struct VirtualBase
Common base type to allow casting between polymorphic classes.

Macros

Type Name
define ASE_ABS (a) ((a) &lt; 0 ? -(a) : (a))
Yield the absolute value of a .
define ASE_ALIGN (size, base) ((base) \* ((size\_t (size) + (base) - 1) / (base)))
Round up size to multiples of__base .
define ASE_ALIGNED16 (pointer) (!ALIGNMENT16 (pointer))
define ASE_ALIGNMENT16 (pointer) (0xf & ptrdiff\_t (pointer))
define ASE_ALWAYS_INLINE \_\_attribute\_\_ ((always\_inline))
define ASE_ARRAY_SIZE (array) (sizeof (array) / sizeof ((array)[0]))
Yield the number of C array elements.
define ASE_ASSERT (expr) do { if (expr) [[likely]] break; [**::Ase::assertion\_fatal**](namespaceAse.md#function-assertion_fatal) (#expr); } while (0)
Issue an assertion warning if expr evaluates to false.
define ASE_ASSERT_PARANOID (expr) do { if (expr) [[likely]] break; [**::Ase::assertion\_failed**](namespaceAse.md#function-assertion_failed) (#expr); } while (0)
Like ASE_ASSERT_WARN(), enabled if expensive expr are allowed.
define ASE_ASSERT_RETURN (expr, ...) do { if (expr) [[likely]] break; [**::Ase::assertion\_failed**](namespaceAse.md#function-assertion_failed) (#expr); return \_\_VA\_ARGS\_\_; } while (0)
Return from the current function if expr evaluates to false and issue an assertion warning.
define ASE_ASSERT_RETURN_UNREACHED (...) do { [**::Ase::assertion\_failed**](namespaceAse.md#function-assertion_failed) (nullptr); return \_\_VA\_ARGS\_\_; } while (0)
Return from the current function and issue an assertion warning.
define ASE_ASSERT_UNREACHED (...) do { [**::Ase::assertion\_fatal**](namespaceAse.md#function-assertion_fatal) (nullptr); } while (0)
Abort and issue an assertion error.
define ASE_ASSERT_WARN (expr) do { if (expr) [[likely]] break; [**::Ase::assertion\_failed**](namespaceAse.md#function-assertion_failed) (#expr); } while (0)
Issue an assertion warning if expr evaluates to false.
define ASE_CLAMP (v, mi, ma) ((v) &lt; (mi) ? (mi) : ((v) &gt; (ma) ? (ma) : (v)))
Yield v clamped to [__mi ..__ma ].
define ASE_CLASS_DECLS (Klass) /* multi line expression */
Forward declare class Klass; as well asKlassP andKlassS asvector<KlassP> .
define ASE_CLASS_NON_COPYABLE (ClassName) /* multi line expression */
Delete copy ctor and assignment operator.
define ASE_COLD \_\_attribute\_\_ ((\_\_cold\_\_))
define ASE_CONST \_\_attribute\_\_ ((\_\_const\_\_))
define ASE_CONSTRUCTOR \_\_attribute\_\_ ((constructor,used))
define ASE_CPP_PASTE2 (a, b) ASE\_CPP\_PASTE2\_ (a,b)
Paste two macro arguments into one C symbol name.
define ASE_CPP_PASTE2_ (a, b) a ## b
define ASE_CPP_STRINGIFY (s) ASE\_CPP\_STRINGIFY\_ (s)
Convert macro argument into a C const char*.
define ASE_CPP_STRINGIFY_ (s) #s
define ASE_DEFINE_ENUM_EQUALITY (Enum) /* multi line expression */
define ASE_DEFINE_FLAGS_ARITHMETIC (Enum)
define ASE_DEFINE_MAKE_SHARED (CLASS) /* multi line expression */
define ASE_DEPRECATED \_\_attribute\_\_ ((\_\_deprecated\_\_))
define ASE_FORMAT (fx) \_\_attribute\_\_ ((\_\_format\_arg\_\_ (fx)))
define ASE_HOT \_\_attribute\_\_ ((\_\_hot\_\_))
define ASE_ISLIKELY (expr) \_\_builtin\_expect (bool (expr), 1)
Compiler hint to optimize for expr evaluating to true.
define ASE_MALLOC \_\_attribute\_\_ ((\_\_malloc\_\_))
define ASE_MAX (a, b) ((a) &gt;= (b) ? (a) : (b))
Yield the greater value of a and__b .
define ASE_MAY_ALIAS \_\_attribute\_\_ ((may\_alias))
define ASE_MIN (a, b) ((a) &lt;= (b) ? (a) : (b))
Yield the smaller value of a and__b .
define ASE_NOINLINE \_\_attribute\_\_ ((noinline))
define ASE_NORETURN \_\_attribute\_\_ ((\_\_noreturn\_\_))
define ASE_NO_INSTRUMENT \_\_attribute\_\_ ((\_\_no\_instrument\_function\_\_))
define ASE_PRINTF (fx, ax) \_\_attribute\_\_ ((\_\_format\_\_ (\_\_printf\_\_, fx, ax)))
define ASE_PURE \_\_attribute\_\_ ((\_\_pure\_\_))
define ASE_RETURN_UNLESS (cond, ...) do { if (ASE\_UNLIKELY (!bool (cond))) return \_\_VA\_ARGS\_\_; } while (0)
Return silently if cond does not evaluate to true, with return value___ ..._
define ASE_SCANF (fx, ax) \_\_attribute\_\_ ((\_\_format\_\_ (\_\_scanf\_\_, fx, ax)))
define ASE_SENTINEL \_\_attribute\_\_ ((\_\_sentinel\_\_))
define ASE_STRUCT_DECLS (Klass) /* multi line expression */
Forward declare struct Klass; as well as shared_ptrKlassP and vectorKlassS .
define ASE_UNLIKELY (expr) \_\_builtin\_expect (bool (expr), 0)
Compiler hint to optimize for expr evaluating to false.
define ASE_UNUSED \_\_attribute\_\_ ((\_\_unused\_\_))
define ASE_USED \_\_attribute\_\_ ((\_\_used\_\_))
define ASE_USE_RESULT \_\_attribute\_\_ ((warn\_unused\_result))
define ASE_WEAK \_\_attribute\_\_ ((\_\_weak\_\_))

Macro Definition Documentation

define ASE_ABS

Yield the absolute value of a .

#define ASE_ABS (
    a
) `((a) < 0 ? -(a) : (a))`

define ASE_ALIGN

Round up size to multiples of__base .

#define ASE_ALIGN (
    size,
    base
) `((base) * ((size_t (size) + (base) - 1) / (base)))`

define ASE_ALIGNED16

#define ASE_ALIGNED16 (
    pointer
) `(!ALIGNMENT16 (pointer))`

define ASE_ALIGNMENT16

#define ASE_ALIGNMENT16 (
    pointer
) `(0xf & ptrdiff_t (pointer))`

define ASE_ALWAYS_INLINE

#define ASE_ALWAYS_INLINE `__attribute__ ((always_inline))`

define ASE_ARRAY_SIZE

Yield the number of C array elements.

#define ASE_ARRAY_SIZE (
    array
) `(sizeof (array) / sizeof ((array)[0]))`

define ASE_ASSERT

Issue an assertion warning if expr evaluates to false.

#define ASE_ASSERT (
    expr
) `do { if (expr) [[likely]] break; ::Ase::assertion_fatal (#expr); } while (0)`

define ASE_ASSERT_PARANOID

Like ASE_ASSERT_WARN(), enabled if expensive expr are allowed.

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

define ASE_ASSERT_RETURN

Return from the current function if expr evaluates to false and issue an assertion warning.

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

define ASE_ASSERT_RETURN_UNREACHED

Return from the current function and issue an assertion warning.

#define ASE_ASSERT_RETURN_UNREACHED (
    ...
) `do { ::Ase::assertion_failed (nullptr); return __VA_ARGS__; } while (0)`

define ASE_ASSERT_UNREACHED

Abort and issue an assertion error.

#define ASE_ASSERT_UNREACHED (
    ...
) `do { ::Ase::assertion_fatal (nullptr); } while (0)`

define ASE_ASSERT_WARN

Issue an assertion warning if expr evaluates to false.

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

define ASE_CLAMP

Yield v clamped to [__mi ..__ma ].

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

define ASE_CLASS_DECLS

Forward declare class Klass; as well asKlassP andKlassS asvector<KlassP> .

#define ASE_CLASS_DECLS (
    Klass
) `/* multi line expression */`

define ASE_CLASS_NON_COPYABLE

Delete copy ctor and assignment operator.

#define ASE_CLASS_NON_COPYABLE (
    ClassName
) `/* multi line expression */`

define ASE_COLD

#define ASE_COLD `__attribute__ ((__cold__))`

define ASE_CONST

#define ASE_CONST `__attribute__ ((__const__))`

define ASE_CONSTRUCTOR

#define ASE_CONSTRUCTOR `__attribute__ ((constructor,used))`

define ASE_CPP_PASTE2

Paste two macro arguments into one C symbol name.

#define ASE_CPP_PASTE2 (
    a,
    b
) `ASE_CPP_PASTE2_ (a,b)`

define ASE_CPP_PASTE2_

#define ASE_CPP_PASTE2_ (
    a,
    b
) `a ## b`

define ASE_CPP_STRINGIFY

Convert macro argument into a C const char*.

#define ASE_CPP_STRINGIFY (
    s
) `ASE_CPP_STRINGIFY_ (s)`

define ASE_CPP_STRINGIFY_

#define ASE_CPP_STRINGIFY_ (
    s
) `#s`

define ASE_DEFINE_ENUM_EQUALITY

#define ASE_DEFINE_ENUM_EQUALITY (
    Enum
) `/* multi line expression */`

define ASE_DEFINE_FLAGS_ARITHMETIC

#define ASE_DEFINE_FLAGS_ARITHMETIC (
    Enum
) 

define ASE_DEFINE_MAKE_SHARED

#define ASE_DEFINE_MAKE_SHARED (
    CLASS
) `/* multi line expression */`

Define a member function static shared_ptr<CLASS> make_shared(ctorargs...);. As member function, access to a private dtor and ctors is granted, so no std::allocator friend declaration is needed to define make_shared() for its own class.


define ASE_DEPRECATED

#define ASE_DEPRECATED `__attribute__ ((__deprecated__))`

define ASE_FORMAT

#define ASE_FORMAT (
    fx
) `__attribute__ ((__format_arg__ (fx)))`

define ASE_HOT

#define ASE_HOT `__attribute__ ((__hot__))`

define ASE_ISLIKELY

Compiler hint to optimize for expr evaluating to true.

#define ASE_ISLIKELY (
    expr
) `__builtin_expect (bool (expr), 1)`

define ASE_MALLOC

#define ASE_MALLOC `__attribute__ ((__malloc__))`

define ASE_MAX

Yield the greater value of a and__b .

#define ASE_MAX (
    a,
    b
) `((a) >= (b) ? (a) : (b))`

define ASE_MAY_ALIAS

#define ASE_MAY_ALIAS `__attribute__ ((may_alias))`

define ASE_MIN

Yield the smaller value of a and__b .

#define ASE_MIN (
    a,
    b
) `((a) <= (b) ? (a) : (b))`

define ASE_NOINLINE

#define ASE_NOINLINE `__attribute__ ((noinline))`

define ASE_NORETURN

#define ASE_NORETURN `__attribute__ ((__noreturn__))`

define ASE_NO_INSTRUMENT

#define ASE_NO_INSTRUMENT `__attribute__ ((__no_instrument_function__))`

define ASE_PRINTF

#define ASE_PRINTF (
    fx,
    ax
) `__attribute__ ((__format__ (__printf__, fx, ax)))`

define ASE_PURE

#define ASE_PURE `__attribute__ ((__pure__))`

define ASE_RETURN_UNLESS

Return silently if cond does not evaluate to true, with return value___ ..._

#define ASE_RETURN_UNLESS (
    cond,
    ...
) `do { if (ASE_UNLIKELY (!bool (cond))) return __VA_ARGS__; } while (0)`

define ASE_SCANF

#define ASE_SCANF (
    fx,
    ax
) `__attribute__ ((__format__ (__scanf__, fx, ax)))`

define ASE_SENTINEL

#define ASE_SENTINEL `__attribute__ ((__sentinel__))`

define ASE_STRUCT_DECLS

Forward declare struct Klass; as well as shared_ptrKlassP and vectorKlassS .

#define ASE_STRUCT_DECLS (
    Klass
) `/* multi line expression */`

define ASE_UNLIKELY

Compiler hint to optimize for expr evaluating to false.

#define ASE_UNLIKELY (
    expr
) `__builtin_expect (bool (expr), 0)`

define ASE_UNUSED

#define ASE_UNUSED `__attribute__ ((__unused__))`

define ASE_USED

#define ASE_USED `__attribute__ ((__used__))`

define ASE_USE_RESULT

#define ASE_USE_RESULT `__attribute__ ((warn_unused_result))`

define ASE_WEAK

#define ASE_WEAK `__attribute__ ((__weak__))`


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