xo-expression2/xo-facet
2026-02-16 22:43:24 -05:00
..
cmake xo-facet: + to_facet() convenience method on obj<A,D> 2026-02-04 16:23:55 -05:00
codegen xo-gc xo-cmake: simplify idl -> *.*pp codegen 2026-02-16 22:43:24 -05:00
docs xo-facet: runtime facet lookup [PROTO] 2026-01-09 10:07:20 -05:00
include/xo/facet xo-expression2 stack: expand MemorySizeInfo w/ per-type detail 2026-02-16 00:48:00 -05:00
utest xo-facet: + FacetRegistry tidy 2026-01-08 19:46:32 -05:00
CMakeLists.txt xo-facet: + builtin _drop() method for poly dtor call 2026-02-04 16:22:39 -05:00
README.md + xo-printable2 + build fixes for cmake config 2026-01-04 23:03:18 -05:00

xo-facet

Codegen

To scaffold a new facet Foo we need several c++ classes

  • AFoo abstract FOMO interface, with opaque data pointer
  • IFoo_Any variant placeholder, all methods terminate
  • IFoo_Xfer template, delegates methods to a separate implementation class
  • RFoo template, inherits from a 2x-wide fat pointer (iface+data).

These classes all have parallel methods Can generate these as follows:

  1. write xo-foo/idl/Foo.json5.

    Supply attributes:

    • mode :: string
    • includes :: [string]
    • namespace1 :: string
    • namespace2 :: string
    • facet :: string
    • detail_subdir :: string
    • brief :: string
    • using_doxygen :: bool
    • doc :: [string]
    • types :: [{name, doc, definition}]
    • const_methods :: [{name, doc, return_type, args, const, noexcept, attributes}]
    • nonconst_methods :: [{name, doc, return_type, args, const, noexcept, attributes}]

Example in xo-object2/idl/Sequence.json5

  1. generate:
$ cd xo-foo
$ ../xo-facet/codegen/genfacet.py --input ./idl/Foo.json5 --output include/xo/foo2

Alternatively in xo-foo/CMakeLists.txt

xo_add_genfacet(
    TARGET xo-foo2-facet-foo
    FACET Foo
    INPUT idl/Foo.json5
    OUTPUT_HTTP_DIR include/xo/foo2
    OUTPUT_IMPL_SUBDIR detail
    OUTPUT_CPP_DIR src/foo2)

then generate with:

cmake --build path/to/build -- xo-foo2-facet-foo