From 2551fb7e8f41eb4ba05ad7e1a8e2fcb4dd2480b0 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Tue, 26 Nov 2024 15:43:32 +0100 Subject: [PATCH] Starter support for bitset * ridlbe/ccmx11/facets/dds/templates/idl/dds/bitset.erb: Added. * ridlbe/ccmx11/facets/dds/writers/ddsidl.rb: * ridlbe/ccmx11/visitors/import.rb: --- ridlbe/ccmx11/facets/dds/templates/idl/dds/bitset.erb | 11 +++++++++++ ridlbe/ccmx11/facets/dds/writers/ddsidl.rb | 7 ++++++- ridlbe/ccmx11/visitors/import.rb | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 ridlbe/ccmx11/facets/dds/templates/idl/dds/bitset.erb diff --git a/ridlbe/ccmx11/facets/dds/templates/idl/dds/bitset.erb b/ridlbe/ccmx11/facets/dds/templates/idl/dds/bitset.erb new file mode 100644 index 00000000..133c70c4 --- /dev/null +++ b/ridlbe/ccmx11/facets/dds/templates/idl/dds/bitset.erb @@ -0,0 +1,11 @@ + +// generated from <%= ridl_template_path %> +/// @copydoc <%= doc_scoped_name %> +% annotations.each do |_a| +<%= _a.idl_stringified %> +% end +%# todo bitfield annotations and type +bitset <%= unescaped_name %><% unless base.nil? %> : <%= base.unescaped_name %><% end %> { + <%= bitfields.collect {|e| "/// @copydoc #{e.doc_scoped_name}\n bitfield<#{e.bits}> #{e.name}" }.join(",\n ") %> +}; + diff --git a/ridlbe/ccmx11/facets/dds/writers/ddsidl.rb b/ridlbe/ccmx11/facets/dds/writers/ddsidl.rb index 08413f8e..3d335338 100644 --- a/ridlbe/ccmx11/facets/dds/writers/ddsidl.rb +++ b/ridlbe/ccmx11/facets/dds/writers/ddsidl.rb @@ -66,7 +66,12 @@ def visit_enum(node) def visit_bitmask(node) check_namespace_begin - visitor(BitMaskVisitor).visit_bitmask(node) + visitor(BitmaskVisitor).visit_bitmask(node) + end + + def visit_bitset(node) + check_namespace_begin + visitor(BitsetVisitor).visit_bitset(node) end def declare_union(node) diff --git a/ridlbe/ccmx11/visitors/import.rb b/ridlbe/ccmx11/visitors/import.rb index 09b8b36e..85af48f9 100644 --- a/ridlbe/ccmx11/visitors/import.rb +++ b/ridlbe/ccmx11/visitors/import.rb @@ -27,6 +27,7 @@ module CCMX11 SequenceVisitor = Cxx11::SequenceVisitor EnumVisitor = Cxx11::EnumVisitor BitmaskVisitor = Cxx11::BitmaskVisitor + BitsetVisitor = Cxx11::BitsetVisitor ArrayVisitor = Cxx11::ArrayVisitor TypedefVisitor = Cxx11::TypedefVisitor UnionVisitor = Cxx11::UnionVisitor