25#ifndef GOBY_MIDDLEWARE_GROUP_H
26#define GOBY_MIDDLEWARE_GROUP_H
35#if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 2)
38#error Must use Clang or GCC > 7.2 to compile goby3 middleware
77 constexpr std::uint32_t
numeric()
const {
return i_; }
80 constexpr const char*
c_str()
const {
return c_; }
83 operator std::string()
const
88 return std::string(c_);
90 return std::string(c_) +
";" + std::to_string(i_);
94 return std::to_string(i_);
102 const char* c_{
nullptr};
108 if (a.
c_str() !=
nullptr && b.
c_str() !=
nullptr)
116inline std::ostream& operator<<(std::ostream& os,
const Group& g) {
return (os << std::string(g)); }
133 std::unique_ptr<const std::string> s_;
141template <>
struct hash<
goby::middleware::Group>
145 return std::hash<std::string>{}(std::string(
group));
Implementation of Group for dynamic (run-time) instantiations. Use Group directly for static (compile...
DynamicGroup(std::uint32_t i)
Construct a group with a numeric value only.
DynamicGroup(const std::string &s, std::uint32_t i=Group::invalid_numeric_group)
Construct a group with a string and possibly a numeric value (when this Group will be used on interve...
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
static constexpr std::uint32_t broadcast_group
Special group number representing the broadcast group (used when no grouping is required for a given ...
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 ...
constexpr Group(std::uint32_t i=invalid_numeric_group)
Construct a group with only a numeric value.
constexpr std::uint32_t numeric() const
Access the group's numeric value.
void set_c_str(const char *c)
constexpr const char * c_str() const
Access the group's string value as a C string.
static constexpr std::uint32_t maximum_valid_group
operator std::string() const
Access the group's string value as a C++ string.
static constexpr std::uint32_t invalid_numeric_group
Special group number representing an invalid numeric group (unsuitable for intervehicle and outer lay...
goby::util::logger::GroupSetter group(std::string n)
bool operator!=(const Group &a, const Group &b)
bool operator==(const Group &a, const Group &b)
The global namespace for the Goby project.