template<typename Type>
inline bool contains()
{
- return ( type() == typeid(Type) );
+//EED 2021-12-15 typeid comparation is not working in MacOs for objects declared in different libraries
+// ex: itk <-> vtk templates convertion
+#if defined(MACOSX)
+ if ( strcmp( type().name() , typeid(Type).name() ) ==0 ) return true; else return false;
+#else
+ return ( type() == typeid(Type) );
+#endif
}
/// Returns true iff the contained type is a pointer
/// Returns true iff the contained type is t
inline bool contains(TypeInfo t)
{
- return ( (bool)((type() == t)!=0) );
+//EED 2021-12-15 typeid comparation is not working in MacOs for objects declared in different libraries
+// ex: itk <-> vtk templates convertion
+#if defined(MACOSX)
+ bool compTmp = (strcmp( type().name() , t.name() ) == 0);
+ return ( compTmp!=0 );
+#else
+ return ( (bool)((type() == t)!=0) );
+#endif
}
/// Returns true iff any of type ValueType can be held
<<"> with content : "
<<HumanTypeName(type())<<std::endl);
- printf("EED bbtkAny get() self=%s \n" , HumanTypeName<self >().c_str() );
- printf("EED bbtkAny get() ValueType=%s \n" , bbtk::HumanTypeName<ValueType>().c_str() );
- printf("EED bbtkAny get() Type=%s \n" , bbtk::HumanTypeName<>(type()).c_str() );
- printf("EED bbtkAny get() type name=(-%s-) \n" , type().name() );
- printf("EED bbtkAny get() ValueType name=(-%s-) \n" , typeid(ValueType).name() );
-// 2021-12-15
- if ( strcmp( type().name() , typeid(ValueType).name() ) ==0 )
-// if ( type() == typeid(ValueType) )
+//EED 2021-12-15 typeid comparation is not working in MacOs for objects declared in different libraries
+// ex: itk <-> vtk templates convertion
+#if defined(MACOSX)
+ if ( strcmp( type().name() , typeid(ValueType).name() ) ==0 )
+#else
+ if ( type() == typeid(ValueType) )
+#endif
{
return static_cast< anyholder<ValueType> *>(content)->held;
}
template<typename ValueType>
inline const ValueType* getP() const
{
+//EED 2021-12-15 typeid comparation is not working in MacOs for objects declared in different libraries
+// ex: itk <-> vtk templates convertion
+#if defined(MACOSX)
+ if ( strcmp( type().name() , typeid(ValueType).name() ) ==0 )
+#else
if ( type() == typeid(ValueType) )
+#endif
return &static_cast< anyholder<ValueType> *>(content)->held;
bbtkError(HumanTypeName<self >()