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

Method create

src/IECore/Writer.cpp:117–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117WriterPtr Writer::create( ObjectPtr object, const std::string &fileName )
118{
119 string ext = boost::filesystem::path( fileName ).extension().string();
120
121 ExtensionsToFnsMap *m = extensionsToFns();
122 assert( m );
123 ExtensionsToFnsMap::const_iterator it = m->find( ext );
124
125 if ( it == m->end() )
126 {
127 throw Exception( string( "Unrecognized output file format '") + ext + "'!" );
128 }
129
130 for( it=m->begin(); it!=m->end(); it++ )
131 {
132 if( it->first==ext )
133 {
134 if( it->second.canWrite( object, fileName ) )
135 {
136 WriterPtr result = it->second.creator();
137 result->parameters()->parameter<Parameter>( "object" )->setValue( object );
138 result->parameters()->parameter<FileNameParameter>( "fileName" )->setTypedValue( fileName );
139 return result;
140 }
141 }
142 }
143
144 throw Exception( string( "Unable to find writer able to write given object to file of type '") + ext + "'!" );
145}
146
147WriterPtr Writer::create( const std::string &fileName )
148{

Callers 15

doOperationMethod · 0.45
saveMethod · 0.45
_ensureDataMethod · 0.45
_ensureHeaderMethod · 0.45
parseMethod · 0.45
doOperationMethod · 0.45
testSimpleMethod · 0.45
testFactoryFunctionMethod · 0.45
testSampleTimeOrderMethod · 0.45

Calls 8

pathFunction · 0.85
extensionMethod · 0.80
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
canWriteMethod · 0.45
setValueMethod · 0.45
parametersMethod · 0.45

Tested by 15

testFactoryFunctionMethod · 0.36
testSampleTimeOrderMethod · 0.36
testDeprecatedSplinesMethod · 0.36
testCopyReturnValuesMethod · 0.36
testSimpleMethod · 0.36
testHighDensityMethod · 0.36
testOffsetParameterMethod · 0.36