Skip to content
Snippets Groups Projects

trust object type and avoid dynamic_cast due to cross-library RTTI trouble.

Merged Martin Heistermann requested to merge avoid_dynamic_cast into master
Files
8
@@ -108,7 +108,7 @@ bool getObject( int _identifier, HexahedralMeshObject*& _object ) {
BaseObjectData* object = 0;
PluginFunctions::getObject(_identifier,object);
_object = dynamic_cast< HexahedralMeshObject* >(object);
_object = object ? hexahedralMeshObject(object) : nullptr;
return ( _object != 0 );
}
@@ -120,7 +120,7 @@ bool getObject( int _identifier, HexahedralMeshObject*& _object ) {
HexahedralMesh* hexahedralMesh( BaseObjectData* _object ) {
if ( _object->dataType(DATA_HEXAHEDRAL_MESH) ) {
HexahedralMeshObject* object = dynamic_cast< HexahedralMeshObject* >(_object);
HexahedralMeshObject* object = static_cast< HexahedralMeshObject* >(_object);
return object->mesh();
} else
return 0;
@@ -139,7 +139,7 @@ HexahedralMesh* hexahedralMesh( int _identifier ) {
HexahedralMeshObject* hexahedralMeshObject( BaseObjectData* _object ) {
if ( ! _object->dataType(DATA_HEXAHEDRAL_MESH) )
return 0;
return dynamic_cast< HexahedralMeshObject* >( _object );
return static_cast< HexahedralMeshObject* >( _object );
}
Loading