Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. bool Tree::serialize(ISerializer& inout, bool toread) {
  2.     inout.InOut(this->currentMatrix);
  3.     inout.InOut(this->modelMatrix);
  4.  
  5.     inout.InOut(this->level);
  6.     inout.InOut(this->iamleaf);
  7.  
  8.     printMatrix(this->currentMatrix);
  9.     printMatrix(this->modelMatrix);    
  10.  
  11.     int size;
  12.     if (toread == false) {
  13.         size = this->descendants.size();
  14.     }
  15.  
  16.     inout.InOut(size);
  17.     cout << "size: "<<size<<endl;
  18.     if (toread == false) {
  19.         for (int i = 0; i < size; ++i) {
  20.             this->descendants[i]->serialize(inout, toread);
  21.         }          
  22.     }
  23.     else {
  24.         Tree * tmpTree = new Tree();
  25.         for (int i = 0; i < size; ++i) {
  26.             tmpTree->serialize(inout, toread);
  27.             this->descendants.push_back(tmpTree);
  28.         }
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement