ase/cxxaux.hh file


Namespaces

namespace Ase
The Anklang C++ API namespace.

Classes

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

Typedefs

template <bool value>
using 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 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.
using String = std::string
Convenience alias for std::string.
using StringS = std::vector<String>
Convenience alias for a std::vector<std::string>.
using int16 = int16_t
A 16-bit signed integer.
using int32 = int32_t
A 32-bit signed integer.
using int64 = int64_t
A 64-bit unsigned integer, use PRI*64 in format strings.
using int8 = int8_t
An 8-bit signed integer.
using uint = uint32_t
Provide 'uint' as convenience type.
using uint16 = uint16_t
A 16-bit unsigned integer.
using uint32 = uint32_t
A 32-bit unsigned integer.
using uint64 = uint64_t
A 64-bit unsigned integer, use PRI*64 in format strings.
using uint8 = uint8_t
An 8-bit unsigned integer.
using unichar = uint32_t
A 32-bit unsigned integer used for Unicode characters.

Functions

template <typename T>
static auto divmod(T dividend, T divisor, T* reminderp) →  T constexpr
Compute integers division and modulo with one X86 asm instruction.
template <typename UInt>
static auto rotl(UInt bits, uint32_t offset) →  UInt constexpr
Bitwise rotate-left pattern recognized by gcc & clang at -O1 iff sizeof (bits) == {8,16,32,64}.
template <typename UInt>
static auto rotr(UInt bits, uint32_t offset) →  UInt constexpr
Bitwise rotate-right pattern recognized by gcc & clang at -O1 iff sizeof (bits) == {8,16,32,64}.
template <typename T>
static auto unalias_ptr(T* ptr) →  T*
Force compiler to forget the origin of a possibly aliasing pointer.
template <class T>
__attribute__((__pure__))
Provide demangled stringified name for type T.
template <class T>
__attribute__((__pure__))
Provide demangled stringified name for object obj.
template <class Type, class ... Ts>
__attribute__((always_inline)) inline void new _inplace(Type &typemem
Call inplace new operator by automatically inferring the Type.
template <class Type>
__attribute__((always_inline))
Call inplace delete operator by automatically inferring the Type.
void 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 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.
auto backtrace_command() →  std::string
Find GDB and construct command line.
template <class T>
void call_delete(T* o)
Simple way to create a standalone callback to delete an object of type T.
auto constexpr_equals(const char* a, const char* b, size_t n) →  bool constexpr
Test string equality at compile time.
template <class Target, class Source>
auto shared_ptr_cast(Source* object) →  std::shared_ptr<typename std::remove_pointer<Target>::type>
template <class Target, class Source>
auto shared_ptr_cast(const Source* object) →  const std::shared_ptr<typename std::remove_pointer<Target>::type>
See shared_ptr_cast(Source*).
template <class Target, class Source>
auto shared_ptr_cast(std::shared_ptr<Source>& sptr) →  std::shared_ptr<typename std::remove_pointer<Target>::type>
See shared_ptr_cast(Source*).
template <class Target, class Source>
auto shared_ptr_cast(const std::shared_ptr<Source>& sptr) →  const std::shared_ptr<typename std::remove_pointer<Target>::type>
See shared_ptr_cast(Source*).
template <class Source>
auto shared_ptr_from(Source* object) →  std::shared_ptr<typename std::remove_pointer<Source>::type>
Use shared_ptr_cast<>() to convert an object pointer into a shared_ptr<>.
auto string_demangle_cxx(const char* mangled_identifier) →  const char* noexcept
Demangle identifier via libcc.
template <class C>
auto weak_ptr_fetch_or_create(std::weak_ptr<C>& wptr, const std::function<std::shared_ptr<C>()>& ctor) →  std::shared_ptr<C>
Fetch shared_ptr from wptr and create C with ctor if needed.

Defines

#define ASE_ABS(a)
Yield the absolute value of a.
#define ASE_ALIGN(size, base)
Round up size to multiples of base.
#define ASE_ARRAY_SIZE(array)
Yield the number of C array elements.
#define ASE_ASSERT(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_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_WARN(expr)
Issue an assertion warning if expr evaluates to false.
#define ASE_CLAMP(v, mi, ma)
Yield v clamped to [ mi .. ma ].
#define ASE_CLASS_DECLS(Klass)
Forward declare class Klass; as well as KlassP and KlassS as vector<KlassP>.
#define ASE_CLASS_NON_COPYABLE(ClassName)
Delete copy ctor and assignment operator.
#define ASE_CPP_PASTE2(a, b)
Paste two macro arguments into one C symbol name.
#define ASE_CPP_STRINGIFY(s)
Convert macro argument into a C const char*.
#define ASE_DEFINE_MAKE_SHARED(CLASS)
#define ASE_ISLIKELY(expr)
Compiler hint to optimize for expr evaluating to true.
#define ASE_MAX(a, b)
Yield the greater value of a and b.
#define ASE_MIN(a, b)
Yield the smaller value of a and b.
#define ASE_RETURN_UNLESS(cond, ...)
Return silently if cond does not evaluate to true, with return value ...
#define ASE_STRUCT_DECLS(Klass)
Forward declare struct Klass; as well as shared_ptr KlassP and vector KlassS.
#define ASE_UNLIKELY(expr)
Compiler hint to optimize for expr evaluating to false.

Define documentation

#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.