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


orogen
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Sat Jun 8 2019 19:52:17