# reflectcxx/reflectiontemplatelibrary-cpp architecture

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

- Interactive diagram: https://gitdiagram.com/reflectcxx/reflectiontemplatelibrary-cpp
- Repository: https://github.com/reflectcxx/reflectiontemplatelibrary-cpp

## Overview

RTL is a C++ run-time reflection library. Its principal workflow is to register user types and callables, discover them by name through CxxMirror, obtain metadata and build a signature-specific callable, then invoke it—optionally using RObject when the concrete target or return type is erased. The graph also captures object conversion and JSON output as supporting capabilities. The README documents these public flows; internal wiring beyond the sampled builder and access code is represented only where supported by that documentation.

Main entry points: [`ReflectionTemplateLib/rtl/inc/CxxMirror.h`](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/CxxMirror.h) (CxxMirror), [`ReflectionTemplateLib/rtl/rtl_constructor.h`](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/rtl_constructor.h) (Constructor API), [`ReflectionTemplateLib/rtl/dispatch/forward_call.h`](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/dispatch/forward_call.h) (Call dispatch), [`ReflectionTemplateLib/rtl/builder/Builder.h`](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/builder/Builder.h) (Registration builders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_registration["Registration"]
  node_builder["Registration builders<br/>[Builder.h]"]
end

subgraph group_discovery["Discovery"]
  node_mirror["CxxMirror<br/>[CxxMirror.h]"]
  node_record["Record metadata<br/>[Record.hpp]"]
  node_function_meta["Function metadata<br/>[Function.hpp]"]
  node_method_meta["Method metadata<br/>[Method.hpp]"]
end

subgraph group_invocation["Invocation"]
  node_function_api["Function callable API<br/>[Function.hpp]"]
  node_method_api["Method callable API<br/>[Method.hpp]"]
  node_constructor_api["Constructor API<br/>[rtl_constructor.h]"]
  node_dispatch["Call dispatch<br/>[forward_call.h]"]
end

subgraph group_objects["Objects and output"]
  node_robject["RObject<br/>[RObject.hpp]"]
  node_object_builder["RObject construction<br/>[RObjectBuilder.hpp]"]
  node_converters["Type conversion"]
  node_json["Mirror JSON output"]
end

node_caller(("C++ application"))
node_user_entities["User types and callables"]

node_caller -->|"registers via"| node_builder
node_builder -->|"binds pointers"| node_user_entities
node_builder -->|"supplies registrations"| node_mirror
node_caller -->|"queries names"| node_mirror
node_mirror -->|"returns type metadata"| node_record
node_mirror -->|"returns function metadata"| node_function_meta
node_record -->|"looks up methods"| node_method_meta
node_record -->|"provides constructors"| node_constructor_api
node_function_meta -->|"builds typed callable"| node_function_api
node_method_meta -->|"builds typed callable"| node_method_api
node_caller -->|"invokes callable"| node_function_api
node_caller -->|"binds and invokes"| node_method_api
node_caller -->|"constructs instance"| node_constructor_api
node_function_api -->|"dispatches call"| node_dispatch
node_method_api -->|"dispatches call"| node_dispatch
node_constructor_api -->|"dispatches construction"| node_dispatch
node_dispatch -->|"calls registered target"| node_user_entities
node_constructor_api -->|"creates managed object"| node_object_builder
node_object_builder -->|"produces wrapper"| node_robject
node_robject -->|"views or converts"| node_converters
node_caller -->|"uses erased values"| node_robject
node_caller -->|"serializes mirror"| node_json
node_json -->|"reads reflection data"| node_mirror

click node_builder "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/builder/Builder.h"
click node_mirror "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/CxxMirror.h"
click node_record "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Record.hpp"
click node_function_meta "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Function.hpp"
click node_method_meta "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Method.hpp"
click node_function_api "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Function.hpp"
click node_method_api "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Method.hpp"
click node_constructor_api "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/rtl_constructor.h"
click node_dispatch "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/dispatch/forward_call.h"
click node_robject "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/RObject.hpp"
click node_object_builder "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/detail/inc/RObjectBuilder.hpp"
click node_converters "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/detail/src/RObjectConverters_string.cpp"
click node_json "https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/src/CxxMirrorToJson.cpp"

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_builder,node_user_entities toneBlue
class node_mirror,node_record,node_function_meta,node_method_meta toneAmber
class node_function_api,node_method_api,node_constructor_api,node_dispatch toneMint
class node_robject,node_object_builder,node_converters,node_json toneRose
class node_caller toneIndigo
```

## Components

### Registration

- [Registration builders](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/builder/Builder.h): `ReflectionTemplateLib/rtl/builder/Builder.h`

### Discovery

- [CxxMirror](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/CxxMirror.h): `ReflectionTemplateLib/rtl/inc/CxxMirror.h`
- [Record metadata](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Record.hpp): `ReflectionTemplateLib/rtl/inc/Record.hpp`
- [Function metadata](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Function.hpp): `ReflectionTemplateLib/rtl/inc/Function.hpp`
- [Method metadata](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Method.hpp): `ReflectionTemplateLib/rtl/inc/Method.hpp`

### Invocation

- [Function callable API](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Function.hpp): `ReflectionTemplateLib/rtl/inc/Function.hpp`
- [Method callable API](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/Method.hpp): `ReflectionTemplateLib/rtl/inc/Method.hpp`
- [Constructor API](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/rtl_constructor.h): `ReflectionTemplateLib/rtl/rtl_constructor.h`
- [Call dispatch](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/dispatch/forward_call.h): `ReflectionTemplateLib/rtl/dispatch/forward_call.h`

### Objects and output

- [RObject](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/inc/RObject.hpp): `ReflectionTemplateLib/rtl/inc/RObject.hpp`
- [RObject construction](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/detail/inc/RObjectBuilder.hpp): `ReflectionTemplateLib/rtl/detail/inc/RObjectBuilder.hpp`
- [Type conversion](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/detail/src/RObjectConverters_string.cpp): `ReflectionTemplateLib/rtl/detail/src/RObjectConverters_string.cpp`
- [Mirror JSON output](https://github.com/reflectcxx/reflectiontemplatelibrary-cpp/blob/release/ReflectionTemplateLib/rtl/src/CxxMirrorToJson.cpp): `ReflectionTemplateLib/rtl/src/CxxMirrorToJson.cpp`

### Other components

- **C++ application**
- **User types and callables**

## Connections

- C++ application → Registration builders: registers via
- Registration builders → User types and callables: binds pointers
- Registration builders → CxxMirror: supplies registrations
- C++ application → CxxMirror: queries names
- CxxMirror → Record metadata: returns type metadata
- CxxMirror → Function metadata: returns function metadata
- Record metadata → Method metadata: looks up methods
- Record metadata → Constructor API: provides constructors
- Function metadata → Function callable API: builds typed callable
- Method metadata → Method callable API: builds typed callable
- C++ application → Function callable API: invokes callable
- C++ application → Method callable API: binds and invokes
- C++ application → Constructor API: constructs instance
- Function callable API → Call dispatch: dispatches call
- Method callable API → Call dispatch: dispatches call
- Constructor API → Call dispatch: dispatches construction
- Call dispatch → User types and callables: calls registered target
- Constructor API → RObject construction: creates managed object
- RObject construction → RObject: produces wrapper
- RObject → Type conversion: views or converts
- C++ application → RObject: uses erased values
- C++ application → Mirror JSON output: serializes mirror
- Mirror JSON output → CxxMirror: reads reflection data
