From 05836ac400a715e844b12e29b931618912263329 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 15 Jan 2024 16:27:53 +0100 Subject: [PATCH] Provide value_initializer to return the default possible set for default, not used by TAOX11 directly but used by CIAOX11 for the component executor generation * ridlbe/c++11/visitors/attribute.rb: --- ridlbe/c++11/visitors/attribute.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ridlbe/c++11/visitors/attribute.rb b/ridlbe/c++11/visitors/attribute.rb index 2ea8b72d..4b1e700e 100644 --- a/ridlbe/c++11/visitors/attribute.rb +++ b/ridlbe/c++11/visitors/attribute.rb @@ -120,6 +120,23 @@ def sendc_prefix_set sendc_prefix(false) end + def value_initializer + # When we have an annotation directly applied to this node we are using it + unless node.annotations[:default].first.nil? + "{#{node.annotations[:default].first.fields[:value]}}" + else + # Check whether it is a typedef, if so, we need to see if there is an annotation applied to the typedef (or its typedef) + res_idl_type = _idltype + while res_idl_type.is_a?(IDL::Type::ScopedName) + unless res_idl_type.node.annotations[:default].first.nil? + return "{#{res_idl_type.node.annotations[:default].first.fields[:value]}}" + end + res_idl_type = res_idl_type.node.idltype + end + _resolved_idltype.zero_initializer + end + end + # template mapping map_template :attribute, :attribute