| 62 | } |
| 63 | |
| 64 | static void ApplyCreateNode |
| 65 | ( |
| 66 | FILE *stream, // effects stream |
| 67 | GraphContext *gc // graph to operate on |
| 68 | ) { |
| 69 | //-------------------------------------------------------------------------- |
| 70 | // effect format: |
| 71 | // label count |
| 72 | // labels |
| 73 | // attribute count |
| 74 | // attributes (id,value) pair |
| 75 | //-------------------------------------------------------------------------- |
| 76 | |
| 77 | //-------------------------------------------------------------------------- |
| 78 | // read label count |
| 79 | //-------------------------------------------------------------------------- |
| 80 | |
| 81 | ushort lbl_count; |
| 82 | fread_assert(&lbl_count, sizeof(lbl_count), stream); |
| 83 | |
| 84 | //-------------------------------------------------------------------------- |
| 85 | // read labels |
| 86 | //-------------------------------------------------------------------------- |
| 87 | |
| 88 | LabelID labels[lbl_count]; |
| 89 | for(ushort i = 0; i < lbl_count; i++) { |
| 90 | fread_assert(labels + i, sizeof(LabelID), stream); |
| 91 | } |
| 92 | |
| 93 | //-------------------------------------------------------------------------- |
| 94 | // read attributes |
| 95 | //-------------------------------------------------------------------------- |
| 96 | |
| 97 | AttributeSet attr_set = ReadAttributeSet(stream); |
| 98 | |
| 99 | //-------------------------------------------------------------------------- |
| 100 | // create node |
| 101 | //-------------------------------------------------------------------------- |
| 102 | |
| 103 | Node n = GE_NEW_NODE(); |
| 104 | CreateNode(gc, &n, labels, lbl_count, attr_set, false); |
| 105 | } |
| 106 | |
| 107 | static void ApplyCreateEdge |
| 108 | ( |
no test coverage detected