| 2219 | ////////////////////////////////////////////////////////////////////////// |
| 2220 | |
| 2221 | SceneCache::SceneCache( const std::string &fileName, IndexedIO::OpenMode mode ) |
| 2222 | { |
| 2223 | if( mode & IndexedIO::Append ) |
| 2224 | { |
| 2225 | throw InvalidArgumentException( "Append mode not supported" ); |
| 2226 | } |
| 2227 | IndexedIOPtr indexedIO = IndexedIO::create( fileName, IndexedIO::rootPath, mode ); |
| 2228 | |
| 2229 | if( indexedIO->openMode() & IndexedIO::Write ) |
| 2230 | { |
| 2231 | ObjectPtr header = HeaderGenerator::header(); |
| 2232 | header->save( indexedIO, headerEntry ); |
| 2233 | indexedIO->subdirectory( sampleTimesEntry, IndexedIO::CreateIfMissing ); |
| 2234 | indexedIO = indexedIO->subdirectory( rootEntry, IndexedIO::CreateIfMissing ); |
| 2235 | indexedIO->removeAll(); |
| 2236 | m_implementation = new WriterImplementation( indexedIO ); |
| 2237 | } |
| 2238 | else |
| 2239 | { |
| 2240 | indexedIO = indexedIO->subdirectory( rootEntry ); |
| 2241 | m_implementation = new ReaderImplementation( indexedIO ); |
| 2242 | } |
| 2243 | } |
| 2244 | |
| 2245 | SceneCache::SceneCache( IECore::IndexedIOPtr indexedIO ) |
| 2246 | { |