Add operators
This commit is contained in:
8
openVulkanoCpp/Math/Pose.hpp
Normal file
8
openVulkanoCpp/Math/Pose.hpp
Normal file
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by georg on 6/8/23.
|
||||
//
|
||||
|
||||
#ifndef OPENVULKANOCPP_POSE_HPP
|
||||
#define OPENVULKANOCPP_POSE_HPP
|
||||
|
||||
#endif //OPENVULKANOCPP_POSE_HPP
|
||||
@@ -24,4 +24,34 @@ namespace openVulkanoCpp::Math
|
||||
[[nodiscard]] uint64_t GetNanos() const { return timestamp; }
|
||||
[[nodiscard]] double GetSeconds() const { return timestamp * NANOS_TO_SECONDS; }
|
||||
};
|
||||
|
||||
inline bool operator==(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return lhs.GetNanos() == rhs.GetNanos();
|
||||
}
|
||||
|
||||
inline bool operator!=(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator<(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return lhs.GetNanos() < rhs.GetNanos();
|
||||
}
|
||||
|
||||
inline bool operator>(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return rhs < lhs;
|
||||
}
|
||||
|
||||
inline bool operator>=(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return !(lhs < rhs);
|
||||
}
|
||||
|
||||
inline bool operator<=(const Timestamp& lhs, const Timestamp& rhs)
|
||||
{
|
||||
return !(rhs < lhs);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user