00001
00002
00003 #ifndef <%= component.name.upcase %>_<%= task.basename.upcase %>_TASK_BASE_HPP
00004 #define <%= component.name.upcase %>_<%= task.basename.upcase %>_TASK_BASE_HPP
00005
00006 #include <string>
00007 #include <boost/cstdint.hpp>
00008 #include <<%= task.superclass.header_file %>>
00009 <% if !task.new_operations.empty? || task.superclass.name == "RTT::TaskContext" then %>#include <rtt/Operation.hpp><% end %>
00010 <% unless task.self_ports.empty? %>#include <rtt/Port.hpp><% end %>
00011
00012
00013 <% if task.extended_state_support? %>
00014 #include <<%= component.typekit.name %>/<%= component.name %>TaskStates.hpp>
00015 <% end %>
00016
00017
00018 <% task.used_typekits.each do |tk| %>
00019 <% next if tk.virtual? %>
00020 #include <<%= tk.name %>/Types.hpp>
00021 <% end %>
00022 <% task.implemented_classes.each do |class_name, include_file| %>
00023 #include <<%= include_file %>>
00024 <% end %>
00025 <% if component.typekit %>#include "<%= component.typekit.name %>/Types.hpp"<% end %>
00026
00027 <% code_before, code_after =
00028 task.base_header_code.partition(&:first)
00029 code_before.map! { |_, c| c.call }
00030 code_after.map! { |_, c| c.call }
00031 %>
00032
00033 <%= code_before.join("\n") %>
00034
00035 namespace <%= component.name %> {
00036 class <%= task.basename %>;
00043 class <%= task.basename %>Base : public ::<%= task.superclass.name %>
00044 <% task.implemented_classes.each do |class_name, _| %>
00045 , public <%= class_name %>
00046 <% end %>
00047 {
00048 protected:
00049
00050 <%= task.self_base_methods.
00051 sort_by(&:name).
00052 map { |m| m.with_indent(8, :declaration) }.
00053 compact.join("\n") %>
00054 <%= task.self_base_members.
00055 sort_by { |m| [m.kind, m.name] }.
00056 map { |m| m.with_indent(8, :declaration) }.
00057 compact.join("\n") %>
00058
00059 public:
00060 <% if extended_state_support? %>
00061 enum States
00062 {
00063 <% states = task.each_state.to_a
00064 states.each_with_index do |(state_name, state_type), i| %>
00065 <%= task.state_local_value_name(state_name, state_type) %> = <%= task.state_global_value_name(state_name, state_type) %><%= ',' if i != states.size - 1 %>
00066 <% end %>
00067 };
00068 <% end %>
00069
00070 <%= task.basename %>Base(std::string const& name<%= ", TaskCore::TaskState initial_state" unless task.fixed_initial_state? %>);
00071 ~<%= task.basename %>Base();
00072
00073 bool start();
00074
00075 <% if task.extended_state_support? && !task.superclass.extended_state_support? %>
00076
00077
00078 bool configure();
00079 bool recover();
00080 bool stop();
00081 bool cleanup();
00082 void error();
00083 void fatal();
00084 void exception();
00085 <% end %>
00086
00087 <% if task.extended_state_support? %>
00088 void state(States state);
00089 void error(States state);
00090 void fatal(States state);
00091 void exception(States state);
00092 States state() const;
00093 <% end %>
00094
00095 <% task.base_hook_code.keys.sort.each do |hook_name| %>
00096 <% snippets = task.base_hook_code[hook_name] %>
00097 <% next if snippets.empty? %>
00098 <% is_boolean = (hook_name == "start" || hook_name == "configure") %>
00099 <%= (is_boolean ? 'bool' : 'void') %> <%= hook_name %>Hook();
00100 <% end %>
00101 };
00102 }
00103
00104 <%= code_after.join("\n") %>
00105
00106 #endif
00107