Functions | Variables
msg_gen Namespace Reference

Functions

def compute_full_text_escaped (gen_deps_dict)
 
def cpp_message_declarations (name_prefix, msg)
 
def default_value (type)
 
def escape_string (str)
 
def generate (msg_path)
 
def generate_messages (argv)
 
def is_fixed_length (spec)
 
def is_hex_string (str)
 
def msg_type_to_cpp (type)
 
def takes_allocator (type)
 
def write_begin (s, spec, file)
 
def write_constant_declaration (s, constant)
 
def write_constant_declarations (s, spec)
 
def write_constant_definition (s, spec, constant)
 
def write_constant_definitions (s, spec)
 
def write_constructors (s, spec, cpp_name_prefix)
 
def write_deprecated_member_functions (s, spec, traits)
 
def write_end (s, spec)
 
def write_fixed_length_assigns (s, spec, container_gets_allocator, cpp_name_prefix)
 
def write_generic_includes (s)
 
def write_includes (s, spec)
 
def write_initializer_list (s, spec, container_gets_allocator)
 
def write_member (s, field)
 
def write_members (s, spec)
 
def write_operations (s, spec, cpp_name_prefix)
 
def write_ostream_operator (s, spec, cpp_name_prefix)
 
def write_serialization (s, spec, cpp_name_prefix)
 
def write_struct (s, spec, cpp_name_prefix, extra_deprecated_traits={})
 
def write_trait_char_class (s, class_name, cpp_msg_with_alloc, value, write_static_hex_value=False)
 
def write_trait_true_class (s, class_name, cpp_msg_with_alloc)
 
def write_traits (s, spec, cpp_name_prefix, datatype=None, rospack=None)
 

Variables

dictionary MSG_TYPE_TO_CPP
 

Function Documentation

def msg_gen.compute_full_text_escaped (   gen_deps_dict)
Same as roslib.gentools.compute_full_text, except that the
resulting text is escaped to be safe for C++ double quotes

@param get_deps_dict: dictionary returned by get_dependencies call
@type  get_deps_dict: dict
@return: concatenated text for msg/srv file and embedded msg/srv types. Text will be escaped for double quotes
@rtype: str

Definition at line 494 of file msg_gen.py.

def msg_gen.cpp_message_declarations (   name_prefix,
  msg 
)
Returns 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 97 of file msg_gen.py.

def msg_gen.default_value (   type)
Returns 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 217 of file msg_gen.py.

def msg_gen.escape_string (   str)

Definition at line 366 of file msg_gen.py.

def msg_gen.generate (   msg_path)
Generate a message

@param msg_path: The path to the .msg file
@type msg_path: str

Definition at line 685 of file msg_gen.py.

def msg_gen.generate_messages (   argv)

Definition at line 737 of file msg_gen.py.

def msg_gen.is_fixed_length (   spec)
Returns whether or not the message is fixed-length

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

Definition at line 427 of file msg_gen.py.

def msg_gen.is_hex_string (   str)

Definition at line 515 of file msg_gen.py.

def msg_gen.msg_type_to_cpp (   type)
Converts a message type (e.g. uint32, std_msgs/String, etc.) into the C++ declaration
for that type (e.g. uint32_t, std_msgs::String_<ContainerAllocator>)

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

Definition at line 65 of file msg_gen.py.

def msg_gen.takes_allocator (   type)
Returns 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 235 of file msg_gen.py.

def msg_gen.write_begin (   s,
  spec,
  file 
)
Writes the beginning of the header file: a comment saying it's auto-generated and the include guards

@param s: The stream to write to
@type s: stream
@param spec: The spec
@type spec: roslib.msgs.MsgSpec
@param file: The file this message is being generated for
@type file: str

Definition at line 115 of file msg_gen.py.

def msg_gen.write_constant_declaration (   s,
  constant 
)
Write a constant value as a static member

@param s: The stream to write to
@type s: stream
@param constant: The constant
@type constant: roslib.msgs.Constant

Definition at line 371 of file msg_gen.py.

def msg_gen.write_constant_declarations (   s,
  spec 
)
Write all the constants from a spec as static members

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec

Definition at line 387 of file msg_gen.py.

def msg_gen.write_constant_definition (   s,
  spec,
  constant 
)
Write a constant value as a static member

@param s: The stream to write to
@type s: stream
@param constant: The constant
@type constant: roslib.msgs.Constant

Definition at line 399 of file msg_gen.py.

def msg_gen.write_constant_definitions (   s,
  spec 
)
Write all the constants from a spec as static members

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec

Definition at line 415 of file msg_gen.py.

def msg_gen.write_constructors (   s,
  spec,
  cpp_name_prefix 
)
Writes any necessary constructors for the message

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec
@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 312 of file msg_gen.py.

def msg_gen.write_deprecated_member_functions (   s,
  spec,
  traits 
)
Writes the deprecated member functions for backwards compatibility

Definition at line 456 of file msg_gen.py.

def msg_gen.write_end (   s,
  spec 
)
Writes the end of the header file: the ending of the include guards

@param s: The stream to write to
@type s: stream
@param spec: The spec
@type spec: roslib.msgs.MsgSpec

Definition at line 130 of file msg_gen.py.

def msg_gen.write_fixed_length_assigns (   s,
  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: roslib.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 281 of file msg_gen.py.

def msg_gen.write_generic_includes (   s)
Writes the includes that all messages need

@param s: The stream to write to
@type s: stream

Definition at line 141 of file msg_gen.py.

def msg_gen.write_includes (   s,
  spec 
)
Writes the message-specific includes

@param s: The stream to write to
@type s: stream
@param spec: The message spec to iterate over
@type spec: roslib.msgs.MsgSpec

Definition at line 159 of file msg_gen.py.

def msg_gen.write_initializer_list (   s,
  spec,
  container_gets_allocator 
)
Writes the initializer list for a constructor

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.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 247 of file msg_gen.py.

def msg_gen.write_member (   s,
  field 
)
Writes a single member's declaration and type typedef

@param s: The stream to write to
@type s: stream
@param type: The member type
@type type: str
@param name: The name of the member
@type name: str

Definition at line 340 of file msg_gen.py.

def msg_gen.write_members (   s,
  spec 
)
Write all the member declarations

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec

Definition at line 355 of file msg_gen.py.

def msg_gen.write_operations (   s,
  spec,
  cpp_name_prefix 
)

Definition at line 615 of file msg_gen.py.

def msg_gen.write_ostream_operator (   s,
  spec,
  cpp_name_prefix 
)

Definition at line 680 of file msg_gen.py.

def msg_gen.write_serialization (   s,
  spec,
  cpp_name_prefix 
)
Writes the Serializer class for a message

@param s: Stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec
@param cpp_name_prefix: The C++ prefix to prepend to a message to refer to it (e.g. "std_msgs::")
@type cpp_name_prefix: str

Definition at line 650 of file msg_gen.py.

def msg_gen.write_struct (   s,
  spec,
  cpp_name_prefix,
  extra_deprecated_traits = {} 
)
Writes the entire message struct: declaration, constructors, members, constants and (deprecated) member functions
@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec
@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 180 of file msg_gen.py.

def msg_gen.write_trait_char_class (   s,
  class_name,
  cpp_msg_with_alloc,
  value,
  write_static_hex_value = False 
)
Writes a class trait for traits which have static value() members that return const char*

e.g. write_trait_char_class(s, "MD5Sum", "std_msgs::String_<ContainerAllocator>", "hello") yields:
template<class ContainerAllocator>
struct MD5Sum<std_msgs::String_<ContainerAllocator> > 
{
    static const char* value() { return "hello"; }
    static const char* value(const std_msgs::String_<ContainerAllocator>&) { return value(); }
};

@param s: The stream to write to
@type s: stream
@param class_name: The name of the trait class to write
@type class_name: str
@param cpp_msg_with_alloc: The C++ declaration of the message, including the allocator template
@type cpp_msg_with_alloc: str
@param value: The value to return in the string
@type value: str
@param write_static_hex_value: Whether or not to write a set of compile-time-checkable static values.  Useful for,
    for example, MD5Sum.  Writes static const uint64_t static_value1... static_valueN
@type write_static_hex_value: bool
@raise ValueError if write_static_hex_value is True but value contains characters invalid in a hex value

Definition at line 522 of file msg_gen.py.

def msg_gen.write_trait_true_class (   s,
  class_name,
  cpp_msg_with_alloc 
)
Writes a true/false trait class

@param s: stream to write to
@type s: stream
@param class_name: Name of the trait class
@type class_name: str
@param cpp_msg_with_alloc: The C++ declaration of the message, including the allocator template
@type cpp_msg_with_alloc: str

Definition at line 560 of file msg_gen.py.

def msg_gen.write_traits (   s,
  spec,
  cpp_name_prefix,
  datatype = None,
  rospack = None 
)
Writes all the traits classes for a message

@param s: The stream to write to
@type s: stream
@param spec: The message spec
@type spec: roslib.msgs.MsgSpec
@param cpp_name_prefix: The C++ prefix to prepend to a message to refer to it (e.g. "std_msgs::")
@type cpp_name_prefix: str
@param datatype: The string to write as the datatype of the message.  If None (default), pkg/msg is used.
@type datatype: str

Definition at line 573 of file msg_gen.py.

Variable Documentation

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

Definition at line 53 of file msg_gen.py.



roscpp
Author(s): Morgan Quigley, Josh Faust, Brian Gerkey, Troy Straszheim, Dirk Thomas
autogenerated on Mon Nov 2 2020 03:52:26