| 491 | |
| 492 | |
| 493 | int |
| 494 | BinaryFileStream::sendSelf(int commitTag, Channel &theChannel) |
| 495 | { |
| 496 | sendSelfCount++; |
| 497 | |
| 498 | Channel **theNextChannels = new Channel *[sendSelfCount]; |
| 499 | for (int i=0; i<sendSelfCount-1; i++) |
| 500 | theNextChannels[i] = theChannels[i]; |
| 501 | theNextChannels[sendSelfCount-1] = &theChannel; |
| 502 | if (theChannels != 0) |
| 503 | delete [] theChannels; |
| 504 | theChannels = theNextChannels; |
| 505 | |
| 506 | static ID idData(3); |
| 507 | int fileNameLength = 0; |
| 508 | if (fileName != 0) |
| 509 | fileNameLength = int(strlen(fileName)); |
| 510 | |
| 511 | idData(0) = fileNameLength; |
| 512 | |
| 513 | if (theOpenMode == OVERWRITE) |
| 514 | idData(1) = 0; |
| 515 | else |
| 516 | idData(1) = 1; |
| 517 | |
| 518 | idData(2) = sendSelfCount; |
| 519 | |
| 520 | if (theChannel.sendID(0, commitTag, idData) < 0) { |
| 521 | opserr << "BinaryFileStream::sendSelf() - failed to send id data\n"; |
| 522 | return -1; |
| 523 | } |
| 524 | |
| 525 | if (fileNameLength != 0) { |
| 526 | Message theMessage(fileName, fileNameLength); |
| 527 | if (theChannel.sendMsg(0, commitTag, theMessage) < 0) { |
| 528 | opserr << "BinaryFileStream::sendSelf() - failed to send message\n"; |
| 529 | return -1; |
| 530 | } |
| 531 | } |
| 532 | |
| 533 | return 0; |
| 534 | } |
| 535 | |
| 536 | int |
| 537 | BinaryFileStream::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) |