Module: OroGen::Gen::RTT_CPP::ConfigurationObjectGeneration

Included in:
AttributeGeneration, PropertyGeneration
Defined in:
lib/orogen/gen/tasks.rb

Instance Method Summary collapse

Instance Method Details

#cxx_default_valueObject

The property default value, formatted for as a C++ value



13
14
15
16
17
18
19
# File 'lib/orogen/gen/tasks.rb', line 13

def cxx_default_value
    if type < Typelib::EnumType
        type.namespace('::') + default_value.to_s
    else
        default_value.inspect
    end
end

#gen_dynamic_setterObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/orogen/gen/tasks.rb', line 21

def gen_dynamic_setter
    if dynamic? && (setter_operation.task == task)
        #Adding user method
        task.add_base_method("bool", "set#{name.capitalize}",setter_operation.argument_signature).
            body("  return true;")
        task.add_user_method("bool", "set#{name.capitalize}",setter_operation.argument_signature).
            body( " return(#{task.name}Base::set#{name.capitalize}(value));")

        #Adding user method cal to updateDynamicProperties
        task.add_code_to_base_method_before "updateDynamicProperties","        if(!set#{name.capitalize}(_#{name}.get())) return false;\n"

        setter_operation.base_body <<EOF
//      The following steps happen within the base Implementation:
//       if the task is not configured yet, update the classical property and return true
//       if the task is configured OR running so far, call the user method to update the value
//         if the user method return false, we return false too and do NOT update the classical value
        if(isConfigured()){
if(!set#{name.capitalize}(#{setter_operation.argument_signature(true,false)})){
    return false;
}
        }
        _#{name}.set(value);
        return true;
EOF
        setter_operation.hidden = true
    end
end