Add binary tree class for reading otb

This commit is contained in:
Eduardo Bart
2012-06-24 10:05:44 -03:00
parent dbf5e8266b
commit e65a8456e9
10 changed files with 209 additions and 37 deletions

View File

@@ -21,6 +21,7 @@
*/
#include "filestream.h"
#include "binarytree.h"
#include <framework/application.h>
#include <physfs.h>
@@ -246,6 +247,17 @@ std::string FileStream::getString()
return str;
}
BinaryTreePtr FileStream::getBinaryTree()
{
BinaryTreePtr root = BinaryTreePtr(new BinaryTree);
uint8 byte = getU8();
if(byte == BINARYTREE_NODE_START)
root->unserialize(asFileStream());
else
stdext::throw_exception(stdext::format("failed to read node start (getFirstNode): %d", byte));
return root;
}
void FileStream::addU8(uint8 v)
{
if(!m_caching) {