Goby3  3.1.5a
2024.05.23
goby::middleware::Group Class Reference

Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS, "channel" in LCM, or "variable" in MOOS. More...

#include <goby/middleware/group.h>

Inheritance diagram for goby::middleware::Group:
goby::middleware::DynamicGroup

Public Member Functions

constexpr Group (const char *c, std::uint32_t i=invalid_numeric_group)
 Construct a group with a (C-style) string and possibly a numeric value (when this Group will be used on intervehicle and outer layers). More...
 
constexpr Group (std::uint32_t i=invalid_numeric_group)
 Construct a group with only a numeric value. More...
 
constexpr std::uint32_t numeric () const
 Access the group's numeric value. More...
 
constexpr const charc_str () const
 Access the group's string value as a C string. More...
 
 operator std::string () const
 Access the group's string value as a C++ string. More...
 

Static Public Attributes

static constexpr std::uint32_t broadcast_group {0}
 Special group number representing the broadcast group (used when no grouping is required for a given type) More...
 
static constexpr std::uint32_t invalid_numeric_group {std::numeric_limits<std::uint32_t>::max()}
 Special group number representing an invalid numeric group (unsuitable for intervehicle and outer layers) More...
 
static constexpr std::uint32_t maximum_valid_group
 

Protected Member Functions

void set_c_str (const char *c)
 

Detailed Description

Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS, "channel" in LCM, or "variable" in MOOS.

A Group is defined by a string and possibly also an integer value (when used on intervehicle and outer layers). For interprocess and inner layers, the string value is used (and the integer value is optional). For intervehicle and outer layers, the integer value is used to minimizing wire size over these restricted links.

Group is intended to instantiated as a compile-time constant (constexpr), e.g.

// For use on interprocess or inner (string only)
constexpr goby::middleware::Group example_navigation{"navigation"};
// For use on all layers (string and numeric)
constexpr goby::middleware::Group example_status{"status", 2};

Definition at line 59 of file group.h.

Constructor & Destructor Documentation

◆ Group() [1/2]

constexpr goby::middleware::Group::Group ( const char c,
std::uint32_t  i = invalid_numeric_group 
)
inlineconstexpr

Construct a group with a (C-style) string and possibly a numeric value (when this Group will be used on intervehicle and outer layers).

Definition at line 71 of file group.h.

◆ Group() [2/2]

constexpr goby::middleware::Group::Group ( std::uint32_t  i = invalid_numeric_group)
inlineconstexpr

Construct a group with only a numeric value.

Definition at line 74 of file group.h.

Member Function Documentation

◆ c_str()

constexpr const char* goby::middleware::Group::c_str ( ) const
inlineconstexpr

Access the group's string value as a C string.

Definition at line 80 of file group.h.

◆ numeric()

constexpr std::uint32_t goby::middleware::Group::numeric ( ) const
inlineconstexpr

Access the group's numeric value.

Definition at line 77 of file group.h.

◆ operator std::string()

goby::middleware::Group::operator std::string ( ) const
inline

Access the group's string value as a C++ string.

Definition at line 83 of file group.h.

◆ set_c_str()

void goby::middleware::Group::set_c_str ( const char c)
inlineprotected

Definition at line 99 of file group.h.

Member Data Documentation

◆ broadcast_group

constexpr std::uint32_t goby::middleware::Group::broadcast_group {0}
staticconstexpr

Special group number representing the broadcast group (used when no grouping is required for a given type)

Definition at line 63 of file group.h.

◆ invalid_numeric_group

constexpr std::uint32_t goby::middleware::Group::invalid_numeric_group {std::numeric_limits<std::uint32_t>::max()}
staticconstexpr

Special group number representing an invalid numeric group (unsuitable for intervehicle and outer layers)

Definition at line 65 of file group.h.

◆ maximum_valid_group

constexpr std::uint32_t goby::middleware::Group::maximum_valid_group
staticconstexpr
Initial value:
{std::numeric_limits<std::uint32_t>::max() -
1}

Definition at line 67 of file group.h.


The documentation for this class was generated from the following file:
goby::middleware::Group
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
Definition: group.h:59