| 1897 | |
| 1898 | template<typename F> |
| 1899 | NodeBase *StreamIndexedIO::Index::readNodeV5( F &f ) |
| 1900 | { |
| 1901 | char entryType; |
| 1902 | f.read( &entryType, sizeof( char ) ); |
| 1903 | |
| 1904 | uint64_t stringId; |
| 1905 | readLittleEndian( f, stringId ); |
| 1906 | |
| 1907 | if( entryType == IndexedIO::File ) |
| 1908 | { |
| 1909 | char t; |
| 1910 | IndexedIO::DataType dataType = IndexedIO::Invalid; |
| 1911 | uint64_t arrayLength = 0; |
| 1912 | f.read( &t, sizeof( char ) ); |
| 1913 | dataType = (IndexedIO::DataType) t; |
| 1914 | |
| 1915 | if( IndexedIO::Entry::isArray( dataType ) ) |
| 1916 | { |
| 1917 | readLittleEndian( f, arrayLength ); |
| 1918 | } |
| 1919 | |
| 1920 | uint64_t offset, size; |
| 1921 | readLittleEndian( f, offset ); |
| 1922 | readLittleEndian( f, size ); |
| 1923 | |
| 1924 | if( arrayLength <= SmallDataNode::maxArrayLength && size <= SmallDataNode::maxSize ) |
| 1925 | { |
| 1926 | SmallDataNode *n = new SmallDataNode( m_stringCache.findById( stringId ), dataType, arrayLength, size, offset ); |
| 1927 | return n; |
| 1928 | } |
| 1929 | else |
| 1930 | { |
| 1931 | DataNode *n = new DataNode( m_stringCache.findById( stringId ), dataType, arrayLength, size, offset, size, 0 ); |
| 1932 | return n; |
| 1933 | } |
| 1934 | } |
| 1935 | else if( entryType == IndexedIO::Directory ) |
| 1936 | { |
| 1937 | uint32_t nodeCount = 0; |
| 1938 | readLittleEndian( f, nodeCount ); |
| 1939 | |
| 1940 | DirectoryNode *n = new DirectoryNode( m_stringCache.findById( stringId ), nodeCount ); |
| 1941 | |
| 1942 | for( uint32_t c = 0; c < nodeCount; c++ ) |
| 1943 | { |
| 1944 | NodeBase *child = readNodeV5( f ); |
| 1945 | n->registerChild( child ); |
| 1946 | } |
| 1947 | // force sorting all children so that read-only is multi-threaded |
| 1948 | n->sortChildren(); |
| 1949 | return n; |
| 1950 | } |
| 1951 | else if( entryType == SUBINDEX_DIR ) |
| 1952 | { |
| 1953 | uint64_t offset; |
| 1954 | readLittleEndian( f, offset ); |
| 1955 | SubIndexNode *n = new SubIndexNode( m_stringCache.findById( stringId ), offset ); |
| 1956 | return n; |
nothing calls this directly
no test coverage detected