Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
NodeID.h
Go to the documentation of this file.
1
23
24#pragma once
25
28#include <boost/array.hpp>
29#include <boost/uuid/uuid.hpp>
30
31namespace RobotRaconteur
32{
33
57class ROBOTRACONTEUR_CORE_API NodeID : virtual public RRObject
58{
59 private:
60 boost::uuids::uuid id;
61
62 public:
68
74 NodeID(boost::array<uint8_t, 16> id);
75
81 NodeID(boost::uuids::uuid id);
82
88 NodeID(const NodeID& id);
89
95 NodeID(boost::string_ref id);
96
102 const boost::array<uint8_t, 16> ToByteArray() const;
103
104 const boost::uuids::uuid ToUuid() const;
105
115 virtual std::string ToString() const;
116
139 virtual std::string ToString(boost::string_ref format) const;
140
149
151 bool operator==(const NodeID& id2) const;
152
154 bool operator!=(const NodeID& id2) const;
155
157 bool operator<(const NodeID& id2) const;
158
161
170 bool IsAnyNode() const;
171
177 static NodeID GetAny();
178
180 virtual int32_t GetHashCode() const;
181
182 RR_OVIRTUAL std::string RRType() RR_OVERRIDE { return "RobotRaconteur::NodeID"; }
183
184 private:
185 void init_from_string(const boost::string_ref& id);
186};
187
188size_t hash(const NodeID& nodeid);
189
190} // namespace RobotRaconteur
const boost::array< uint8_t, 16 > ToByteArray() const
Convert the NodeID UUID to bytes.
static NodeID GetAny()
Get the "any" NodeId.
bool operator==(const NodeID &id2) const
Test if NodeID is equal.
NodeID & operator=(const NodeID &id)
Assignment operator.
NodeID(boost::uuids::uuid id)
Construct a new NodeID with the specified boost::uuids::uuid.
NodeID(boost::array< uint8_t, 16 > id)
Construct a new NodeID with the specified UUID bytes.
virtual std::string ToString(boost::string_ref format) const
Convert the NodeID UUID to specified format.
NodeID(boost::string_ref id)
Construct a new NodeID parsing a string UUID.
bool IsAnyNode() const
Is the NodeID UUID all zeros.
virtual std::string ToString() const
Convert the NodeID UUID to string with "B" format.
bool operator!=(const NodeID &id2) const
Test if NodeID is not equal.
NodeID()
Construct a new NodeID with "any" node UUID.
static NodeID NewUniqueID()
Generate a new random NodeID UUID.
NodeID(const NodeID &id)
Copy construct a new NodeID.
RR_OVIRTUAL std::string RRType() RR_OVERRIDE
Gets the type of the object as a string. This string is in C++ format, using two colons to separate n...
Definition NodeID.h:182