<commit_before>#ifndef <%= component.name.upcase %>_<%= task.basename.upcase %>_TASK_BASE_HPP
#define <%= component.name.upcase %>_<%= task.basename.upcase %>_TASK_BASE_HPP

#include <string>
#include <boost/cstdint.hpp>
#include <<%= task.superclass.header_file %>>
<% unless task.self_methods.empty? %>#include <rtt/Method.hpp><% end %>
<% unless task.self_commands.empty? %>#include <rtt/Command.hpp><% end %>
<% unless task.self_ports.empty? %>#include <rtt/Ports.hpp><% end %>


<% if task.extended_state_support? %>
#include <<%= component.name %>/<%= component.name %>TaskStates.hpp>
<% end %>


<% task.used_toolkits.each do |tk| %>
#include <toolkit/<%= tk.name %>ToolkitTypes.hpp>
<% end %>
<% task.implemented_classes.each do |class_name, include_file| %>
#include <<%= include_file %>> // to get <%= class_name %>
<% end %>
<% if component.toolkit %>#include "toolkit/<%= component.name %>ToolkitTypes.hpp"<% end %>


namespace <%= component.name %> {
    class <%= task.basename %>;
    class <%= task.basename %>Base : public <%= task.superclass.name %>
        <% task.implemented_classes.each do |class_name, _| %>
        , public <%= class_name %>
        <% end %>
    {
    protected:
    <% unless task.self_methods.empty? && task.self_commands.empty? %>
	<%= task.basename %>& _self;
    <% end %>

	<% unless task.self_properties.empty? %>/** Properties */<% end %>
    <% task.self_properties.each do |prop| %>
	RTT::Property< <%= prop.type.cxx_name %> > _<%= prop.name %>;
    <% end %>

	<% unless task.self_ports.empty? %>/** Ports */<% end %>
    <% task.self_ports.each do |port| %>
	<%= port.orocos_class %>< <%= port.type.cxx_name %> > _<%= port.name %>;
    <% end %>

	<% unless task.self_methods.empty? %>/** Methods */<% end %>
    <% task.self_methods.each do |meth| %>
	RTT::Method< <%= meth.signature(false) %> > _<%= meth.name %>;
    <% end %>

	<% unless task.self_commands.empty? %>/** Commands */<% end %>
    <% task.self_commands.each do |cmd| %>
	RTT::Command< bool<%= cmd.work_signature(false) %> > _<%= cmd.name %>;
    <% end %>

    public:
        <% if extended_state_support? %>
        enum States
        {
            <% states = task.each_state.to_a
               states.each_with_index do |(state_name, state_type), i| %>
                <%= task.state_local_value_name(state_name, state_type) %> = <%= task.state_global_value_name(state_name, state_type) %><%= ',' if i != states.size - 1 %>
            <% end %>
        };
        <% end %>
        
	<%= task.basename %>Base(std::string const& name<%= ", TaskCore::TaskState initial_state" unless task.fixed_initial_state? %>);

        <% if task.extended_state_support? && !task.superclass.extended_state_support? %>
        // Reimplement TaskCore base methods to export the states to the outside
        // world
        bool configure();
        bool activate();
        bool start();
        void warning();
        void recovered();
        bool stop();
        bool cleanup();
        bool resetError();
        <% end %>

        <% if task.extended_state_support? %>
        void state(States state);
        void error(States state);
        void fatal(States state);
        <%= task.state_type_name %> state() const;
        <% end %>
    };
}

#endif

<commit_msg>add default arguments to error() and fatal()<commit_after>#ifndef <%= component.name.upcase %>_<%= task.basename.upcase %>_TASK_BASE_HPP
#define <%= component.name.upcase %>_<%= task.basename.upcase %>_TASK_BASE_HPP

#include <string>
#include <boost/cstdint.hpp>
#include <<%= task.superclass.header_file %>>
<% unless task.self_methods.empty? %>#include <rtt/Method.hpp><% end %>
<% unless task.self_commands.empty? %>#include <rtt/Command.hpp><% end %>
<% unless task.self_ports.empty? %>#include <rtt/Ports.hpp><% end %>


<% if task.extended_state_support? %>
#include <<%= component.name %>/<%= component.name %>TaskStates.hpp>
<% end %>


<% task.used_toolkits.each do |tk| %>
#include <toolkit/<%= tk.name %>ToolkitTypes.hpp>
<% end %>
<% task.implemented_classes.each do |class_name, include_file| %>
#include <<%= include_file %>> // to get <%= class_name %>
<% end %>
<% if component.toolkit %>#include "toolkit/<%= component.name %>ToolkitTypes.hpp"<% end %>


namespace <%= component.name %> {
    class <%= task.basename %>;
    class <%= task.basename %>Base : public <%= task.superclass.name %>
        <% task.implemented_classes.each do |class_name, _| %>
        , public <%= class_name %>
        <% end %>
    {
    protected:
    <% unless task.self_methods.empty? && task.self_commands.empty? %>
	<%= task.basename %>& _self;
    <% end %>

	<% unless task.self_properties.empty? %>/** Properties */<% end %>
    <% task.self_properties.each do |prop| %>
	RTT::Property< <%= prop.type.cxx_name %> > _<%= prop.name %>;
    <% end %>

	<% unless task.self_ports.empty? %>/** Ports */<% end %>
    <% task.self_ports.each do |port| %>
	<%= port.orocos_class %>< <%= port.type.cxx_name %> > _<%= port.name %>;
    <% end %>

	<% unless task.self_methods.empty? %>/** Methods */<% end %>
    <% task.self_methods.each do |meth| %>
	RTT::Method< <%= meth.signature(false) %> > _<%= meth.name %>;
    <% end %>

	<% unless task.self_commands.empty? %>/** Commands */<% end %>
    <% task.self_commands.each do |cmd| %>
	RTT::Command< bool<%= cmd.work_signature(false) %> > _<%= cmd.name %>;
    <% end %>

    public:
        <% if extended_state_support? %>
        enum States
        {
            <% states = task.each_state.to_a
               states.each_with_index do |(state_name, state_type), i| %>
                <%= task.state_local_value_name(state_name, state_type) %> = <%= task.state_global_value_name(state_name, state_type) %><%= ',' if i != states.size - 1 %>
            <% end %>
        };
        <% end %>
        
	<%= task.basename %>Base(std::string const& name<%= ", TaskCore::TaskState initial_state" unless task.fixed_initial_state? %>);

        <% if task.extended_state_support? && !task.superclass.extended_state_support? %>
        // Reimplement TaskCore base methods to export the states to the outside
        // world
        bool configure();
        bool activate();
        bool start();
        void warning();
        void recovered();
        bool stop();
        bool cleanup();
        bool resetError();
        <% end %>

        <% if task.extended_state_support? %>
        void state(States state);
        void error(States state = RUNTIME_ERROR);
        void fatal(States state = FATAL_ERROR);
        <%= task.state_type_name %> state() const;
        <% end %>
    };
}

#endif


{'fraction_non_alphanumeric': 0.18816799638717446, 'fraction_numerical': 0.0003010687942194792, 'mean_word_length': 3.0048221820373717, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 0, '>': 177, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '397539', 'n_tokens_mistral': 2445, 'n_tokens_neox': 2111, 'n_words': 420}