Skip to content

Commit

Permalink
Merge pull request #383 from jwillemsen/jwi-minimizeservantcode
Browse files Browse the repository at this point in the history
Reduce includes, don't generate empty servant_traits namespace
  • Loading branch information
jwillemsen authored May 3, 2024
2 parents 69a582d + a8d0416 commit 67d120e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion ridlbe/c++11/templates/srv/hdr/pre.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
% else
#include "<%= client_header %>"
% end

% includes.each do |incfile|
#include "<%= incfile %>"
% end
Expand Down
13 changes: 11 additions & 2 deletions ridlbe/c++11/writers/servantheader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ServantHeaderWriter < ServantHeaderBaseWriter
def initialize(output = STDOUT, opts = {})
super
@include_guard = "__RIDL_#{File.basename(params[:srv_output_hdr] || '').to_random_include_guard}_INCLUDED__"
@servant_traits = false
end

def pre_visit(parser)
Expand All @@ -42,7 +43,7 @@ def post_visit(parser)
end

# Servant traits specializations
visit_servant_traits_specializations(parser)
visit_servant_traits_specializations(parser) if @servant_traits

super
visitor(PostVisitor).visit
Expand Down Expand Up @@ -75,6 +76,8 @@ def leave_module(node)
def enter_interface(node)
return if node.is_local? || node.is_abstract?

@servant_traits = true

super
visitor(InterfaceVisitor).visit_pre(node)
inc_nest # POA
Expand All @@ -94,6 +97,8 @@ def enter_valuetype(node)
super
return if node.is_local? || !node.supports_concrete_interface?

@servant_traits = true

visitor(ValuetypeVisitor).visit_pre(node)
end

Expand Down Expand Up @@ -132,11 +137,15 @@ class ServantHeaderIncludeWriter < ServantHeaderBaseWriter
def initialize(output = STDOUT, opts = {})
super
@includes = []
@includes << 'tao/x11/portable_server/servantbase.h' unless params[:no_servant_code]
end

attr_reader :includes

def enter_interface(node)
@includes << 'tao/x11/portable_server/servantbase.h' unless params[:no_servant_code]
super
end

def post_visit(_parser)
properties[:includes] = @includes

Expand Down
3 changes: 1 addition & 2 deletions ridlbe/c++11/writers/stubproxyheader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ def initialize(output = STDOUT, opts = {})
super
@default_pre_includes = []
@default_post_includes = []
@object_varout = false
end

@object_varout = false

def visit_nodes(parser)
@include_guard = "__RIDL_#{File.basename(params[:output_stub_proxy_header] || '').to_random_include_guard}_INCLUDED__"
super
Expand Down

0 comments on commit 67d120e

Please sign in to comment.