Functions | Variables
gencpp Namespace Reference

Functions

def _escape_string (s)
 
def cpp_message_declarations (name_prefix, msg)
 
def default_value (type_)
 
def escape_message_definition (definition)
 
def escape_string (str_)
 
def generate_fixed_length_assigns (spec, container_gets_allocator, cpp_name_prefix)
 
def generate_initializer_list (spec, container_gets_allocator)
 
def is_fixed_length (spec, msg_context, includepath)
 
def msg_type_to_cpp (type_)
 
def takes_allocator (type_)
 

Variables

dictionary MSG_TYPE_TO_CPP
 

Function Documentation

◆ _escape_string()

def gencpp._escape_string (   s)
private

Definition at line 96 of file __init__.py.

◆ cpp_message_declarations()

def gencpp.cpp_message_declarations (   name_prefix,
  msg 
)
Return the different possible C++ declarations for a message given the message itself.

@param name_prefix: The C++ prefix to be prepended to the name, e.g. "std_msgs::"
@type name_prefix: str
@param msg: The message type
@type msg: str
@return: A tuple of 3 different names.  cpp_message_decelarations("std_msgs::", "String") returns the tuple
    ("std_msgs::String_", "std_msgs::String_<ContainerAllocator>", "std_msgs::String")
@rtype: str

Definition at line 119 of file __init__.py.

◆ default_value()

def gencpp.default_value (   type_)
Return the value to initialize a message member with.

0 for integer types, 0.0 for floating point, false for bool,
empty string for everything else

@param type_: The type
@type type_: str

Definition at line 171 of file __init__.py.

◆ escape_message_definition()

def gencpp.escape_message_definition (   definition)

Definition at line 102 of file __init__.py.

◆ escape_string()

def gencpp.escape_string (   str_)

Definition at line 211 of file __init__.py.

◆ generate_fixed_length_assigns()

def gencpp.generate_fixed_length_assigns (   spec,
  container_gets_allocator,
  cpp_name_prefix 
)
Initialize any fixed-length arrays.

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: genmsg.msgs.MsgSpec
@param container_gets_allocator: Whether or not a container type (whether it's another message, a vector, array or string)
    should have the allocator passed to its constructor.  Assumes the allocator is named _alloc.
@type container_gets_allocator: bool
@param cpp_name_prefix: The C++ prefix to use when referring to the message, e.g. "std_msgs::"
@type cpp_name_prefix: str

Definition at line 218 of file __init__.py.

◆ generate_initializer_list()

def gencpp.generate_initializer_list (   spec,
  container_gets_allocator 
)
Write the initializer list for a constructor.

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: genmsg.msgs.MsgSpec
@param container_gets_allocator: Whether or not a container type (whether it's another message, a vector, array or string)
    should have the allocator passed to its constructor.  Assumes the allocator is named _alloc.
@type container_gets_allocator: bool

Definition at line 251 of file __init__.py.

◆ is_fixed_length()

def gencpp.is_fixed_length (   spec,
  msg_context,
  includepath 
)
Return whether or not the message is fixed-length.

@param spec: The message spec
@type spec: genmsg.msgs.MsgSpec
@param package: The package of the
@type package: str

Definition at line 139 of file __init__.py.

◆ msg_type_to_cpp()

def gencpp.msg_type_to_cpp (   type_)
Convert a message type into the C++ declaration for that type.

Example message types: uint32, std_msgs/String.
Example C++ types: uint32_t, std_msgs::String_<ContainerAllocator>

@param type_: The message type
@type type_: str
@return: The C++ declaration
@rtype: str

Definition at line 61 of file __init__.py.

◆ takes_allocator()

def gencpp.takes_allocator (   type_)
Return whether or not a type can take an allocator in its constructor.

False for all builtin types except string.
True for all others.

@param type_: The type
@type: str

Definition at line 195 of file __init__.py.

Variable Documentation

◆ MSG_TYPE_TO_CPP

dictionary gencpp.MSG_TYPE_TO_CPP
Initial value:
1 = {
2  'byte': 'int8_t',
3  'char': 'uint8_t',
4  'bool': 'uint8_t',
5  'uint8': 'uint8_t',
6  'int8': 'int8_t',
7  'uint16': 'uint16_t',
8  'int16': 'int16_t',
9  'uint32': 'uint32_t',
10  'int32': 'int32_t',
11  'uint64': 'uint64_t',
12  'int64': 'int64_t',
13  'float32': 'float',
14  'float64': 'double',
15  'string': 'std::basic_string<char, std::char_traits<char>, typename std::allocator_traits<ContainerAllocator>::template rebind_alloc<char>>',
16  'time': 'ros::Time',
17  'duration': 'ros::Duration',
18 }

Definition at line 40 of file __init__.py.



gencpp
Author(s): Josh Faust, Troy Straszheim, Morgen Kjaergaard
autogenerated on Thu May 5 2022 02:40:50