27 #include "ngraph/ngraph_visibility.hpp"
59 return *
this == target_type || (parent && parent->is_castable(target_type));
65 return version < b.version || (version == b.version && strcmp(name, b.name) < 0);
69 return version < b.version || (version == b.version && strcmp(name, b.name) <= 0);
73 return version < b.version || (version == b.version && strcmp(name, b.name) > 0);
77 return version < b.version || (version == b.version && strcmp(name, b.name) >= 0);
81 return version == b.version && strcmp(name, b.name) == 0;
85 return version != b.version || strcmp(name, b.name) != 0;
91 template <
typename Type,
typename Value>
92 typename std::enable_if<
94 decltype(std::declval<Value>()->get_type_info().is_castable(Type::type_info)),
99 return value->get_type_info().is_castable(Type::type_info);
103 template <
typename Type,
typename Value>
104 typename std::enable_if<
105 std::is_convertible<decltype(static_cast<Type*>(std::declval<Value>())), Type*>::value,
109 return is_type<Type>(value) ?
static_cast<Type*
>(value) :
nullptr;
114 template <
typename Type,
typename Value>
115 typename std::enable_if<
116 std::is_convertible<decltype(std::static_pointer_cast<Type>(std::declval<Value>())),
117 std::shared_ptr<Type>>::value,
118 std::shared_ptr<Type>>::type
121 return is_type<Type>(value) ? std::static_pointer_cast<Type>(value)
122 : std::shared_ptr<Type>();
129 struct NGRAPH_API hash<
ngraph::DiscreteTypeInfo>
The Intel nGraph C++ API.
Definition: attribute_adapter.hpp:28
std::enable_if< std::is_convertible< decltype(std::static_pointer_cast< Type >std::declval< Value >))), std::shared_ptr< Type > >::value, std::shared_ptr< Type > >::type as_type_ptr(Value value)
Definition: type.hpp:119
std::enable_if< std::is_convertible< decltype(static_cast< Type * >std::declval< Value >))), Type * >::value, Type * >::type as_type(Value value)
Casts a Value* to a Type* if it is of type Type, nullptr otherwise.
Definition: type.hpp:107