void deSerialize(node **root, string *fp){
	if((*fp).length()<1)
		return;
	int i = (*fp).find(" ");
	int data = stoi((*fp).substr(0, i));
	*fp = (*fp).substr(i+1);
	if(data == -1)
		return;
	node *n = newNode(data);

	if(*root == NULL)
		*root = n;
	deSerialize(&(*root)->left, fp);
	deSerialize(&(*root)->right, fp);
}
Exemplo n.º 2
0
Arquivo: main.c Projeto: r0fls/skvs
int main(){
    FILE *fp,*fp2;
    fp = fopen("test.db","r");
    node *j = NULL;
    j = deSerialize(fp);
    close(fp);
    update_node(j,"key13","newavalue2");
    update_node(j,"key14","newavalue2");
    update_node(j,"key15","newavalue2");
    update_node(j,"key16","newavalue2");
    update_node(j,"key17","newavalue2");
    fp2 = fopen("test2.db","w");
    serialize(fp2,j);
    close(fp2);
}
Exemplo n.º 3
0
std::vector<ServerListSpec> getLocal()
{
	std::string path = ServerList::getFilePath();
	std::string liststring;
	if (fs::PathExists(path)) {
		std::ifstream istream(path.c_str());
		if (istream.is_open()) {
			std::ostringstream ostream;
			ostream << istream.rdbuf();
			liststring = ostream.str();
			istream.close();
		}
	}

	return deSerialize(liststring);
}
int main(){
	node *root        = newNode(20);
    root->left               = newNode(8);
    root->right              = newNode(22);
    root->left->left         = newNode(4);
    root->left->right        = newNode(12);
    root->left->right->left  = newNode(10);
    root->left->right->right = newNode(14);

    string fp = serialize(root);
    cout<<fp<<'\n';

    // Let us deserialize the storeed tree into root1
    node *root1 = NULL;
    deSerialize(&root1, &fp);

    //printf("Inorder Traversal of the tree constructed from file:\n");
    printInorder(root1);
	return 0;
}
void InventoryLocation::deSerialize(std::string s)
{
	std::istringstream is(s, std::ios::binary);
	deSerialize(is);
}
Exemplo n.º 6
0
DSDetails::DSDetails(uchar *buffer)
	{
	deSerialize(buffer);
	}
Exemplo n.º 7
0
HistoryEntry::HistoryEntry(const QJsonObject & json)
{
    deSerialize(json);
}
Exemplo n.º 8
0
GetDSDetailsMessage::GetDSDetailsMessage(uchar *buffer) {name=NULL; deSerialize(buffer); }
Exemplo n.º 9
0
ByeMessage::ByeMessage(uchar *buffer) { deSerialize(buffer); }