From 25de1e30ef385fac8282b90fa23447beb115d496 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 25 Dec 2025 13:02:56 -0500 Subject: [PATCH] xo-facet: support facet files in separate subdir --- xo-facet/codegen/facet.hpp.j2 | 8 +-- xo-facet/codegen/genfacet.py | 14 ++-- xo-object2/include/xo/object2/ASequence.hpp | 75 --------------------- 3 files changed, 14 insertions(+), 83 deletions(-) delete mode 100644 xo-object2/include/xo/object2/ASequence.hpp diff --git a/xo-facet/codegen/facet.hpp.j2 b/xo-facet/codegen/facet.hpp.j2 index 324d4b03..2eeaa5df 100644 --- a/xo-facet/codegen/facet.hpp.j2 +++ b/xo-facet/codegen/facet.hpp.j2 @@ -13,9 +13,9 @@ #pragma once -#include "{{abstract_facet_fname}}" -#include "{{iface_facet_any_hpp_fname}}" -#include "{{iface_facet_xfer_hpp_fname}}" -#include "{{router_facet_hpp_fname}}" +#include "{{impl_hpp_subdir}}/{{abstract_facet_fname}}" +#include "{{impl_hpp_subdir}}/{{iface_facet_any_hpp_fname}}" +#include "{{impl_hpp_subdir}}/{{iface_facet_xfer_hpp_fname}}" +#include "{{impl_hpp_subdir}}/{{router_facet_hpp_fname}}" /* end {{facet_hpp_fname}} */ diff --git a/xo-facet/codegen/genfacet.py b/xo-facet/codegen/genfacet.py index 50ea826c..d45dc703 100755 --- a/xo-facet/codegen/genfacet.py +++ b/xo-facet/codegen/genfacet.py @@ -55,6 +55,7 @@ def format_args_routing(args): def main(): parser = argparse.ArgumentParser() parser.add_argument('--input', required=True, help='input IDL JSON5 file') + parser.add_argument('--output-impl-hpp', required=True, help='.hpp detail subdir') parser.add_argument('--output-hpp', required=True, help='.hpp output directory') parser.add_argument('--output-cpp', required=True, help='.cpp output directory') @@ -66,6 +67,10 @@ def main(): output_hpp_dir = Path(args.output_hpp) output_hpp_dir.mkdir(parents=False, exist_ok=True) # + output_impl_hpp_subdir = Path(args.output_impl_hpp) + output_impl_hpp_dir = Path(args.output_hpp) / output_impl_hpp_subdir + output_impl_hpp_dir.mkdir(parents=False, exist_ok=True) + # output_cpp_dir = Path(args.output_cpp) output_cpp_dir.mkdir(parents=False, exist_ok=True) @@ -147,6 +152,7 @@ def main(): 'genfacet': __file__, 'genfacet_input': args.input, 'using_dox': using_dox, + 'impl_hpp_subdir': output_impl_hpp_subdir, # 'facet_hpp_j2': 'facet.hpp.j2', 'facet_includes': facet_includes, @@ -193,15 +199,15 @@ def main(): templates = {} templates[facet_hpp_fname] = [output_hpp_dir, context['facet_hpp_j2']] - templates[abstract_facet_fname] = [output_hpp_dir, + templates[abstract_facet_fname] = [output_impl_hpp_dir, context['abstract_facet_hpp_j2']] - templates[iface_facet_any_hpp_fname] = [output_hpp_dir, + templates[iface_facet_any_hpp_fname] = [output_impl_hpp_dir, context['iface_facet_any_hpp_j2']] templates[iface_facet_any_cpp_fname] = [output_cpp_dir, context['iface_facet_any_cpp_j2']] - templates[iface_facet_xfer_hpp_fname] = [output_hpp_dir, + templates[iface_facet_xfer_hpp_fname] = [output_impl_hpp_dir, context['iface_facet_xfer_hpp_j2']] - templates[router_facet_hpp_fname] = [output_hpp_dir, + templates[router_facet_hpp_fname] = [output_impl_hpp_dir, context['router_facet_hpp_j2']] for out_file, record in templates.items(): diff --git a/xo-object2/include/xo/object2/ASequence.hpp b/xo-object2/include/xo/object2/ASequence.hpp deleted file mode 100644 index 4c4c806c..00000000 --- a/xo-object2/include/xo/object2/ASequence.hpp +++ /dev/null @@ -1,75 +0,0 @@ -/** @file ASequence.hpp - * - * Generated automagically from ingredients: - * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-object2/../xo-facet/codegen/genfacet.py] - * arguments: - * --input [./idl/Sequence.json5] - * 2. jinja2 template for abstract facet .hpp file: - * [abstract_facet.hpp.j2] - * 3. idl for facet methods - * [./idl/Sequence.json5] - **/ - -#pragma once - -// includes (via {facet_includes}) -#include -#include -#include -#include - -namespace xo { -namespace scm { - -using Copaque = const void *; -using Opaque = void *; - -/** -Elements appear in some determinstic order. -Sequence is GC-aware --> elements must be GC-aware -**/ -class ASequence { -public: - /** @defgroup scm-sequence-type-traits **/ - ///@{ - // types - /** type for length of a sequence **/ - using size_type = std::size_t; - /** facet for types with GC support **/ - using AGCObject = xo::mm::AGCObject; - ///@} - - /** @defgroup scm-sequence-methods **/ - ///@{ - // const methods - /** RTTI: unique id# for actual runtime data representation **/ - virtual int32_t _typeseq() const noexcept = 0; - /** true iff sequence is empty **/ - virtual bool is_empty(Copaque data) const noexcept = 0; - /** true iff sequence is finite **/ - virtual bool is_finite(Copaque data) const noexcept = 0; - /** return element @p index of this sequence **/ - virtual obj at(Copaque data, size_type index) const = 0; - - // nonconst methods - ///@} -}; /*ASequence*/ - -/** Implementation ISequence_DRepr of ASequence for state DRepr - * should provide a specialization: - * - * template <> - * struct xo::facet::FacetImplementation { - * using Impltype = ISequence_DRepr; - * }; - * - * then ISequence_ImplType --> ISequence_DRepr - **/ -template -using ISequence_ImplType = xo::facet::FacetImplType; - -} /*namespace scm*/ -} /*namespace xo*/ - -/* */ \ No newline at end of file