Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions | Variables
cxxaux.hh File Reference
#include <ase/sysconfig.h>
#include <sys/types.h>
#include <cstdint>
#include <string>
#include <functional>
#include <vector>
#include <memory>
#include <cmath>
#include <mutex>
#include <map>

Go to the source code of this file.

Classes

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

Namespaces

namespace  Ase
 The Anklang C++ API namespace.
 

Macros

#define ASE_CPP_STRINGIFY(s)
 Convert macro argument into a C const char*.
 
#define ASE_CPP_STRINGIFY_(s)
 
#define ASE_CPP_PASTE2_(a, b)
 
#define ASE_CPP_PASTE2(a, b)
 Paste two macro arguments into one C symbol name.
 
#define ASE_ISLIKELY(expr)
 Compiler hint to optimize for expr evaluating to true.
 
#define ASE_UNLIKELY(expr)
 Compiler hint to optimize for expr evaluating to false.
 
#define ASE_ABS(a)
 Yield the absolute value of a.
 
#define ASE_MIN(a, b)
 Yield the smaller value of a and b.
 
#define ASE_MAX(a, b)
 Yield the greater value of a and b.
 
#define ASE_CLAMP(v, mi, ma)
 Yield v clamped to [ mi .. ma ].
 
#define ASE_ARRAY_SIZE(array)
 Yield the number of C array elements.
 
#define ASE_ALIGN(size, base)
 Round up size to multiples of base.
 
#define ASE_ALIGNMENT16(pointer)
 
#define ASE_ALIGNED16(pointer)
 
#define ASE_COLD
 
#define ASE_CONSTRUCTOR
 
#define ASE_DEPRECATED
 
#define ASE_FORMAT(fx)
 
#define ASE_HOT
 
#define ASE_MALLOC
 
#define ASE_MAY_ALIAS
 
#define ASE_NOINLINE
 
#define ASE_NORETURN
 
#define ASE_NO_INSTRUMENT
 
#define ASE_PRINTF(fx, ax)
 
#define ASE_PURE
 
#define ASE_SCANF(fx, ax)
 
#define ASE_SENTINEL
 
#define ASE_UNUSED
 
#define ASE_USE_RESULT
 
#define ASE_USED
 
#define ASE_WEAK
 
#define ASE_RETURN_UNLESS(cond, ...)
 Return silently if cond does not evaluate to true, with return value ...
 
#define ASE_ASSERT_RETURN(expr, ...)
 Return from the current function if expr evaluates to false and issue an assertion warning.
 
#define ASE_ASSERT_RETURN_UNREACHED(...)
 Return from the current function and issue an assertion warning.
 
#define ASE_ASSERT_UNREACHED(...)
 Abort and issue an assertion error.
 
#define ASE_ASSERT(expr)
 Issue an assertion warning if expr evaluates to false.
 
#define ASE_ASSERT_WARN(expr)
 Issue an assertion warning if expr evaluates to false.
 
#define ASE_ASSERT_PARANOID(expr)
 Like ASE_ASSERT_WARN(), enabled if expensive expr are allowed.
 
#define ASE_DIE(msg)
 Abort the program with an error message.
 
#define ASE_PERROR_DIE(msg)
 Abort the program with an error message and errno error description.
 
#define ASE_CLASS_NON_COPYABLE(ClassName)
 Delete copy ctor and assignment operator.
 
#define ASE_DEFINE_FLAGS_ARITHMETIC(Enum)
 
#define ASE_DEFINE_MAKE_SHARED(CLASS)
 

Typedefs

typedef uint32_t Ase::uint
 Provide 'uint' as convenience type.
 
typedef uint8_t Ase::uint8
 An 8-bit unsigned integer.
 
typedef uint16_t Ase::uint16
 A 16-bit unsigned integer.
 
typedef uint32_t Ase::uint32
 A 32-bit unsigned integer.
 
typedef uint64_t Ase::uint64
 A 64-bit unsigned integer, use PRI*64 in format strings.
 
typedef int8_t Ase::int8
 An 8-bit signed integer.
 
typedef int16_t Ase::int16
 A 16-bit signed integer.
 
typedef int32_t Ase::int32
 A 32-bit signed integer.
 
typedef int64_t Ase::int64
 A 64-bit unsigned integer, use PRI*64 in format strings.
 
typedef uint32_t Ase::unichar
 A 32-bit unsigned integer used for Unicode characters.
 
using Ase::String = std::string
 Convenience alias for std::string.
 
using Ase::StringS = std::vector< String >
 Convenience alias for a std::vector<std::string>.
 
using Ase::StringPair = std::pair< std::string, std::string >
 
using Ase::VoidF = std::function< void()>
 
using Ase::VirtualBaseP = std::shared_ptr< VirtualBase >
 
template<bool value>
using Ase::REQUIRES = typename ::std::enable_if< value, bool >::type
 REQUIRES<value> - Simplified version of std::enable_if<cond,bool>::type to use SFINAE in function templates.
 
template<bool value>
using Ase::REQUIRESv = typename ::std::enable_if< value, void >::type
 REQUIRESv<value> - Simplified version of std::enable_if<cond,void>::type to use SFINAE in struct templates.
 

Functions

const charAse::string_demangle_cxx (const char *mangled_identifier) noexcept
 Demangle identifier via libcc.
 
void Ase::perror_die (const std::string &msg) noexcept __attribute__((__noreturn__))
 Issue a warning about an assertion error.
 
void Ase::assertion_failed (const char *msg, const char *file, int line, const char *func) noexcept
 Print instructive message, handle "breakpoint", "backtrace" and "fatal-warnings" in $ASE_DEBUG.
 
void Ase::assertion_fatal (const char *msg, const char *file, int line, const char *func) noexcept
 Print a debug message via assertion_failed() and abort the program.
 
std::string Ase::backtrace_command ()
 Find GDB and construct command line.
 
constexpr bool Ase::constexpr_equals (const char *a, const char *b, size_t n)
 Test string equality at compile time.
 
template<class T >
void Ase::call_delete (T *o)
 Simple way to create a standalone callback to delete an object of type T.
 
template<class Target , class Source >
std::shared_ptr< typename std::remove_pointer< Target >::type > Ase::shared_ptr_cast (Source *object)
 
template<class Target , class Source >
const std::shared_ptr< typename std::remove_pointer< Target >::type > Ase::shared_ptr_cast (const Source *object)
 See shared_ptr_cast(Source*).
 
template<class Target , class Source >
std::shared_ptr< typename std::remove_pointer< Target >::type > Ase::shared_ptr_cast (std::shared_ptr< Source > &sptr)
 See shared_ptr_cast(Source*).
 
template<class Target , class Source >
const std::shared_ptr< typename std::remove_pointer< Target >::type > Ase::shared_ptr_cast (const std::shared_ptr< Source > &sptr)
 See shared_ptr_cast(Source*).
 
template<class Source >
std::shared_ptr< typename std::remove_pointer< Source >::type > Ase::shared_ptr_from (Source *object)
 Use shared_ptr_cast<>() to convert an object pointer into a shared_ptr<>.
 
template<class C >
std::shared_ptr< C > Ase::weak_ptr_fetch_or_create (std::weak_ptr< C > &wptr, const std::function< std::shared_ptr< C >()> &ctor)
 Fetch shared_ptr from wptr and create C with ctor if needed.
 

Variables

Ts && Ase::args
 

Macro Definition Documentation

◆ ASE_ABS

#define ASE_ABS (   a)

Yield the absolute value of a.

Definition at line 47 of file cxxaux.hh.

◆ ASE_ALIGN

#define ASE_ALIGN (   size,
  base 
)

Round up size to multiples of base.

Definition at line 52 of file cxxaux.hh.

◆ ASE_ALIGNED16

#define ASE_ALIGNED16 (   pointer)

Definition at line 54 of file cxxaux.hh.

◆ ASE_ALIGNMENT16

#define ASE_ALIGNMENT16 (   pointer)

Definition at line 53 of file cxxaux.hh.

◆ ASE_ARRAY_SIZE

#define ASE_ARRAY_SIZE (   array)

Yield the number of C array elements.

Definition at line 51 of file cxxaux.hh.

◆ ASE_ASSERT

#define ASE_ASSERT (   expr)

Issue an assertion warning if expr evaluates to false.

Definition at line 91 of file cxxaux.hh.

◆ ASE_ASSERT_PARANOID

#define ASE_ASSERT_PARANOID (   expr)

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

Definition at line 97 of file cxxaux.hh.

◆ ASE_ASSERT_RETURN

#define ASE_ASSERT_RETURN (   expr,
  ... 
)

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

Definition at line 82 of file cxxaux.hh.

◆ ASE_ASSERT_RETURN_UNREACHED

#define ASE_ASSERT_RETURN_UNREACHED (   ...)

Return from the current function and issue an assertion warning.

Definition at line 85 of file cxxaux.hh.

◆ ASE_ASSERT_UNREACHED

#define ASE_ASSERT_UNREACHED (   ...)

Abort and issue an assertion error.

Definition at line 88 of file cxxaux.hh.

◆ ASE_ASSERT_WARN

#define ASE_ASSERT_WARN (   expr)

Issue an assertion warning if expr evaluates to false.

Definition at line 94 of file cxxaux.hh.

◆ ASE_CLAMP

#define ASE_CLAMP (   v,
  mi,
  ma 
)

Yield v clamped to [ mi .. ma ].

Definition at line 50 of file cxxaux.hh.

◆ ASE_CLASS_NON_COPYABLE

#define ASE_CLASS_NON_COPYABLE (   ClassName)

Delete copy ctor and assignment operator.

Definition at line 106 of file cxxaux.hh.

◆ ASE_COLD

#define ASE_COLD

Definition at line 58 of file cxxaux.hh.

◆ ASE_CONSTRUCTOR

#define ASE_CONSTRUCTOR

Definition at line 60 of file cxxaux.hh.

◆ ASE_CPP_PASTE2

#define ASE_CPP_PASTE2 (   a,
 
)

Paste two macro arguments into one C symbol name.

Definition at line 44 of file cxxaux.hh.

◆ ASE_CPP_PASTE2_

#define ASE_CPP_PASTE2_ (   a,
 
)

Definition at line 43 of file cxxaux.hh.

◆ ASE_CPP_STRINGIFY

#define ASE_CPP_STRINGIFY (   s)

Convert macro argument into a C const char*.

Definition at line 41 of file cxxaux.hh.

◆ ASE_CPP_STRINGIFY_

#define ASE_CPP_STRINGIFY_ (   s)

Definition at line 42 of file cxxaux.hh.

◆ ASE_DEFINE_FLAGS_ARITHMETIC

#define ASE_DEFINE_FLAGS_ARITHMETIC (   Enum)

Definition at line 129 of file cxxaux.hh.

◆ ASE_DEFINE_MAKE_SHARED

#define ASE_DEFINE_MAKE_SHARED (   CLASS)

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.

Definition at line 269 of file cxxaux.hh.

◆ ASE_DEPRECATED

#define ASE_DEPRECATED

Definition at line 61 of file cxxaux.hh.

◆ ASE_DIE

#define ASE_DIE (   msg)

Abort the program with an error message.

Definition at line 100 of file cxxaux.hh.

◆ ASE_FORMAT

#define ASE_FORMAT (   fx)

Definition at line 62 of file cxxaux.hh.

◆ ASE_HOT

#define ASE_HOT

Definition at line 63 of file cxxaux.hh.

◆ ASE_ISLIKELY

#define ASE_ISLIKELY (   expr)

Compiler hint to optimize for expr evaluating to true.

Definition at line 45 of file cxxaux.hh.

◆ ASE_MALLOC

#define ASE_MALLOC

Definition at line 64 of file cxxaux.hh.

◆ ASE_MAX

#define ASE_MAX (   a,
 
)

Yield the greater value of a and b.

Definition at line 49 of file cxxaux.hh.

◆ ASE_MAY_ALIAS

#define ASE_MAY_ALIAS

Definition at line 65 of file cxxaux.hh.

◆ ASE_MIN

#define ASE_MIN (   a,
 
)

Yield the smaller value of a and b.

Definition at line 48 of file cxxaux.hh.

◆ ASE_NO_INSTRUMENT

#define ASE_NO_INSTRUMENT

Definition at line 68 of file cxxaux.hh.

◆ ASE_NOINLINE

#define ASE_NOINLINE

Definition at line 66 of file cxxaux.hh.

◆ ASE_NORETURN

#define ASE_NORETURN

Definition at line 67 of file cxxaux.hh.

◆ ASE_PERROR_DIE

#define ASE_PERROR_DIE (   msg)

Abort the program with an error message and errno error description.

Definition at line 103 of file cxxaux.hh.

◆ ASE_PRINTF

#define ASE_PRINTF (   fx,
  ax 
)

Definition at line 69 of file cxxaux.hh.

◆ ASE_PURE

#define ASE_PURE

Definition at line 70 of file cxxaux.hh.

◆ ASE_RETURN_UNLESS

#define ASE_RETURN_UNLESS (   cond,
  ... 
)

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

Definition at line 79 of file cxxaux.hh.

◆ ASE_SCANF

#define ASE_SCANF (   fx,
  ax 
)

Definition at line 71 of file cxxaux.hh.

◆ ASE_SENTINEL

#define ASE_SENTINEL

Definition at line 72 of file cxxaux.hh.

◆ ASE_UNLIKELY

#define ASE_UNLIKELY (   expr)

Compiler hint to optimize for expr evaluating to false.

Definition at line 46 of file cxxaux.hh.

◆ ASE_UNUSED

#define ASE_UNUSED

Definition at line 73 of file cxxaux.hh.

◆ ASE_USE_RESULT

#define ASE_USE_RESULT

Definition at line 74 of file cxxaux.hh.

◆ ASE_USED

#define ASE_USED

Definition at line 75 of file cxxaux.hh.

◆ ASE_WEAK

#define ASE_WEAK

Definition at line 76 of file cxxaux.hh.