| 49 | } |
| 50 | |
| 51 | std::unique_ptr<ObjectReader> ObjectReader::create( const Alembic::Abc::IObject &object, IECore::TypeId cortexType ) |
| 52 | { |
| 53 | const Alembic::Abc::MetaData &md = object.getMetaData(); |
| 54 | for( const auto &r : registrations() ) |
| 55 | { |
| 56 | const bool resultTypeMatches = cortexType == IECore::InvalidTypeId || cortexType == r.resultType || RunTimeTyped::inheritsFrom( r.resultType, cortexType ); |
| 57 | if( resultTypeMatches && r.matcher( md, Alembic::Abc::kStrictMatching ) ) |
| 58 | { |
| 59 | return r.creator( object ); |
| 60 | } |
| 61 | } |
| 62 | return nullptr; |
| 63 | } |
| 64 | |
| 65 | |
| 66 | void ObjectReader::registerReader( MatchFn matcher, IECore::TypeId resultType, Creator creator ) |