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

Method flush

src/IECoreScene/SceneCache.cpp:1738–1776  ·  view source on GitHub ↗

Called from the destructor of the root location. It triggers flush recursivelly on all the child locations. It also sets m_sampleTimesMap to NULL which prevents further modification on this and all child scene interface objects through their call to writable(). Responsible for writing missing data such as all the sample times from object,transform,attributes and bounds. And also computes the anima

Source from the content-addressed store, hash-verified

1736 // times from object,transform,attributes and bounds. And also computes the
1737 // animated bounding boxes in case they were not explicitly writen.
1738 void flush()
1739 {
1740 // AncestorTags must be written before visiting children
1741 if ( m_parent )
1742 {
1743 NameList tags;
1744 // get ancestor tags from parent
1745 m_parent->readTags( tags, SceneInterface::LocalTag | SceneInterface::AncestorTag );
1746 writeTags( tags, SceneInterface::AncestorTag );
1747 }
1748
1749 /// first call flush recursively on children...
1750 for ( std::map< SceneCache::Name, WriterImplementationPtr >::const_iterator cit = m_children.begin(); cit != m_children.end(); cit++ )
1751 {
1752 cit->second->flush();
1753 }
1754
1755 try
1756 {
1757 doFlush();
1758 }
1759 catch( std::exception &e )
1760 {
1761 SceneCache::Path p;
1762 std::string stringPath;
1763 path( p );
1764 IECoreScene::SceneInterface::pathToString( p, stringPath );
1765 std::string type = boost::core::demangle( typeid( e ).name() );
1766 throw IECore::IOException( boost::str( boost::format( "%1% : %2% ( for location \"%3%\" )" ) % type % e.what() % stringPath ) );
1767 }
1768 catch( ... )
1769 {
1770 SceneCache::Path p;
1771 std::string stringPath;
1772 path( p );
1773 IECoreScene::SceneInterface::pathToString( p, stringPath );
1774 throw IECore::IOException( boost::str( boost::format( "Unknown exception while flushing data ( for location %1% )" ) % stringPath ) );
1775 }
1776 }
1777
1778 void doFlush()
1779 {

Callers

nothing calls this directly

Calls 10

writeTagsFunction · 0.85
pathFunction · 0.85
pathToStringFunction · 0.85
IOExceptionFunction · 0.85
whatMethod · 0.80
strFunction · 0.50
readTagsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected