Skip to content

Engine

Core

conjure::core is the foundation every other module links: the error model, logging and asserts, math, containers, strings, memory, time, jobs, JSON, the virtual file system, OS services and reflection. This chapter describes the shape of the module, the conventions every area shares, an index of the areas and how the module is built and tested. The areas themselves (purpose, headers, algorithms, threading guarantees, extension points, tests) are documented on two sub-pages:

Public headers live under engine/include/conjure/core/, sources under engine/src/core/<area>/, tests under tests/core/<area>/; every area has a README at engine/src/core/<area>/README.md with the finer behavioural notes.

See engine/src/core/README.md for additional implementation notes.

Dependency Graph

Core module dependencies

Headers

File Description Provides
aabb.h Axis-aligned bounding box. aabb
std::formatter<conjure::math::aabb>
allocation_counters.h Process-wide allocation counters. memory::allocation_counters
memory::memory_snapshot
api.h Symbol visibility for the engine's public API.
arena.h Declarations for arena.h. memory::arena
assert.h Assertions. assert_info
bit_vector.h A dynamically sized set of bits packed into 64-bit words. bit_vector
bit_vector::set_bit_iterator
bit_vector::set_bit_range
clock.h A monotonic time source measured in seconds. clock
manual_clock
steady_clock
stopwatch
containers.h Umbrella header for the core containers area.
dedicated_thread.h Declarations for dedicated_thread.h. jobs::dedicated_thread
delegate.h Single-target callbacks without allocation. delegate<Return(Args...)>
detail.h Helpers shared by the container headers.
document.h JSON documents. json::document
json::init_member
json::init_value
dynamic_library.h RAII handle to a loaded shared library. dynamic_library
enum_flags.h Bitwise operators and helpers for enumerations used as flag sets.
error.h A recoverable failure: category, code and a human readable message. error
error_category_traits<error_code>
std::formatter<conjure::core::error>
std::formatter<conjure::core::error_code>
event.h A multicast callback list. detail::subscription_target
event
event::slot
event::state
event_subscription
event_bus.h Engine-wide typed publish/subscribe. event_bus
event_bus::channel
event_bus::channel_base
field_info.h Field descriptions. reflect::detail::std_array_traits
reflect::detail::std_array_traits<std::array<ElementType, N>>
reflect::enum_info
reflect::field_attributes
reflect::field_info
reflect::reflect_traits<bool>
reflect::reflect_traits<f32>
reflect::reflect_traits<f64>
reflect::reflect_traits<i16>
reflect::reflect_traits<i32>
reflect::reflect_traits<i64>
reflect::reflect_traits<i8>
reflect::reflect_traits<math::mat4>
reflect::reflect_traits<math::quat>
reflect::reflect_traits<math::transform>
reflect::reflect_traits<math::vec2>
reflect::reflect_traits<math::vec3>
reflect::reflect_traits<math::vec4>
reflect::reflect_traits<std::string>
reflect::reflect_traits<string_id>
reflect::reflect_traits<T>
reflect::reflect_traits<u16>
reflect::reflect_traits<u32>
reflect::reflect_traits<u64>
reflect::reflect_traits<u8>
reflect::reflect_traits<uuid>
std::formatter<conjure::core::reflect::field_kind>
file_lock.h An exclusive cross-process lock on one file. file_lock
file_system.h The virtual file system interface. vfs::file
vfs::file_stat
vfs::file_system
flat_hash_map.h Open-addressing hash map storing std::pair<const K, V> in place. detail::hash_table
detail::hash_table::basic_iterator
detail::identity_key_of
detail::pair_key_of
flat_hash_map
flat_hash_set
flat_map.h flat_map: a sorted vector of key/value pairs with binary search. flat_map
frame_allocator.h Declarations for frame_allocator.h. memory::frame_allocator
frustum.h Six inward-facing, normalised planes describing a view volume. frustum
glm_types.h The engine's vector, quaternion and matrix types are glm's. std::formatter<conjure::math::ivec2>
std::formatter<conjure::math::ivec3>
std::formatter<conjure::math::ivec4>
std::formatter<conjure::math::mat3>
std::formatter<conjure::math::mat4>
std::formatter<conjure::math::quat>
std::formatter<conjure::math::uvec2>
std::formatter<conjure::math::uvec3>
std::formatter<conjure::math::uvec4>
std::formatter<conjure::math::vec2>
std::formatter<conjure::math::vec3>
std::formatter<conjure::math::vec4>
hash.h FNV-1a hashing.
image.h A row-major RGBA8 image, 4 bytes per pixel, rows top to bottom and no row padding. image
rgba8
job_handle.h Declarations for job_handle.h. jobs::detail::job_counter
jobs::job_fence
jobs::job_handle
job_system.h Declarations for job_system.h. jobs::job_system
jobs::job_system_desc
jobs::job_system_stats
jobs.h Umbrella header for the jobs area: job system, handles, parallel_for helpers, the main-thread queue and dedicated threads.
json.h Umbrella header for the json area.
json_conversion.h JSON conversion driven by type_info. json::json_converter<math::mat4>
json::json_converter<math::quat>
json::json_converter<math::transform>
json::json_converter<math::vec2>
json::json_converter<math::vec3>
json::json_converter<math::vec4>
json::json_converter<string_id>
reflect::field_ref
log.h Logging. callback_log_sink
console_log_sink
file_log_sink
log_category
log_message
log_sink
main_thread.h The main thread and its task queue.
math.h Umbrella header of the math area: glm aliases and formatters, scalar utilities, transform, aabb, plane, frustum, ray, rect and the projection helpers below.
math.h Convenience include for the whole math area (conjure::math): glm aliases, transform, aabb, plane, frustum, ray, rect, scalar utilities and projection helpers.
math_utils.h Scalar helpers that need no glm: constants, angle conversion, approximate comparison, interpolation and integer alignment / power-of-two utilities.
memory.h Umbrella header for the core memory area: counted heap allocation and the engine's allocators.
memory_file_system.h Declarations for memory_file_system.h. vfs::memory_file_system
mount_table.h Declarations for mount_table.h. vfs::mount_table
vfs::mount_table::route_target
native_file_system.h Declarations for native_file_system.h. vfs::native_file_system
parallel_for.h Convenience wrappers around job_system::parallel_for that accept any callable instead of a std::function.
path_utils.h Lexical helpers for the '/'-separated UTF-8 paths used by the virtual file system.
plane.h An infinite plane in the form dot(normal, point) + distance = 0. plane
std::formatter<conjure::math::plane>
platform_detect.h Compile-time platform, compiler and build-configuration detection.
pool_allocator.h Declarations for pool_allocator.h. memory::pool_allocator
memory::pool_allocator::free_block
memory::pool_allocator::slab
process.h A child process started by start(), or run to completion by run(). process
process_desc
process_result
radix_sort.h Stable least-significant-digit radix sort for unsigned keys with optional 32-bit payloads.
random.h Pseudo-random numbers. random::random_engine
ray.h A half-line origin + t * direction for t >= 0. ray
rect.h A float rectangle given by its min and max corners (y may point either way; the struct only assumes min <= max). rect
std::formatter<conjure::math::rect>
std::formatter<conjure::math::urect>
urect
reflect.h Umbrella header of the reflect area plus the description macros.
result.h Either a value or an error. result
result<void>
slot_key_format.h Text form of slot_key: to_string, parse_slot_key and the std::formatter specialisation. std::formatter<conjure::core::slot_key>
slot_map.h Dense storage addressed by generational keys. slot_key
slot_map
slot_map::slot_entry
slot_map_entry
std::hash<conjure::core::slot_key>
std::tuple_element<0, conjure::core::slot_map_entry<Key, T>>
std::tuple_element<1, conjure::core::slot_map_entry<Key, T>>
std::tuple_size<conjure::core::slot_map_entry<Key, T>>
small_vector.h small_vector: a std::vector with inline storage for the first N elements. small_vector
stable_vector.h stable_vector: a growable sequence whose elements never move. stable_vector
stable_vector::basic_iterator
string_id.h A string reduced to its 64-bit FNV-1a hash. std::formatter<conjure::core::string_id>
std::hash<conjure::core::string_id>
string_id
string_utils.h ASCII-oriented string helpers used throughout the engine for identifiers, paths, config values and log output.
tracked_allocation.h Counted, aligned heap allocation.
transform.h Position, rotation and scale (TRS). std::formatter<conjure::math::transform>
transform
type_id.h Type identifiers. reflect::type_id
std::formatter<conjure::core::reflect::type_id>
std::hash<conjure::core::reflect::type_id>
type_info.h Struct descriptions. reflect::type_info
type_registry.h The type registry. reflect::type_registry
types.h Declarations for types.h.
uuid.h 128-bit universally unique identifier (RFC 4122 version 4 when generated). std::formatter<conjure::core::uuid>
std::hash<conjure::core::uuid>
uuid
value.h JSON values. json::detail::value_access
json::json_converter<bool>
json::json_converter<f32>
json::json_converter<f64>
json::json_converter<i16>
json::json_converter<i32>
json::json_converter<i64>
json::json_converter<i8>
json::json_converter<std::string>
json::json_converter<std::vector<T>>
json::json_converter<u16>
json::json_converter<u32>
json::json_converter<u64>
json::json_converter<u8>
json::json_converter<uuid>
json::member
json::value
json::value::array_iterator
json::value::object_iterator
json::value::object_range
std::formatter<conjure::core::json::json_type>
vfs.h Umbrella header for the virtual file system area of core.
writer.h Streaming JSON writer. json::writer
json::writer::frame

