welder 0.1.0
Bindings for annotated C++ types, from C++26 reflection
Loading...
Searching...
No Matches
rod.hpp File Reference

welder opaque-container generator rod (header-only, text-emitting). More...

#include <array>
#include <cstddef>
#include <meta>
#include <ostream>
#include <string>
#include <type_traits>
#include <utility>
#include <welder/welder.hpp>
#include <welder/rods/python/opaque_containers/document.hpp>
#include <welder/rods/python/opaque_containers/marks.hpp>
Include dependency graph for rod.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  welder::rods::opaque_containers::rod
 The opaque-container generator rod (satisfies welder::rod). More...
struct  welder::rods::opaque_containers::rod::module_handle
 A copyable handle onto the growing document threaded through every emission primitive (the rod's module_type). More...
struct  welder::rods::opaque_containers::rod::class_handle
 The per-class handle: it carries the document so the per-member hooks (add_field / add_method / …) can collect from members and signatures. More...
struct  welder::rods::opaque_containers::rod::enum_handle
 The enum handle — enums use no containers, so it carries nothing. More...
struct  welder::rods::opaque_containers::rod::session
 No deferred module state. More...

Namespaces

namespace  welder
namespace  welder::rods
namespace  welder::rods::opaque_containers

Detailed Description

welder opaque-container generator rod (header-only, text-emitting).

A build-time rod that reflects the welded types in a namespace, finds the STL containers they use (std::vector/std::map/std::unordered_map — see <welder/containers.hpp>), and emits a .hpp that binds them opaque / by reference: the WELDER_OPAQUE(...) declarations (global scope) plus welded aliases (in the namespace), so the user never hand-writes that boilerplate. It is the exact model of the trampoline / LuaCATS generators — a real welder::rod that plugs the same driver but emits source text instead of registering a live module, so member selection, base flattening and marks are reused verbatim.

Every reference container a welded type uses is opened by reference by default (the trampoline generator's zero-opt-in philosophy — all of them); opt a data member's container type out with [[=welder::rods::python::by_value]] (marks.hpp). Names are derived (std::vector<int>VectorInt).

Use WELDER_OPAQUE_CONTAINERS_MAIN(ns) (this directory's module.hpp) for the generator main(), and welder_generate_opaque_containers() (CMake) to build and run it. The consuming TU includes the active backend's rod.hpp (which defines WELDER_OPAQUE), then the generated header, before welding the namespace.

Requires the welder vocabulary first (#include <welder/vocabulary.hpp>).

Definition in file rod.hpp.