GTIRB
v2.2.0
GrammaTech Intermediate Representation for Binaries: C++ API
|
Go to the documentation of this file.
15 #ifndef GTIRB_OFFSET_H
16 #define GTIRB_OFFSET_H
20 #include <boost/functional/hash.hpp>
37 uint64_t Displacement{0};
41 : ElementId(ElemId), Displacement(Disp) {}
49 return LHS.ElementId == RHS.ElementId &&
50 LHS.Displacement == RHS.Displacement;
60 const Offset& RHS) noexcept {
61 return std::tie(LHS.ElementId, LHS.Displacement) <
62 std::tie(RHS.ElementId, RHS.Displacement);
67 const Offset& RHS) noexcept {
68 return operator<(RHS, LHS);
73 const Offset& RHS) noexcept {
74 return !operator<(RHS, LHS);
79 const Offset& RHS) noexcept {
80 return !operator<(LHS, RHS);
86 using MessageType = proto::Offset;
93 void toProtobuf(MessageType* Message)
const;
102 bool fromProtobuf(
Context& C,
const MessageType& Message);
106 friend bool fromProtobuf(
Context&,
Offset&,
const MessageType&);
114 template <>
struct hash<
gtirb::Offset> {
116 std::size_t Seed = 0;
125 #endif // GTIRB_OFFSET_H
boost::uuids::uuid UUID
Represents a universally unique identifier used to identify Node objects across serialization boundar...
Definition: Context.hpp:36
uint64_t Displacement
The displacement from the start of the node, in bytes.
Definition: Offset.hpp:37
The context under which GTIRB operations occur.
Definition: Context.hpp:63
Class gtirb::Context and related operators.
std::enable_if_t< std::is_error_code_enum< E >::value||std::is_error_condition_enum< E >::value, bool > operator==(const ErrorOr< T > &Err, E Code)
Definition: ErrorOr.hpp:277
Describes a location inside a node (byte interval, block, etc).
Definition: Offset.hpp:32
constexpr friend bool operator<=(const Offset &LHS, const Offset &RHS) noexcept
Less-than-or-equal operator for Offset.
Definition: Offset.hpp:72
#define GTIRB_EXPORT_API
This macro controls the visibility of exported symbols (i.e. classes) in shared libraries....
Definition: Export.hpp:52
friend bool operator==(const Offset &LHS, const Offset &RHS) noexcept
Equality operator for Offset.
Definition: Offset.hpp:48
Main namespace for the GTIRB API.
Definition: Addr.hpp:28
UUID ElementId
The UUID of the node.
Definition: Offset.hpp:34
friend bool operator!=(const Offset &LHS, const Offset &RHS) noexcept
Inequality operator for Offset.
Definition: Offset.hpp:54
Offset(const UUID &ElemId, uint64_t Disp)
Constructor using a ElemId uuid and a Displacement.
Definition: Offset.hpp:40
constexpr friend bool operator>=(const Offset &LHS, const Offset &RHS) noexcept
Greater-than-or-equal operator for Offset.
Definition: Offset.hpp:78
constexpr friend bool operator<(const Offset &LHS, const Offset &RHS) noexcept
Less-than operator for Offset.
Definition: Offset.hpp:59
size_t operator()(const gtirb::Offset &X) const
Definition: Offset.hpp:115
constexpr friend bool operator>(const Offset &LHS, const Offset &RHS) noexcept
Greater-than operator for Offset.
Definition: Offset.hpp:66