Go to the documentation of this file.
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_);
102 const char* c_{
nullptr};
108 if (a.
c_str() !=
nullptr && b.
c_str() !=
nullptr)
116 inline std::ostream&
operator<<(std::ostream& os,
const Group& g) {
return (os << std::string(g)); }
124 :
Group(i), s_(new std::string(s))
133 std::unique_ptr<const std::string> s_;
145 return std::hash<std::string>{}(std::string(
group));
constexpr Group(std::uint32_t i=invalid_numeric_group)
Construct a group with only a numeric value.
The global namespace for the Goby project.
static constexpr std::uint32_t maximum_valid_group
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 ...
goby::util::logger::GroupSetter group(std::string n)
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...
bool operator==(const Group &a, const Group &b)
std::ostream & operator<<(std::ostream &os, const Group &g)
NLOHMANN_BASIC_JSON_TPL_DECLARATION std::string to_string(const NLOHMANN_BASIC_JSON_TPL &j)
user-defined to_string function for JSON values
DynamicGroup(std::uint32_t i)
Construct a group with a numeric value only.
constexpr std::uint32_t numeric() const
Access the group's numeric value.
bool operator!=(const Group &a, const Group &b)
Class for grouping publications in the Goby middleware. Analogous to "topics" in ROS,...
void set_c_str(const char *c)
std::size_t hash(const BasicJsonType &j)
hash a JSON value
static constexpr std::uint32_t broadcast_group
Special group number representing the broadcast group (used when no grouping is required for a given ...
static constexpr std::uint32_t invalid_numeric_group
Special group number representing an invalid numeric group (unsuitable for intervehicle and outer lay...
size_t operator()(const goby::middleware::Group &group) const noexcept
constexpr const char * c_str() const
Access the group's string value as a C string.
Implementation of Group for dynamic (run-time) instantiations. Use Group directly for static (compile...