| 40 | } |
| 41 | |
| 42 | static void loadRecursive(QDataStream &stream, Node *node, int maxCatCount) |
| 43 | { |
| 44 | bool hasChildren; stream >> hasChildren; |
| 45 | |
| 46 | if (!hasChildren) { |
| 47 | stream >> node->value; |
| 48 | node->left = node->right = NULL; |
| 49 | } else { |
| 50 | if (maxCatCount > 0) |
| 51 | for (int i = 0; i < (maxCatCount + 31)/32; i++) { |
| 52 | int s; stream >> s; node->subset.append(s); |
| 53 | } |
| 54 | else |
| 55 | stream >> node->threshold; |
| 56 | |
| 57 | stream >> node->featureIdx; |
| 58 | |
| 59 | node->left = new Node; node->right = new Node; |
| 60 | loadRecursive(stream, node->left, maxCatCount); |
| 61 | loadRecursive(stream, node->right, maxCatCount); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | static void storeRecursive(QDataStream &stream, const Node *node, int maxCatCount) |
| 66 | { |