Warning, file /include/edm4hep/Vector2f.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003 #ifndef EDM4HEP_Vector2f_H
0004 #define EDM4HEP_Vector2f_H
0005
0006 #include <cstddef>
0007 #include <ostream>
0008
0009 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0010 #include "nlohmann/json_fwd.hpp"
0011 #endif
0012
0013 namespace edm4hep {
0014
0015
0016
0017
0018
0019 class Vector2f {
0020 public:
0021 float a{};
0022 float b{};
0023
0024 constexpr Vector2f() : a(0), b(0) {
0025 }
0026 constexpr Vector2f(float aa, float bb) : a(aa), b(bb) {
0027 }
0028 constexpr Vector2f(const float* v) : a(v[0]), b(v[1]) {
0029 }
0030 constexpr bool operator==(const Vector2f& v) const {
0031 return (a == v.a && b == v.b);
0032 }
0033 constexpr bool operator!=(const Vector2f& v) const {
0034 return !(*this == v);
0035 }
0036 constexpr float operator[](unsigned i) const {
0037 static_assert(offsetof(Vector2f, a) + sizeof(Vector2f::a) == offsetof(Vector2f, b),
0038 "operator[] requires no padding");
0039 return *(&a + i);
0040 }
0041 };
0042
0043 std::ostream& operator<<(std::ostream& o, const edm4hep::Vector2f& value);
0044
0045 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0046 void to_json(nlohmann::json& j, const Vector2f& value);
0047 #endif
0048
0049 }
0050
0051 #endif