| 618 | |
| 619 | |
| 620 | int |
| 621 | DataFileStream::sendSelf(int commitTag, Channel &theChannel) |
| 622 | { |
| 623 | sendSelfCount++; |
| 624 | |
| 625 | Channel **theNextChannels = new Channel *[sendSelfCount]; |
| 626 | for (int i=0; i<sendSelfCount-1; i++) |
| 627 | theNextChannels[i] = theChannels[i]; |
| 628 | theNextChannels[sendSelfCount-1] = &theChannel; |
| 629 | if (theChannels != 0) |
| 630 | delete [] theChannels; |
| 631 | theChannels = theNextChannels; |
| 632 | |
| 633 | static ID idData(3); |
| 634 | int fileNameLength = 0; |
| 635 | if (fileName != 0) |
| 636 | fileNameLength = int(strlen(fileName)); |
| 637 | |
| 638 | idData(0) = fileNameLength; |
| 639 | |
| 640 | if (theOpenMode == OVERWRITE) |
| 641 | idData(1) = 0; |
| 642 | else |
| 643 | idData(1) = 1; |
| 644 | |
| 645 | idData(2) = sendSelfCount; |
| 646 | |
| 647 | if (theChannel.sendID(0, commitTag, idData) < 0) { |
| 648 | opserr << "DataFileStream::sendSelf() - failed to send id data\n"; |
| 649 | return -1; |
| 650 | } |
| 651 | |
| 652 | if (fileNameLength != 0) { |
| 653 | Message theMessage(fileName, fileNameLength); |
| 654 | if (theChannel.sendMsg(0, commitTag, theMessage) < 0) { |
| 655 | opserr << "DataFileStream::sendSelf() - failed to send message\n"; |
| 656 | return -1; |
| 657 | } |
| 658 | } |
| 659 | |
| 660 | return 0; |
| 661 | } |
| 662 | |
| 663 | int |
| 664 | DataFileStream::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) |