TaskBase.hpp
Go to the documentation of this file.
00001 /* Generated from orogen/lib/orogen/templates/tasks/TaskBase.hpp */
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.sort_by(&:name).each do |tk| %>
00019   <% next if tk.virtual? %>
00020 #include <<%= tk.name %>/Types.hpp>
00021 <% end %>
00022 <% task.implemented_classes.sort.each do |class_name, include_file| %>
00023 #include <<%= include_file %>> // to get <%= class_name %>
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.sort.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         // Common implementation of interface setup for both task constructors
00050         void setupComponentInterface();
00051 
00052 <%= task.self_base_methods.
00053     sort_by(&:name).
00054     map { |m| m.with_indent(8, :declaration) }.
00055     compact.join("\n") %>
00056 <%= task.self_base_members.
00057     sort_by { |m| [m.kind, m.name] }.
00058     map { |m| m.with_indent(8, :declaration) }.
00059     compact.join("\n") %>
00060 
00061     public:
00062         <% if extended_state_support? %>
00063         enum States
00064         {
00065             <% states = task.each_state.to_a
00066                states.each_with_index do |(state_name, state_type), i| %>
00067                 <%= task.state_local_value_name(state_name, state_type) %> = <%= task.state_global_value_name(state_name, state_type) %><%= ',' if i != states.size - 1 %>
00068             <% end %>
00069         };
00070         <% end %>
00071         
00072         <%= task.basename %>Base(std::string const& name<%= ", TaskCore::TaskState initial_state" unless task.fixed_initial_state? %>);
00073         <%= task.basename %>Base(std::string const& name, RTT::ExecutionEngine* engine<%= ", TaskCore::TaskState initial_state" unless task.fixed_initial_state? %>);
00074         ~<%= task.basename %>Base();
00075 
00076         bool start();
00077 
00078         <% if task.extended_state_support? && !task.superclass.extended_state_support? %>
00079         // Reimplement TaskCore base methods to export the states to the outside
00080         // world
00081         bool configure();
00082         bool recover();
00083         bool stop();
00084         bool cleanup();
00085         void error();
00086         void fatal();
00087         void exception();
00088         <% end %>
00089 
00090         <% if task.extended_state_support? %>
00091         void report(States state);
00092         void state(States state);
00093         void error(States state);
00094         void fatal(States state);
00095         void exception(States state);
00096         States state() const;
00097         <% end %>
00098 
00099 <% task.base_hook_code.keys.sort.each do |hook_name| %>
00100 <%    snippets = task.base_hook_code[hook_name] %>
00101 <%    next if snippets.empty? %>
00102 <%    is_boolean = (hook_name == "start" || hook_name == "configure") %>
00103         <%= (is_boolean ? 'bool' : 'void') %> <%= hook_name %>Hook();
00104 <% end %>
00105     };
00106 }
00107 
00108 <%= code_after.sort.join("\n") %>
00109 
00110 #endif
00111 


orogen
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Mon Oct 6 2014 03:17:29