File indexing completed on 2025-07-12 08:33:57
0001
0002
0003 #ifndef EDM4HEP_Vector2i_H
0004 #define EDM4HEP_Vector2i_H
0005
0006 #include <cstddef>
0007 #include <cstdint>
0008 #include <ostream>
0009
0010 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0011 #include "nlohmann/json_fwd.hpp"
0012 #endif
0013
0014 namespace edm4hep {
0015
0016
0017
0018
0019
0020 class Vector2i {
0021 public:
0022 std::int32_t a{};
0023 std::int32_t b{};
0024
0025 constexpr Vector2i() : a(0), b(0) {
0026 }
0027 constexpr Vector2i(int32_t aa, int32_t bb) : a(aa), b(bb) {
0028 }
0029 constexpr Vector2i(const int32_t* v) : a(v[0]), b(v[1]) {
0030 }
0031 constexpr bool operator==(const Vector2i& v) const {
0032 return (a == v.a && b == v.b);
0033 }
0034 constexpr bool operator!=(const Vector2i& v) const {
0035 return !(*this == v);
0036 }
0037 constexpr int operator[](unsigned i) const {
0038 static_assert(offsetof(Vector2i, a) + sizeof(Vector2i::a) == offsetof(Vector2i, b),
0039 "operator[] requires no padding");
0040 return *(&a + i);
0041 }
0042 };
0043
0044 std::ostream& operator<<(std::ostream& o, const edm4hep::Vector2i& value);
0045
0046 #if defined(PODIO_JSON_OUTPUT) && !defined(__CLING__)
0047 void to_json(nlohmann::json& j, const Vector2i& value);
0048 #endif
0049
0050 }
0051
0052 #endif