MCPcopy Create free account
hub / github.com/ImageEngine/cortex / data

Function data

src/IECoreImage/OpenImageIOAlgo.cpp:604–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

602}
603
604IECore::DataPtr data( const OIIO::ParamValue &value )
605{
606 OIIO::TypeDesc type = value.type();
607 switch( type.basetype )
608 {
609 case TypeDesc::CHAR :
610 {
611 if ( type.aggregate == TypeDesc::SCALAR )
612 {
613 return extractScalarData<char>( value );
614 }
615 return nullptr;
616 }
617 case TypeDesc::UCHAR :
618 {
619 if ( type.aggregate == TypeDesc::SCALAR )
620 {
621 return extractScalarData<unsigned char>( value );
622 }
623 return nullptr;
624 }
625 case TypeDesc::STRING :
626 {
627 if ( type.aggregate == TypeDesc::SCALAR )
628 {
629 if ( type.arraylen == 0 )
630 {
631 return new StringData( static_cast<const ustring *>( value.data() )->string() );
632 }
633 else
634 {
635 const ustring *typedData = static_cast<const ustring *>( value.data() );
636
637 StringVectorDataPtr vectorData = new StringVectorData();
638 auto &writable = vectorData->writable();
639 writable.resize( type.arraylen );
640 for (int i = 0; i < type.arraylen; ++i)
641 {
642 writable[i] = typedData[i].string();
643 }
644 return vectorData;
645 }
646 }
647 return nullptr;
648 }
649 case TypeDesc::USHORT :
650 {
651 if ( type.aggregate == TypeDesc::SCALAR )
652 {
653 return extractScalarData<unsigned short>( value );
654 }
655 return nullptr;
656 }
657 case TypeDesc::SHORT :
658 {
659 if ( type.aggregate == TypeDesc::SCALAR )
660 {
661 return extractScalarData<short>( value );

Callers 2

updateMetadataMethod · 0.85

Calls 5

dataMethod · 0.80
copyFunction · 0.50
typeMethod · 0.45
writableMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected