void saveRevTrie(revtrie T, FILE *f) { unsigned long long aux; if (fwrite(&T->n,sizeof(uint),1,f) != 1) { fprintf(stderr,"Error: Cannot write RevTrie on file\n"); exit(1); } saveParentheses(f, T->pdata); // stores the bitstring indicating the empty nodes if (fwrite(T->B->data,sizeof(uint),(T->n+W-1)/W,f) != (T->n+W-1)/W) { fprintf(stderr,"Error: Cannot write RevTrie on file\n"); exit(1); } saveBitmap(f, T->B); // stores the array of elements of the rids permutation if (fwrite(&PARAMETER_T_RIDS,sizeof(uint),1,f) != 1) { fprintf(stderr,"Error: Cannot write RevTrie on file\n"); exit(1); } if (savePerm(T->rids,f) == -1) { fprintf (stderr,"Error: Cannot write RevTrie on file\n"); exit(1); } }
void saveLZTrie(lztrie T, FILE *f) { unsigned long long aux; // stores n, the number of nodes in LZTrie if (fwrite(&T->n,sizeof(uint),1,f) != 1) { fprintf(stderr,"Error: Cannot write LZTrie on file\n"); exit(1); } // stores the parentheses structure of LZTrie saveParentheses(f, T->pdata); // stores the letters labeling the edges of the trie, in preorder if (fwrite(T->letters,sizeof(byte),T->n,f) != T->n) { fprintf(stderr,"Error: Cannot write LZTrie on file\n"); exit(1); } // stores the array of elements of the id permutation if (savePerm(T->ids, f) == -1) { fprintf(stderr,"Error: Cannot write LZTrie on file\n"); exit(1); } }
uint static_permutation_mrrr::save(FILE *fp) { uint wr = STATIC_PERMUTATION_MRRR_HDR; wr = fwrite(&wr,sizeof(uint),1,fp); if(wr!=1) return 1; return savePerm(permutation,fp); }
void PermutationMRRR::save(ostream & fp) const { uint wr = MRRRPERM; saveValue(fp,wr); savePerm(permutation,fp); }