| 320 | |
| 321 | template <typename Derived_t, typename Field_t> |
| 322 | void |
| 323 | makeFieldId(FieldId<Derived_t, Field_t> &id, FieldDesc &desc) |
| 324 | { |
| 325 | ink_assert(!areFieldsFinalized()); |
| 326 | |
| 327 | desc.field_type_idx = std::type_index(typeid(Field_t)); |
| 328 | desc.ext_loc_offset = Extendible<Derived_t>::getLocOffset(); |
| 329 | desc.field_offset = std::numeric_limits<decltype(desc.field_offset)>::max(); |
| 330 | desc.size = sizeof(Field_t); |
| 331 | desc.align = alignof(Field_t); |
| 332 | desc.mask = 0; |
| 333 | |
| 334 | id = FieldId<Derived_t, Field_t>(desc); |
| 335 | |
| 336 | // |
| 337 | desc.constructor = [](FieldPtr fld_ptr) { new (fld_ptr) Field_t(); }; |
| 338 | desc.destructor = [](FieldPtr fld_ptr) { static_cast<Field_t *>(fld_ptr)->~Field_t(); }; |
| 339 | desc.serializer = [id](std::ostream &os, void const *fld_ptr) { serializeField(os, fieldGet(fld_ptr, id)); }; |
| 340 | } |
| 341 | |
| 342 | ////////////////////////////////////////////////////// |
| 343 | /// C API specialization |
no test coverage detected