Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C++ RTTI on Android #28610

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/core/include/openvino/core/type.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ struct OPENVINO_API DiscreteTypeInfo {
OPENVINO_API
std::ostream& operator<<(std::ostream& s, const DiscreteTypeInfo& info);

#if defined(__ANDROID__) || defined(ANDROID)
# define OPENVINO_DYNAMIC_CAST
#endif

/// \brief Tests if value is a pointer/shared_ptr that can be statically cast to a
/// Type*/shared_ptr<Type>
template <typename Type, typename Value>
Expand All @@ -97,11 +93,7 @@ template <typename Type, typename Value>
typename std::enable_if<std::is_convertible<decltype(static_cast<Type*>(std::declval<Value>())), Type*>::value,
Type*>::type
as_type(Value value) {
#ifdef OPENVINO_DYNAMIC_CAST
return ov::is_type<Type>(value) ? static_cast<Type*>(value) : nullptr;
#else
return dynamic_cast<Type*>(value);
#endif
}

namespace util {
Expand All @@ -122,11 +114,7 @@ struct AsTypePtr<std::shared_ptr<In>> {
/// Type, nullptr otherwise
template <typename T, typename U>
auto as_type_ptr(const U& value) -> decltype(::ov::util::AsTypePtr<U>::template call<T>(value)) {
#ifdef OPENVINO_DYNAMIC_CAST
return ::ov::util::AsTypePtr<U>::template call<T>(value);
#else
return std::dynamic_pointer_cast<T>(value);
#endif
}
} // namespace ov

Expand Down
Loading