def include.genpy.generator._module_name | ( | type_name | ) | [private] |
:param type_name str: Name of message type sans package, e.g. 'String' :returns str: name of python module for auto-generated code
Definition at line 905 of file generator.py.
def include.genpy.generator._remap_reserved | ( | field_name | ) | [private] |
Map field_name to a python-safe representation, if necessary :param field_name: msg field name, ``str`` :returns: remapped name, ``str``
Definition at line 202 of file generator.py.
def include.genpy.generator.array_serializer_generator | ( | msg_context, | |
package, | |||
type_, | |||
name, | |||
serialize, | |||
is_numpy | |||
) |
Generator for array types :raises: :exc:`MsgGenerationException` If array spec is invalid
Definition at line 452 of file generator.py.
def include.genpy.generator.complex_serializer_generator | ( | msg_context, | |
package, | |||
type_, | |||
name, | |||
serialize, | |||
is_numpy | |||
) |
Generator for serializing complex type :param serialize: if True, generate serialization code. Otherwise, deserialization code. ``bool`` :param is_numpy: if True, generate serializer code for numpy datatypes instead of Python lists, ``bool`` :raises: MsgGenerationException If type is not a valid
Definition at line 548 of file generator.py.
def include.genpy.generator.compute_constructor | ( | msg_context, | |
package, | |||
type_ | |||
) |
Compute python constructor expression for specified message type implementation :param package str: package that type is being imported into. Used to resolve type_ if package is not specified. ``str`` :param type_: message type, ``str``
Definition at line 233 of file generator.py.
def include.genpy.generator.compute_full_text_escaped | ( | msg_context, | |
spec | |||
) |
Same as genmsg.compute_full_text, except that the resulting text is escaped to be safe for Python's triple-quote string quoting :param get_deps_dict: dictionary returned by load_dependencies call, ``dict`` :returns: concatenated text for msg/srv file and embedded msg/srv types. Text will be escaped for triple-quote, ``str``
Definition at line 306 of file generator.py.
def include.genpy.generator.compute_import | ( | msg_context, | |
package, | |||
type_ | |||
) |
Compute python import statement for specified message type implementation :param package: package that type is being imported into, ``str`` :param type_: message type (package resource name), ``str`` :returns: list of import statements (no newline) required to use type_ from package, ``[str]``
Definition at line 266 of file generator.py.
def include.genpy.generator.compute_outfile_name | ( | outdir, | |
infile_name, | |||
ext | |||
) |
:param outdir str: path to directory that files are generated to :returns str: output file path based on input file name and output directory
Definition at line 921 of file generator.py.
def include.genpy.generator.compute_pkg_type | ( | package, | |
type_ | |||
) |
:param package: package that type is being imported into, ``str`` :param type: message type (package resource name), ``str`` :returns: python package and type name, ``(str, str)``
Definition at line 252 of file generator.py.
def include.genpy.generator.compute_post_deserialize | ( | type_, | |
varname | |||
) |
(de)serialization routines
Compute post-deserialization code for type_, if necessary :returns: code to execute post-deserialization (unindented), or None if not necessary. ``str``
Definition at line 224 of file generator.py.
def include.genpy.generator.compute_resource_name | ( | filename, | |
ext | |||
) |
Convert resource filename to ROS resource name :param filename str: path to .msg/.srv file :returns str: name of ROS resource
Definition at line 913 of file generator.py.
def include.genpy.generator.default_value | ( | msg_context, | |
field_type, | |||
default_package | |||
) |
utilities
Compute default value for field_type :param default_package: default package, ``str`` :param field_type: ROS .msg field type, ``str`` :returns: default value encoded in Python string representation, ``str``
Definition at line 132 of file generator.py.
def include.genpy.generator.deserialize_fn_generator | ( | msg_context, | |
spec, | |||
is_numpy = False |
|||
) |
generator for body of deserialize() function :param is_numpy: if True, generate serializer code for numpy datatypes instead of Python lists, ``bool``
Definition at line 686 of file generator.py.
def include.genpy.generator.flatten | ( | msg_context, | |
msg | |||
) |
Flattens the msg spec so that embedded message fields become direct references. The resulting MsgSpec isn't a true/legal :class:`MsgSpec` and should only be used for serializer generation. :param msg: MsgSpec to flatten :returns: flattened MsgSpec message
Definition at line 166 of file generator.py.
def include.genpy.generator.get_registered_ex | ( | msg_context, | |
type_ | |||
) |
wrapper for get_registered that wraps unknown types with a MsgGenerationException :param type_: ROS message type, ``str``
Definition at line 74 of file generator.py.
def include.genpy.generator.get_special | ( | type_ | ) |
:returns: special type handler for *type_* or ``None``, ``Special``
Definition at line 122 of file generator.py.
def include.genpy.generator.is_special | ( | type_ | ) |
:returns: ``True` if *type_* is a special type (i.e. builtin represented as a class instead of a primitive), ``bool``
Definition at line 116 of file generator.py.
def include.genpy.generator.len_serializer_generator | ( | var, | |
is_string, | |||
serialize | |||
) |
Generator for array-length serialization (32-bit, little-endian unsigned integer) :param var: variable name, ``str`` :param is_string: if True, variable is a string type, ``bool`` :param serialize bool: if True, generate code for serialization. Other, generate code for deserialization, ``bool``
Definition at line 361 of file generator.py.
def include.genpy.generator.make_python_safe | ( | spec | ) |
Remap field/constant names in spec to avoid collision with Python reserved words. :param spec: msg spec to map to new, python-safe field names, ``MsgSpec`` :returns: python-safe message specification, ``MsgSpec``
Definition at line 192 of file generator.py.
def include.genpy.generator.msg_generator | ( | msg_context, | |
spec, | |||
search_path | |||
) |
Python code generator for .msg files. Generates a Python from a :class:`genmsg.MsgSpec`. :param spec: parsed .msg :class:`genmsg.MsgSpec` instance :param search_path: dictionary mapping message namespaces to a directory locations
Definition at line 721 of file generator.py.
def include.genpy.generator.next_var | ( | ) |
Definition at line 326 of file generator.py.
Pop variable context from context stack. The context stack manages field-reference context for serialization, e.g. 'self.foo' vs. 'self.bar.foo' vs. 'var.foo'
Definition at line 346 of file generator.py.
def include.genpy.generator.push_context | ( | context | ) |
Push new variable context onto context stack. The context stack manages field-reference context for serialization, e.g. 'self.foo' vs. 'self.bar.foo' vs. 'var.foo'
Definition at line 336 of file generator.py.
Definition at line 332 of file generator.py.
def include.genpy.generator.serialize_fn_generator | ( | msg_context, | |
spec, | |||
is_numpy = False |
|||
) |
generator for body of serialize() function :param is_numpy: if True, generate serializer code for numpy datatypes instead of Python lists, ``bool``
Definition at line 667 of file generator.py.
def include.genpy.generator.serializer_generator | ( | msg_context, | |
spec, | |||
serialize, | |||
is_numpy | |||
) |
Python generator that yields un-indented python code for (de)serializing MsgSpec. The code this yields is meant to be included in a class method and cannot be used standalone. serialize_fn_generator and deserialize_fn_generator wrap method to provide appropriate class field initializations. :param serialize: if True, yield serialization code. Otherwise, yield deserialization code. ``bool`` :param is_numpy: if True, generate serializer code for numpy datatypes instead of Python lists. ``bool``
Definition at line 624 of file generator.py.
def include.genpy.generator.simple_serializer_generator | ( | msg_context, | |
spec, | |||
start, | |||
end, | |||
serialize | |||
) |
Generator (de)serialization code for multiple fields from spec :param spec: :class:`genmsg.MsgSpec` :param start: first field to serialize, ``int`` :param end: last field to serialize, ``int``
Definition at line 592 of file generator.py.
def include.genpy.generator.srv_generator | ( | msg_context, | |
spec, | |||
search_path | |||
) |
Definition at line 886 of file generator.py.
def include.genpy.generator.string_serializer_generator | ( | package, | |
type_, | |||
name, | |||
serialize | |||
) |
Generator for string types. similar to arrays, but with more efficient call to struct.pack. :param name: spec field name, ``str`` :param serialize: if ``True``, generate code for serialization. Other, generate code for deserialization, ``bool``
Definition at line 383 of file generator.py.
Definition at line 323 of file generator.py.
Definition at line 325 of file generator.py.
string include::genpy::generator::_serial_context = '' |
(De)serialization generators
Definition at line 322 of file generator.py.
dictionary include::genpy::generator::_SPECIAL_TYPES |
00001 { 00002 genmsg.HEADER: Special('std_msgs.msg._Header.Header()', None, 'import std_msgs.msg'), 00003 genmsg.TIME: Special('genpy.Time()', '%s.canon()', 'import genpy'), 00004 genmsg.DURATION: Special('genpy.Duration()', '%s.canon()', 'import genpy'), 00005 }
Definition at line 110 of file generator.py.
string include::genpy::generator::INDENT = ' ' |
Definition at line 72 of file generator.py.