| 105 | } |
| 106 | |
| 107 | static void ApplyCreateEdge |
| 108 | ( |
| 109 | FILE *stream, // effects stream |
| 110 | GraphContext *gc // graph to operate on |
| 111 | ) { |
| 112 | //-------------------------------------------------------------------------- |
| 113 | // effect format: |
| 114 | // effect type |
| 115 | // relationship count |
| 116 | // relationships |
| 117 | // src node ID |
| 118 | // dest node ID |
| 119 | // attribute count |
| 120 | // attributes (id,value) pair |
| 121 | //-------------------------------------------------------------------------- |
| 122 | |
| 123 | //-------------------------------------------------------------------------- |
| 124 | // read relationship type count |
| 125 | //-------------------------------------------------------------------------- |
| 126 | |
| 127 | ushort rel_count; |
| 128 | fread_assert(&rel_count, sizeof(rel_count), stream); |
| 129 | ASSERT(rel_count == 1); |
| 130 | |
| 131 | //-------------------------------------------------------------------------- |
| 132 | // read relationship type |
| 133 | //-------------------------------------------------------------------------- |
| 134 | |
| 135 | RelationID r; |
| 136 | fread_assert(&r, sizeof(r), stream); |
| 137 | |
| 138 | //-------------------------------------------------------------------------- |
| 139 | // read src node ID |
| 140 | //-------------------------------------------------------------------------- |
| 141 | |
| 142 | NodeID src_id; |
| 143 | fread_assert(&src_id, sizeof(NodeID), stream); |
| 144 | |
| 145 | //-------------------------------------------------------------------------- |
| 146 | // read dest node ID |
| 147 | //-------------------------------------------------------------------------- |
| 148 | |
| 149 | NodeID dest_id; |
| 150 | fread_assert(&dest_id, sizeof(NodeID), stream); |
| 151 | |
| 152 | //-------------------------------------------------------------------------- |
| 153 | // read attributes |
| 154 | //-------------------------------------------------------------------------- |
| 155 | |
| 156 | AttributeSet attr_set = ReadAttributeSet(stream); |
| 157 | |
| 158 | //-------------------------------------------------------------------------- |
| 159 | // create edge |
| 160 | //-------------------------------------------------------------------------- |
| 161 | |
| 162 | Edge e; |
| 163 | CreateEdge(gc, &e, src_id, dest_id, r, attr_set, false); |
| 164 | } |
no test coverage detected