Class: OroGen::Gen::RTT_CPP::TaskContextGeneration::GeneratedMethod
- Inherits:
-
GeneratedObject
- Object
- GeneratedObject
- OroGen::Gen::RTT_CPP::TaskContextGeneration::GeneratedMethod
- Defined in:
- lib/orogen/gen/tasks.rb
Overview
Represents a method definition/declaration in the generated code
This is mainly meant for plugins
See also #in_base_hook to add code to the hooks
Instance Attribute Summary collapse
-
#in_base ⇒ Object
Returns the value of attribute in_base.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
-
#signature ⇒ Object
readonly
Returns the value of attribute signature.
Attributes inherited from GeneratedObject
Instance Method Summary collapse
- #generate_declaration ⇒ Object
- #generate_definition ⇒ Object
-
#initialize(task, return_type, name, signature) ⇒ GeneratedMethod
constructor
A new instance of GeneratedMethod.
Methods inherited from GeneratedObject
code_snippet, #doc, #with_indent
Constructor Details
#initialize(task, return_type, name, signature) ⇒ GeneratedMethod
Returns a new instance of GeneratedMethod
813 814 815 816 817 818 819 |
# File 'lib/orogen/gen/tasks.rb', line 813 def initialize(task, return_type, name, signature) super(task) @return_type = return_type @name = name @signature = signature end |
Instance Attribute Details
#in_base ⇒ Object
Returns the value of attribute in_base
807 808 809 |
# File 'lib/orogen/gen/tasks.rb', line 807 def in_base @in_base end |
#name ⇒ Object (readonly)
Returns the value of attribute name
810 811 812 |
# File 'lib/orogen/gen/tasks.rb', line 810 def name @name end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type
809 810 811 |
# File 'lib/orogen/gen/tasks.rb', line 809 def return_type @return_type end |
#signature ⇒ Object (readonly)
Returns the value of attribute signature
811 812 813 |
# File 'lib/orogen/gen/tasks.rb', line 811 def signature @signature end |
Instance Method Details
#generate_declaration ⇒ Object
823 824 825 826 827 828 829 830 831 832 |
# File 'lib/orogen/gen/tasks.rb', line 823 def generate_declaration decl = "virtual #{return_type} #{name}(#{signature})" if doc decl = "#{doc} */\n#{decl}" end if !body decl = "#{decl} = 0" end "#{decl};" end |
#generate_definition ⇒ Object
834 835 836 837 838 839 840 841 |
# File 'lib/orogen/gen/tasks.rb', line 834 def generate_definition if body "#{return_type} #{task.basename}#{'Base' if in_base}::#{name}(#{signature})\n" + "{\n" + generate_body + "\n}" end end |