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

Method readNodeV4

src/IECore/StreamIndexedIO.cpp:1764–1896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1762
1763template < typename F >
1764NodeBase *StreamIndexedIO::Index::readNodeV4( F &f )
1765{
1766 char t;
1767 f.read( &t, sizeof(char) );
1768
1769 IndexedIO::EntryType entryType = (IndexedIO::EntryType)t;
1770
1771 bool isLink = false;
1772
1773 if ( t == HARDLINK ) /// only at version = 4
1774 {
1775 entryType = IndexedIO::File;
1776 isLink = true;
1777 }
1778
1779 const IndexedIO::EntryID *id;
1780 if (m_version >= 1)
1781 {
1782 uint64_t stringId;
1783 readLittleEndian(f,stringId);
1784 id = &m_stringCache.findById( stringId );
1785 }
1786 else
1787 {
1788 uint64_t entrySize;
1789 readLittleEndian( f,entrySize );
1790 char *s = new char[entrySize+1];
1791 f.read( s, entrySize );
1792 s[entrySize] = '\0';
1793 id = new IndexedIO::EntryID(s);
1794 delete[] s;
1795 }
1796
1797 IndexedIO::DataType dataType = IndexedIO::Invalid;
1798 uint64_t arrayLength = 0;
1799
1800 if ( m_version < 2 || (!isLink && entryType == IndexedIO::File) )
1801 {
1802 f.read( &t, sizeof(char) );
1803 dataType = (IndexedIO::DataType)t;
1804
1805 if ( IndexedIO::Entry::isArray( dataType ) || m_version < 3 )
1806 {
1807 readLittleEndian( f,arrayLength );
1808 }
1809 }
1810
1811 uint64_t nodeId;
1812 readLittleEndian( f,nodeId );
1813
1814 uint64_t parentId;
1815 readLittleEndian( f, parentId );
1816
1817 NodeBase *result = nullptr;
1818
1819 if ( entryType == IndexedIO::File )
1820 {
1821 uint64_t offset, size, decompressedSize = 0, numCompressedBlocks = 0;

Callers

nothing calls this directly

Calls 7

readLittleEndianFunction · 0.85
IOExceptionFunction · 0.85
nodeTypeMethod · 0.80
registerChildMethod · 0.80
readMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected