# carbonengine/core architecture

> Architecture diagram of the GitHub repository carbonengine/core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/carbonengine/core
- Repository: https://github.com/carbonengine/core

## Overview

#### Purpose and Build Entry Points
Carbon Core is a C++ low-level portability library: generic utilities and cross-platform abstractions around system facilities. The primary build entry point is `CMakeLists.txt`, with selectable platform/build profiles in `CMakePresets.json`. Public consumption is through headers in `include/` and CMake package metadata in `carbon-coreConfig.cmake` and `CcpCoreConfig.cmake.in`.

#### Public Core API Boundary
`include/CcpCore.h` is the umbrella/core-facing interface, supported by foundational definitions and types in `include/CcpDefines.h`, `include/CcpTypes.h`, and `include/CcpMacros.h`. Implementations reside at repository root, notably `CcpCore.cpp` and `CcpDefines.cpp`. Consumers should depend on exported headers rather than root implementation files.

#### Platform and System Abstractions
The library wraps operating-system-facing concerns behind cross-platform APIs:
- Threading and synchronization: `include/CcpThread.h`, `include/CcpMutex.h`, `include/CcpSemaphore.h`; implementations include `CcpThread.cpp` and `CcpMutex.cpp`.
- Process, time, and files: `include/CcpProcess.h`, `include/CcpTime.h`, `include/CcpFileUtils.h`; implementations include `CcpProcess.cpp` and `CcpFileUtils.cpp`.
- String conversion has platform-specific implementation paths in `StringConversions.cpp` and `StringConversions.mm`, the latter materially indicating macOS/Objective-C++ integration.

#### Diagnostics, Failure, and Telemetry
Diagnostic infrastructure includes assertions, logging, call stacks, crash-reporting interfaces, statistics, and telemetry. Key boundaries are `include/CCPAssert.h`, `include/CCPLog.h`, `include/CCPCallstack.h`, `include/ICrashReporter.h`, `include/CcpStatistics.h`, and `include/CcpTelemetry.h`; corresponding runtime implementations include `CCPAssert.cpp`, `CCPLog.cpp`, `CCPCallstack.cpp`, `CcpStatistics.cpp`, and `CcpTelemetry.cpp`. Crash reporting is abstracted through an interface rather than binding this repository to a named external crash service.

#### Memory and Utility Primitives
Memory allocation/tracking and reusable data-structure utilities form another foundational layer. Main APIs are `include/CCPMemory.h`, `include/CCPMemoryTracker.h`, `include/CachedAllocator.h`, `include/CcpAtomic.h`, and `include/CcpPairingHeap.h`, backed by `CCPMemory.cpp`, `CCPMemoryTracker.cpp`, and `CcpMemoryTrackerMutex.h`. Hashing and secure CRT wrappers are separate core utilities in `include/CCPHash.h`, `include/CcpSecureCrt.h`, `CCPHash.cpp`, and `CcpSecureCrt.cpp`.

#### Build, Packaging, and Dependencies
CMake defines targets, configurations, installation, and package export behavior through `CMakeLists.txt` and central modules such as `cmake/CcpBuildConfigurations.cmake`, `cmake/CcpTargetConfigurations.cmake`, and `cmake/CcpPackageConfigHelpers.cmake`. Dependency resolution uses vcpkg manifests: `vcpkg.json` and `vcpkg-configuration.json`. The `vendor/` directory is a potential vendored-dependency boundary, but its contents are not represented in the supplied tree.

#### CI and Documentation
TeamCity is the material CI system, configured under `.teamcity/`, including universal-build and Perforce publishing workflows in `.teamcity/_Self.kt/buildTypes/CreateUniversalBuilds.kt` and `.teamcity/_Self.kt/buildTypes/PublishToPerforce.kt`. Documentation is generated as part of CMake installation when enabled, using Doxygen configuration in `doc/Doxyfile.in` and CMake integration in `cmake/CcpDocsGenerator.cmake`; its published entry is `documentation/index.html`.

Main entry points: [`CMakeLists.txt`](https://github.com/carbonengine/core/blob/main/CMakeLists.txt) (CMake Build), [`CcpCore.cpp`](https://github.com/carbonengine/core/blob/main/CcpCore.cpp) (Core Runtime), [`include/CCPAssert.h`](https://github.com/carbonengine/core/blob/main/include/CCPAssert.h) (Diagnostic APIs), [`include/CcpCore.h`](https://github.com/carbonengine/core/blob/main/include/CcpCore.h) (Public Core API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Build &amp; Packaging"]
  node_presets["Build Profiles<br/>CMake presets<br/>[CMakePresets.json]"]
  node_cmake["CMake Build<br/>build definition<br/>[CMakeLists.txt]"]
  node_cmake_modules["CMake Modules<br/>build modules"]
  node_vcpkg["Dependency Resolution<br/>vcpkg manifest<br/>[vcpkg.json]"]
  node_package_config["Package Metadata<br/>CMake package config"]
end

subgraph group_core["Core Library"]
  node_public_api{{"Public Core API<br/>exported C++ headers<br/>[CcpCore.h]"}}
  node_core_runtime["Core Runtime<br/>C++ implementation<br/>[CcpCore.cpp]"]
  node_memory_utils["Memory &amp; Utilities<br/>core primitives<br/>[CCPMemory.h]"]
end

subgraph group_platform["Platform Abstractions"]
  node_platform_api{{"System Abstractions<br/>cross-platform APIs<br/>[CcpThread.h]"}}
  node_platform_runtime["System Runtime<br/>C++ implementation<br/>[CcpThread.cpp]"]
  node_string_conversion["String Conversion<br/>platform implementation"]
end

subgraph group_diagnostics["Diagnostics"]
  node_diagnostic_api{{"Diagnostic APIs<br/>exported C++ headers<br/>[CCPAssert.h]"}}
  node_diagnostic_runtime["Diagnostic Runtime<br/>C++ implementation<br/>[CCPLog.cpp]"]
  node_crash_interface["Crash Reporter Interface<br/>abstraction<br/>[ICrashReporter.h]"]
end

subgraph group_delivery["CI &amp; Documentation"]
  node_teamcity["TeamCity Workflows<br/>CI workflows"]
  node_docs["Documentation Source<br/>Doxygen configuration<br/>[Doxyfile.in]"]
  node_doxygen["Documentation Build<br/>CMake documentation module"]
end

node_presets -->|"selects profiles"| node_cmake
node_cmake_modules -->|"configures"| node_cmake
node_vcpkg -->|"resolves dependencies for"| node_cmake
node_cmake -->|"exports"| node_public_api
node_cmake -->|"builds"| node_core_runtime
node_cmake -->|"installs"| node_package_config
node_public_api -->|"implemented by"| node_core_runtime
node_memory_utils -->|"supports"| node_core_runtime
node_platform_api -->|"implemented by"| node_platform_runtime
node_platform_runtime -.->|"uses platform path"| node_string_conversion
node_core_runtime -->|"uses"| node_platform_api
node_core_runtime -->|"uses"| node_diagnostic_api
node_diagnostic_api -->|"implemented by"| node_diagnostic_runtime
node_diagnostic_api -->|"abstracts through"| node_crash_interface
node_teamcity -->|"runs builds"| node_cmake
node_doxygen -->|"uses configuration"| node_docs
node_cmake -->|"invokes during install"| node_doxygen

click node_presets "https://github.com/carbonengine/core/blob/main/CMakePresets.json"
click node_cmake "https://github.com/carbonengine/core/blob/main/CMakeLists.txt"
click node_cmake_modules "https://github.com/carbonengine/core/blob/main/cmake/CcpBuildConfigurations.cmake"
click node_vcpkg "https://github.com/carbonengine/core/blob/main/vcpkg.json"
click node_package_config "https://github.com/carbonengine/core/blob/main/carbon-coreConfig.cmake"
click node_public_api "https://github.com/carbonengine/core/blob/main/include/CcpCore.h"
click node_core_runtime "https://github.com/carbonengine/core/blob/main/CcpCore.cpp"
click node_memory_utils "https://github.com/carbonengine/core/blob/main/include/CCPMemory.h"
click node_platform_api "https://github.com/carbonengine/core/blob/main/include/CcpThread.h"
click node_platform_runtime "https://github.com/carbonengine/core/blob/main/CcpThread.cpp"
click node_string_conversion "https://github.com/carbonengine/core/blob/main/StringConversions.mm"
click node_diagnostic_api "https://github.com/carbonengine/core/blob/main/include/CCPAssert.h"
click node_diagnostic_runtime "https://github.com/carbonengine/core/blob/main/CCPLog.cpp"
click node_crash_interface "https://github.com/carbonengine/core/blob/main/include/ICrashReporter.h"
click node_teamcity "https://github.com/carbonengine/core/blob/main/.teamcity/_Self.kt/buildTypes/CreateUniversalBuilds.kt"
click node_docs "https://github.com/carbonengine/core/blob/main/doc/Doxyfile.in"
click node_doxygen "https://github.com/carbonengine/core/blob/main/cmake/CcpDocsGenerator.cmake"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_presets,node_cmake,node_cmake_modules,node_vcpkg,node_package_config toneBlue
class node_public_api,node_core_runtime,node_memory_utils toneAmber
class node_platform_api,node_platform_runtime,node_string_conversion toneMint
class node_diagnostic_api,node_diagnostic_runtime,node_crash_interface toneRose
class node_teamcity,node_docs,node_doxygen toneIndigo
```

## Components

### Build & Packaging

- [Build Profiles](https://github.com/carbonengine/core/blob/main/CMakePresets.json): CMake presets · `CMakePresets.json`
- [CMake Build](https://github.com/carbonengine/core/blob/main/CMakeLists.txt): build definition · Defines targets, installation, and exports. · `CMakeLists.txt`
- [CMake Modules](https://github.com/carbonengine/core/blob/main/cmake/CcpBuildConfigurations.cmake): build modules · `cmake/CcpBuildConfigurations.cmake`
- [Dependency Resolution](https://github.com/carbonengine/core/blob/main/vcpkg.json): vcpkg manifest · `vcpkg.json`
- [Package Metadata](https://github.com/carbonengine/core/blob/main/carbon-coreConfig.cmake): CMake package config · `carbon-coreConfig.cmake`

### Core Library

- [Public Core API](https://github.com/carbonengine/core/blob/main/include/CcpCore.h): exported C++ headers · Consumer-facing umbrella and foundational definitions. · `include/CcpCore.h`
- [Core Runtime](https://github.com/carbonengine/core/blob/main/CcpCore.cpp): C++ implementation · `CcpCore.cpp`
- [Memory & Utilities](https://github.com/carbonengine/core/blob/main/include/CCPMemory.h): core primitives · Allocation, tracking, atomics, containers, hashing, and secure CRT wrappers. · `include/CCPMemory.h`

### Platform Abstractions

- [System Abstractions](https://github.com/carbonengine/core/blob/main/include/CcpThread.h): cross-platform APIs · Threads, synchronization, processes, time, and file utilities. · `include/CcpThread.h`
- [System Runtime](https://github.com/carbonengine/core/blob/main/CcpThread.cpp): C++ implementation · `CcpThread.cpp`
- [String Conversion](https://github.com/carbonengine/core/blob/main/StringConversions.mm): platform implementation · Uses Objective-C++ on macOS. · `StringConversions.mm`

### Diagnostics

- [Diagnostic APIs](https://github.com/carbonengine/core/blob/main/include/CCPAssert.h): exported C++ headers · Assertions, logs, call stacks, statistics, telemetry, and crash-reporting interface. · `include/CCPAssert.h`
- [Diagnostic Runtime](https://github.com/carbonengine/core/blob/main/CCPLog.cpp): C++ implementation · `CCPLog.cpp`
- [Crash Reporter Interface](https://github.com/carbonengine/core/blob/main/include/ICrashReporter.h): abstraction · Decouples crash reporting from a provider. · `include/ICrashReporter.h`

### CI & Documentation

- [TeamCity Workflows](https://github.com/carbonengine/core/blob/main/.teamcity/_Self.kt/buildTypes/CreateUniversalBuilds.kt): CI workflows · Builds universal artifacts and publishes to Perforce. · `.teamcity/_Self.kt/buildTypes/CreateUniversalBuilds.kt`
- [Documentation Source](https://github.com/carbonengine/core/blob/main/doc/Doxyfile.in): Doxygen configuration · `doc/Doxyfile.in`
- [Documentation Build](https://github.com/carbonengine/core/blob/main/cmake/CcpDocsGenerator.cmake): CMake documentation module · `cmake/CcpDocsGenerator.cmake`

## Connections

- Build Profiles → CMake Build: selects profiles
- CMake Modules → CMake Build: configures
- Dependency Resolution → CMake Build: resolves dependencies for
- CMake Build → Public Core API: exports
- CMake Build → Core Runtime: builds
- CMake Build → Package Metadata: installs
- Public Core API → Core Runtime: implemented by
- Memory & Utilities → Core Runtime: supports
- System Abstractions → System Runtime: implemented by
- System Runtime → String Conversion: uses platform path
- Core Runtime → System Abstractions: uses
- Core Runtime → Diagnostic APIs: uses
- Diagnostic APIs → Diagnostic Runtime: implemented by
- Diagnostic APIs → Crash Reporter Interface: abstracts through
- TeamCity Workflows → CMake Build: runs builds
- Documentation Build → Documentation Source: uses configuration
- CMake Build → Documentation Build: invokes during install
