carb/Defines.h¶
↰ Parent directory: carb/
Carbonite basic defines and helper functions.
Source: carb/Defines.h
Included By¶
carb/Interface.h: Macros for defining a Carbonite interface.
carb/Framework.h: Core header for registering and acquiring interfaces.
carb/Memory.h: DLL Boundary safe memory management functions.
carb/extras/CpuInfo.h: Utilities for gathering information about the CPU.
carb/math/Util.h: Carbonite math utility functions.
carb/thread/Util.h: Carbonite thread utilities.
carb/process/Util.h: Carbonite process utilities.
carb/PluginCoreUtils.h: Utilities to ease the creation of Carbonite plugins. Most code will include carb/PluginUtils.h instead of this file.
omni/String.h: ABI safe string implementation.
carb/l10n/IL10n.h: The L10n interface.
carb/profiler/Profile.h: carb::profiler macros and helpers
carb/extras/EnvironmentVariableParser.h: Parses enviroment variables into map of key/value pairs.
carb/extras/EnvironmentVariable.h: Provides a helper class for getting, setting, and restoring enviroment variables.
carb/tasking/TaskingTypes.h: carb::tasking type definitions
carb/assets/AssetsTypes.h: Type definitions for carb.assets.plugin
carb/RString.h: Registered String utility. See carb::RString for more info.
carb/extras/Library.h: Provides helper functions to handle library loading and management.
carb/extras/StringSafe.h: Wrappers for libc string functions to avoid dangerous edge cases.
carb/extras/SharedMemory.h: Provides a helper class to manage a block of shared memory.
carb/memory/Util.h: Helper utilities for memory.
carb/container/BufferedObject.h: Defines the BufferedObject class.
carb/container/IntrusiveList.h: Carbonite intrusive list container.
carb/container/IntrusiveUnorderedMultimap.h: Carbonite intrusive unordered multi-map container.
carb/container/LocklessQueue.h: Defines the LocklessQueue class.
carb/container/LocklessStack.h: Defines the LocklessStack class.
carb/container/RobinHoodImpl.h: Carbonite Robin-hood container generic implementation.
carb/delegate/Delegate.h: Carbonite Delegate implementation.
carb/extras/Debugging.h: Provides some helper functions that check the state of debuggers for the calling process.
carb/extras/HandleDatabase.h: HandleDatabase definition file.
carb/extras/MemoryUsage.h: Helper to get the memory characteristics of a program.
carb/extras/Uuid.h: UUIDv4 utilities.
carb/extras/Utf8Parser.h: Provides helper classes to parse and convert UTF-8 strings to and from Unicode.
omni/extras/ScratchBuffer.h: A helper class to provide a resizeable scratch buffer.
carb/launcher/LauncherUtils.h: Helper classes and functions for the ILauncher interface.
omni/core/Platform.h: Helper macros to detect the current platform.
carb/memory/ArenaAllocator.h: Allocator that initially uses a memory arena first (typically on the stack) and then falls back to the heap.
carb/profiler/IProfileMonitor.h: Monitor interface for carb::profiler.
carb/thread/SharedMutex.h: C++17-compatible Shared Mutex implementation for C++14 or higher.
carb/thread/ThreadLocal.h: Carbonite dynamic thread-local storage implementation.
carb/thread/Spinlock.h: Carbonite Spinlock implementation.
omni/log/WildcardLogChannelFilter.h: Provides a helper class to store wildcard patterns for log channels.
omni/compiletime/CompileTime.h: Compiler time helper functions.
omni/core/TypeId.h: Helper functions and macros for generating type identifiers.
omni/str/IReadOnlyCString.h: Interface to manage access to a read-only string.
omni/structuredlog/BinarySerializer.h: Module for serializing data into the structured logging queue.
Classes¶
carb::InitBoth: An empty class tag type used with carb::EmptyMemberPair constructors.
carb::ValueInitFirst: An empty class tag type used with carb::EmptyMemberPair constructors.
carb::EmptyMemberPair: Attempts to invoke the Empty Member Optimization by inheriting from the First element if possible, which, if empty will eliminate the storage necessary for an empty class; the Second element is always stored as a separate member. The First element is inherited from if it is an empty
class
/struct
and is not declaredfinal
.
Enums¶
carb::PrefetchLevel: A prefetch level hint to pass to CARB_PREFETCH
Functions¶
carb::assertHandlerFallback: Assertion handler helper function.
carb::fnv1aHash: Compile-time FNV-1a 64-bit hash, use with CARB_HASH_STRING macro.
carb::hashBuffer: Runtime FNV-1a 64-bit byte hash.
carb::hashCombine: Combines two hashes producing better collision avoidance than XOR.
carb::hashLowercaseBuffer: Runtime FNV-1a 64-bit lower-case byte hash (as if the bytes had been converted using carb::tolower).
carb::hashLowercaseString: Runtime FNV-1a 64-bit lower-case string hash (as if the string had been converted using carb::tolower).
carb::hashScalar: Runtime FNV-1a 64-bit hash of a scalar type.
carb::hashString: Runtime FNV-1a 64-bit string hash.
carb::hashUppercaseBuffer: Runtime FNV-1a 64-bit upper-case byte hash (as if the bytes had been converted using carb::toupper).
carb::hashUppercaseString: Runtime FNV-1a 64-bit upper-case string hash (as if the string had been converted using carb::toupper).
carb::tolower: A fast table-based implementation of std::tolower for ASCII characters only.
carb::toupper: A fast table-based implementation of std::toupper for ASCII characters only.
carb_max: Picks the maximum of two values.
carb_min: Picks the minimum of two values.
CARB_UNUSED: Portable way to mark unused variables as used.
Defines¶
CARB_AARCH64: A macro defined as
1
if compilation is targeting the AArch64 platform;0
otherwise. May not be overridden on the command line or by defining before including this file. Set to1
if__aarch64__
is defined,0
if__x86_64__
or_M_X64
are defined, and left undefined otherwise.CARB_ABI: Defined as
__cdecl
on Windows and an empty define on Linux. Used to explicitly state ABI calling convention for API functions.CARB_ALIGN: Aligns a number or pointer to the next multiple of a provided alignment.
CARB_ALIGN_AS: Defined as
alignas(T)
.CARB_ALIGN_OF: Returns the required alignment of a type.
CARB_ALIGNED_SIZE: Aligns a size to the given alignment.
CARB_ALWAYS_INLINE: Instructs the compiler to force inline of the decorated function.
CARB_ANONYMOUS_VAR: A helper macro that appends a number to the given name to create a unique name.
CARB_ASAN_ENABLED: A macro defined as
1
if a GNU toolchain is building the current file with-fsanitize=address
, that is, if bothCARB_COMPILER_GNUC
is1
and__SANITIZE_ADDRESS__
is defined;0
otherwise. May be overridden by defining a different value before including this file or by specifying a different value on the compiler command line.CARB_ASSERT: Optionally performs an assertion, by default for debug builds only.
CARB_ASSERT_ENABLED: Indicates whether asserts are enabled. May be overridden by defining this before including this file. By default, is set to
1
ifCARB_DEBUG
is non-zero. If this is overridden to a non-zero value andCARB_ASSERT
is not defined,CARB_ASSERT
will receive the default implementation.CARB_ASSERT_MEMBERS_MATCH: A helper to determine if member
A.a
matches the offset and size ofB.b
, causing a static assert if unmatched.CARB_ASSERT_STRUCTS_MATCH: A helper to determine if the size and alignment of two given structures match, causing a static assert if unmatched.
CARB_ATTRIBUTE: GCC only, defined as
__attribute__((__VA_ARGS__))
; ignored on non-GCC compilers.CARB_BREAK_POINT: On Windows platforms, defined as
__debugbreak()
; on Linux,raise(SIGTRAP)
. Used to break into the debugger.CARB_CACHELINE_ALIGN: Defined as
CARB_ALIGN_AS(CARB_CACHELINE_SIZE)
.CARB_CACHELINE_SIZE: Minimum offset between two objects to avoid false sharing, i.e. cacheline size. If C++17 is not supported, falls back to the default value of 64 bytes.
CARB_CHECK: Optionally performs a runtime check assertion, by default for both debug and release builds.
CARB_CHECK_ENABLED: Indicates whether runtime checking is enabled. May be overridden by defining this before including this file. By default, is set to
1
always. If this is overridden to a non-zero value andCARB_CHECK
is not defined,CARB_CHECK
will receive the default implementation.CARB_CLAMP: A macro the returns the largest of two values.
CARB_COMPILER_GNUC: A macro defined as
1
if compilation is using GNU C Compiler (GCC), that is, if_MSC_VER
is not defined but__GNUC__
is defined. May be overridden by defining a different value before including this file or by specifying a different value on the compiler command line, however, only one ofCARB_COMPILER_MSC
andCARB_COMPILER_GNUC
must be set to1
; the other macro(s) must be set to0
.CARB_COMPILER_MSC: A macro defined as
1
if compilation is using Microsoft Visual C++, that is, if_MSC_VER
is defined. May be overridden by defining a different value before including this file or by specifying a different value on the compiler command line, however, only one ofCARB_COMPILER_MSC
andCARB_COMPILER_GNUC
must be set to1
; the other macro(s) must be set to0
.CARB_COUNTOF: Returns the count of an array as a
size_t
at compile time.CARB_COUNTOF32: Returns the count of an array as a
uint32_t
at compile time.CARB_CPP17_CONSTEXPR: Defined as
constexpr
if the current compiler supports C++17; empty otherwise.CARB_CPP20_CONSTEXPR: Defined as
constexpr
if the current compiler supports C++20; empty otherwise.CARB_DEBUG: A macro indicating whether the current compilation unit is built in debug mode. Always defined as either 0 or 1. Can be overridden by defining before this file is included or by passing on the compiler command line. Defined as
0
ifNDEBUG
is defined;1
otherwise.CARB_DECLSPEC: MSVC only, defined as
__declspec(__VA_ARGS__)
; ignored on non-MSVC compilers.CARB_DEPRECATED: Declares a function as deprected.
CARB_DIVIDE_CEIL: Divides size by divisor and returns the closest integer greater than or equal to the division result.
CARB_DOC_CONSTEXPR: Macro to work around Exhale tripping over
constexpr
sometimes and reporting things like:Invalid C++ declaration: Expected identifier in nested name, got keyword: static
CARB_DOC_ONLY: Conditionally includes text only when documenting (i.e. when
DOXYGEN_BUILD
is defined).CARB_EXCEPTIONS_ENABLED: Indicates whether exceptions are enabled for the current compilation unit. Value depends on parameters passed to the compiler.
CARB_EXPORT: If
CARB_EXPORTS
is defined before including this file, will be defined as granting a function external linkage. That is, on Windows:extern "C" __declspec(dllexport)
and on Linux:extern "C" __attribute__((visibility("default")))
CARB_EXPORT_C: Defined as
extern "C"
for C++ compilation, that is, when__cplusplus
is defined; empty define otherwise.CARB_FALLTHROUGH: Defined as
[[fallthrough]]
if the current compiler supports C++17; empty otherwise.CARB_FATAL_UNLESS: Terminates the application if a check fails.
CARB_FLOAT_MAX: The maximum value that can be represented by
float
.CARB_FREE: Frees memory previously allocated using CARB_MALLOC.
CARB_HARDWARE_PAUSE: Instructs the underlying hardware to idle the CPU pipelines and reduce the penalty from memory order violations.
CARB_HAS_CPP14: Defined as
1
if the current compiler supports C++14;0
otherwise. C++14 is the minimum required for using Carbonite (though building Carbonite requires C++17).CARB_HAS_CPP17: Defined as
1
if the current compiler supports C++17;0
otherwise.CARB_HAS_CPP20: Defined as
1
if the current compiler supports C++20;0
otherwise.CARB_HASH_STRING: Computes a literal string hash at compile time.
CARB_HASH_TYPE: Syntactic sugar for
CARB_HASH_STRING(CARB_STRINGIFY(T))
.CARB_HIDDEN: Syntactic sugar for
CARB_ATTRIBUTE(visibility("hidden"))
; ignored on compilers other than GCC.CARB_IGNOREWARNING_GNUC: For GCC only, disables a specific compiler warning for the current compilation warning configuration. Defined as
_Pragma("GCC diagnostic ignored <warning>")
for GCC only; ignored by other compilers.CARB_IGNOREWARNING_GNUC_POP: For GCC only, pops the compilation warning configuration previously pushed with CARB_IGNOREWARNING_GNUC_PUSH, overwriting the current state. Defined as
_Pragma("GCC diagnostic pop")
for GCC only; ignored by other compilers.CARB_IGNOREWARNING_GNUC_PUSH: For GCC only, pushes the current compilation warning configuration. Defined as
_Pragma("GCC diagnostic push")
for GCC only; ignored by other compilers.CARB_IGNOREWARNING_GNUC_WITH_PUSH: Syntactic sugar for CARB_IGNOREWARNING_GNUC_PUSH followed by CARB_IGNOREWARNING_GNUC.
CARB_IGNOREWARNING_MSC: For MSVC only, disables a specific compiler warning for the current compilation warning configuration. Defined as
__pragma(warning(disable : <w>))
for MSVC only; ignored by other compilers.CARB_IGNOREWARNING_MSC_POP: For MSVC only, pops the compilation warning configuration previously pushed with CARB_IGNOREWARNING_MSC_PUSH, overwriting the current state. Defined as
__pragma(warning(pop))
for MSVC only; ignored by other compilers.CARB_IGNOREWARNING_MSC_PUSH: For MSVC only, pushes the current compilation warning configuration. Defined as
__pragma(warning(push))
for MSVC only; ignored by other compilers.CARB_IGNOREWARNING_MSC_WITH_PUSH: Syntactic sugar for CARB_IGNOREWARNING_MSC_PUSH followed by CARB_IGNOREWARNING_MSC.
CARB_JOIN: A macro that joins two parts to create one symbol allowing one or more parameters to be a macro, as if by the
##
preprocessor operator. Example:CARB_JOIN(test, __LINE__)
on line 579 producestest579
.CARB_LIKELY: Defined as
([[likely]] !!(<expr>))
if the current compiler supports C++20. If the current compiler is GCC, as a fallback,__builtin_expect(!!(<expr>), 1)
will be used. Otherwise, defined as(!!(<expr>))
CARB_MALLOC: Allocates memory from the heap.
CARB_MAX: A macro the returns the largest of two values.
CARB_MAYBE_UNUSED: Defined as
[[maybe_unused]]
if the current compiler supports C++17; empty otherwise.CARB_MIN: A macro that returns the least of two values.
CARB_NO_UNIQUE_ADDRESS: Defined as
[[no_unique_address]]
if the current compiler supports C++20; empty otherwise.CARB_NODISCARD: Defined as
[[nodiscard]]
if the current compiler supports C++17; empty otherwise.CARB_NOEXCEPT: Declares that a function will not throw any exceptions.
CARB_NOINLINE: A macro that declares that a function may not be inlined.
CARB_OFFSETOF: Returns the offset of a member of a class at compile time.
CARB_PLATFORM_LINUX: A macro defined as
1
if compilation is targeting Linux;0
otherwise. Exactly one of theCARB_PLATFORM_*
macros will be set to1
. May be overridden by defining before this file is included or by passing on the compiler command line. By default, set to1
if_WIN32
is not defined and__linux__
is defined.CARB_PLATFORM_WINDOWS: A macro defined as
1
if compilation is targeting Windows;0
otherwise. Exactly one of theCARB_PLATFORM_*
macros will be set to1
. May be overridden by defining before this file is included or by passing on the compiler command line. By default, set to1
if_WIN32
is defined.CARB_PRAGMA_GNUC: GCC only, defined as
_Pragma(__VA_ARGS__)
; ignored on non-GCC compilers.CARB_PRAGMA_MSC: MSVC only, defined as
__pragma(__VA_ARGS__)
; ignored on non-MSVC compilers.CARB_PREFETCH: Attempts to prefetch from memory using a compiler intrinsic.
CARB_PRETTY_FUNCTION: Acts as a
char[]
with the current full function signature.CARB_PREVENT_COPY: A macro that deletes the copy-construct and copy-assign functions for the given classname.
CARB_PREVENT_COPY_AND_MOVE: Syntactic sugar for both CARB_PREVENT_COPY and CARB_PREVENT_MOVE.
CARB_PREVENT_MOVE: A macro that deletes the move-construct and move-assign functions for the given classname.
CARB_PRINTF_FUNCTION: Requests that the compiler validate any variadic arguments as printf-style format specifiers, if supported by the compiler. Causes a compilation error if the printf-style format specifier doesn’t match the given variadic types.
CARB_PROFILING: When set to a non-zero value, profiling macros in include/carb/profiler/Profile.h will report to the profiler; otherwise the profiling macros have no effect. Always set to
1
by default, but may be overridden by defining a different value before including this file or by specifying a different value on the compiler command line.CARB_RETRY_EINTR: A macro to retry operations if they return -1 and errno is set to EINTR.
CARB_ROUNDUP: Rounds a given value to the next highest multiple of another given value.
CARB_STACK_ALLOC: Attempts to allocate an array of the given type on the stack.
CARB_STRINGIFY: Turns a name into a string, resolving macros (i.e.
CARB_STRINGIFY(__LINE__)
on line 815 will produce"815"
).CARB_TEGRA: A macro defined as
1
if compilation is targeting the Tegra platform. By default set to1
only if__aarch64__
and__LINARO_RELEASE__
are defined;0
otherwise. May be overridden by defining a different value before including this file or by specifying a different value on the compiler command line.CARB_TOOLCHAIN_CLANG: A macro defined as
1
if a Clang-infrastructure toolchain is building the current file, that is, if__clang__
is defined;0
if not. May be overridden by defining a different value before including this file or by specifying a different value on the compiler command line.CARB_UINT16_MAX: The maximum value that can be represented by
uint16_t
.CARB_UINT32_MAX: The maximum value that can be represented by
uint32_t
.CARB_UINT64_MAX: The maximum value that can be represented by
uint64_t
.CARB_ULLONG_MAX: The maximum value that can be represented by
unsigned long long
.CARB_UNLIKELY: Defined as
([[unlikely]] !!(<expr>))
if the current compiler supports C++20. If the current compiler is GCC, as a fallback,__builtin_expect(!!(<expr>), 0)
will be used. Otherwise, defined as(!!(<expr>))
CARB_USHRT_MAX: The maximum value that can be represented by
unsigned short
.CARB_WEAKLINK: Syntactic sugar for
None
, used to enable weak linking.CARB_X86_64: A macro defined as
1
if compilation is targeting the x86-64 platform;0
otherwise. May not be overridden on the command line or by defining before including this file. Set to0
if__aarch64__
is defined,1
if__x86_64__
or_M_X64
are defined, and left undefined otherwise.DOXYGEN_EMPTY_CLASS: Used when declaring opaque types to prevent Doxygen from getting confused about not finding any implementation.
Variables¶
carb::kFnvBasis: FNV-1a 64-bit hash basis.
carb::kFnvPrime: FNV-1a 64-bit hash prime.