Breakdown

Contents

Shape of the module

Core is one module made of eleven independently buildable areas. engine/src/core/CMakeLists.txt creates the umbrella conjure_core (an INTERFACE target, alias conjure::core) that adds engine/include and the generated include directory, then adds each area directory; every area declares a static library conjure_core_<area> (alias conjure::core_<area>) with conjure_add_core_area(<area> PUBLIC_HEADERS... SOURCES... PUBLIC_DEPS...) from cmake/ConjureModule.cmake and a test executable conjure_core_<area>_tests. Other modules link conjure::core; a core area links only the areas it needs:

Area Library Headers under conjure/core/ Public deps beyond foundation
foundation conjure::core_foundation flat - (Threads::Threads)
math conjure::core_math math.h, math/ glm
containers conjure::core_containers containers/ -
strings conjure::core_strings flat -
memory conjure::core_memory memory/ -
time conjure::core_time flat -
jobs conjure::core_jobs jobs/ -
vfs conjure::core_vfs vfs/ -
json conjure::core_json json/ vfs (private), yyjson (private)
system conjure::core_system flat jobs (private), stb (private)
reflect conjure::core_reflect reflect/ json, strings, math, containers, time

Each area library is registered with conjure_register_static_library(), so the whole of core is whole-archived into the umbrella shared library conjure_shared by conjure_finalize_engine() (Module system 2, Modules module 7).

Areas at a glance

Area Purpose Namespace Details
foundation platform detection, fundamental types, hashing, errors and results, asserts, logging, uuid, enum flags conjure, conjure::core foundation
math glm behind one header, geometry value types (transform, aabb, plane, frustum, ray, rect) conjure::math math
containers slot_map, small_vector, stable_vector, flat_hash_map, flat_map conjure::core containers
strings string_id, ASCII and UTF helpers, bit_vector, radix sort conjure::core, conjure::core::str strings
memory counted allocation, arena, pool_allocator, frame_allocator conjure::core::memory memory
time clocks, randomness, event, delegate, event_bus conjure::core, conjure::core::random time
jobs job_system, parallel_for, the main-thread queue, dedicated_thread conjure::core::jobs jobs
json value, document, writer; canonical JSON conjure::core::json json
vfs file_system backends, mount_table, path helpers conjure::core::vfs vfs
system process, dynamic_library, image conjure::core system
reflect type_info, type_registry, CONJURE_REFLECT_*, JSON conversion conjure::core::reflect reflect

Each area section on the sub-pages has the same subheadings: Headers (a table of every public header), Algorithms, Threading, Extension points where the area has any, and Tests.

Extension Points

Convention Rule
Errors fallible calls return result<T> / status with a generic core::error_code; core declares no category of its own; programmer errors assert
Allocation new/delete/malloc are confined to memory
Threads std::thread / std::jthread are confined to jobs; every other thread is a jobs::dedicated_thread, the system::process pipe readers included (system links jobs for them)
Platform code per-platform translation units (*_windows.cpp, *_posix.cpp) selected by CMake; only conjure/core/platform_detect.h reads compiler macros
Third-party headers never in public headers; glm is the single exception, through conjure/core/math/glm_types.h
Determinism everything is headless and deterministic given the same inputs

Two names need qualifying after a using namespace: write core::clock (ambiguous with the C library's ::clock()) and reflect::type_info (ambiguous with ::type_info from <typeinfo> on MSVC).

Testing

python tools/build.py --build-dir build/core --test -R core_                               # every core area
python tools/build.py --build-dir build/core_jobs --target conjure_core_jobs_tests --test -R core_jobs

tests/core/<area>/test_<header>.cpp mirrors every public header (tools/check_style.py --tests-mirror-headers, CTest entry style.check); conjure_core_<area>_tests is one CTest entry per TEST_CASE. Every public header also compiles alone through conjure_header_check (part of the default build). Everything is headless and deterministic: manual_clock, seeded random, 0-worker job systems, memory_file_system or a conjure::testing::temp_directory. The exit gates are listed in.

Tip

Build and test one area at a time while working in it (--target conjure_core_<area>_tests --test -R core_<area>); the whole module is only needed before the review checklist.