add an entity update effect to buffer
| 527 | |
| 528 | // add an entity update effect to buffer |
| 529 | static void EffectsBuffer_AddEdgeUpdateEffect |
| 530 | ( |
| 531 | EffectsBuffer *buff, // effect buffer |
| 532 | Edge *edge, // updated edge |
| 533 | Attribute_ID attr_id, // updated attribute ID |
| 534 | SIValue value // value |
| 535 | ) { |
| 536 | //-------------------------------------------------------------------------- |
| 537 | // effect format: |
| 538 | // effect type |
| 539 | // edge ID |
| 540 | // relation ID |
| 541 | // src ID |
| 542 | // dest ID |
| 543 | // attribute count (=n) |
| 544 | // attributes (id,value) pair |
| 545 | //-------------------------------------------------------------------------- |
| 546 | |
| 547 | EffectType t = EFFECT_UPDATE_EDGE; |
| 548 | EffectsBuffer_WriteBytes(&t, sizeof(t), buff); |
| 549 | |
| 550 | //-------------------------------------------------------------------------- |
| 551 | // write edge ID |
| 552 | //-------------------------------------------------------------------------- |
| 553 | |
| 554 | EffectsBuffer_WriteBytes(&ENTITY_GET_ID(edge), sizeof(EntityID), buff); |
| 555 | |
| 556 | //-------------------------------------------------------------------------- |
| 557 | // write relation ID |
| 558 | //-------------------------------------------------------------------------- |
| 559 | |
| 560 | RelationID r = Edge_GetRelationID(edge); |
| 561 | EffectsBuffer_WriteBytes(&r, sizeof(RelationID), buff); |
| 562 | |
| 563 | //-------------------------------------------------------------------------- |
| 564 | // write src ID |
| 565 | //-------------------------------------------------------------------------- |
| 566 | |
| 567 | NodeID s = Edge_GetSrcNodeID(edge); |
| 568 | EffectsBuffer_WriteBytes(&s, sizeof(NodeID), buff); |
| 569 | |
| 570 | //-------------------------------------------------------------------------- |
| 571 | // write dest ID |
| 572 | //-------------------------------------------------------------------------- |
| 573 | |
| 574 | NodeID d = Edge_GetDestNodeID(edge); |
| 575 | EffectsBuffer_WriteBytes(&d, sizeof(NodeID), buff); |
| 576 | |
| 577 | //-------------------------------------------------------------------------- |
| 578 | // write attribute ID |
| 579 | //-------------------------------------------------------------------------- |
| 580 | |
| 581 | EffectsBuffer_WriteBytes(&attr_id, sizeof(Attribute_ID), buff); |
| 582 | |
| 583 | //-------------------------------------------------------------------------- |
| 584 | // write attribute value |
| 585 | //-------------------------------------------------------------------------- |
| 586 |
no test coverage detected