| 1458 | |
| 1459 | template<typename ClassType, typename BaseSpecifier = internal::NoBaseClass> |
| 1460 | class class_ { |
| 1461 | public: |
| 1462 | typedef ClassType class_type; |
| 1463 | typedef BaseSpecifier base_specifier; |
| 1464 | |
| 1465 | class_() = delete; |
| 1466 | |
| 1467 | EMSCRIPTEN_ALWAYS_INLINE explicit class_(const char* name) { |
| 1468 | using namespace internal; |
| 1469 | |
| 1470 | BaseSpecifier::template verify<ClassType>(); |
| 1471 | |
| 1472 | auto _getActualType = &getActualType<ClassType>; |
| 1473 | auto upcast = BaseSpecifier::template getUpcaster<ClassType>(); |
| 1474 | auto downcast = BaseSpecifier::template getDowncaster<ClassType>(); |
| 1475 | auto destructor = &raw_destructor<ClassType>; |
| 1476 | |
| 1477 | _embind_register_class( |
| 1478 | TypeID<ClassType>::get(), |
| 1479 | TypeID<AllowedRawPointer<ClassType>>::get(), |
| 1480 | TypeID<AllowedRawPointer<const ClassType>>::get(), |
| 1481 | BaseSpecifier::get(), |
| 1482 | getSignature(_getActualType), |
| 1483 | reinterpret_cast<GenericFunction>(_getActualType), |
| 1484 | getSignature(upcast), |
| 1485 | reinterpret_cast<GenericFunction>(upcast), |
| 1486 | getSignature(downcast), |
| 1487 | reinterpret_cast<GenericFunction>(downcast), |
| 1488 | name, |
| 1489 | getSignature(destructor), |
| 1490 | reinterpret_cast<GenericFunction>(destructor)); |
| 1491 | } |
| 1492 | |
| 1493 | template<typename PointerType> |
| 1494 | EMSCRIPTEN_ALWAYS_INLINE const class_& smart_ptr(const char* name) const { |
| 1495 | using namespace internal; |
| 1496 | |
| 1497 | typedef smart_ptr_trait<PointerType> PointerTrait; |
| 1498 | typedef typename PointerTrait::element_type PointeeType; |
| 1499 | |
| 1500 | static_assert(std::is_same<ClassType, typename std::remove_cv<PointeeType>::type>::value, "smart pointer must point to this class"); |
| 1501 | |
| 1502 | auto get = &PointerTrait::get; |
| 1503 | auto construct_null = &PointerTrait::construct_null; |
| 1504 | auto share = &PointerTrait::share; |
| 1505 | auto destructor = &raw_destructor<PointerType>; |
| 1506 | |
| 1507 | _embind_register_smart_ptr( |
| 1508 | TypeID<PointerType>::get(), |
| 1509 | TypeID<PointeeType>::get(), |
| 1510 | name, |
| 1511 | PointerTrait::get_sharing_policy(), |
| 1512 | getSignature(get), |
| 1513 | reinterpret_cast<GenericFunction>(get), |
| 1514 | getSignature(construct_null), |
| 1515 | reinterpret_cast<GenericFunction>(construct_null), |
| 1516 | getSignature(share), |
| 1517 | reinterpret_cast<GenericFunction>(share), |
nothing calls this directly
no test coverage detected