| 552 | } |
| 553 | |
| 554 | int |
| 555 | FileStream::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker) |
| 556 | { |
| 557 | static ID idData(2); |
| 558 | |
| 559 | if (theChannel.recvID(0, commitTag, idData) < 0) { |
| 560 | opserr << "FileStream::recvSelf() - failed to recv id data\n"; |
| 561 | return -1; |
| 562 | } |
| 563 | |
| 564 | int fileNameLength = idData(0); |
| 565 | if (idData(1) == 0) |
| 566 | theOpenMode = OVERWRITE; |
| 567 | else |
| 568 | theOpenMode = APPEND; |
| 569 | |
| 570 | if (fileNameLength != 0) { |
| 571 | if (fileName != 0) |
| 572 | delete [] fileName; |
| 573 | fileName = new char[fileNameLength+5]; |
| 574 | if (fileName == 0) { |
| 575 | opserr << "FileStream::recvSelf() - out of memory\n"; |
| 576 | return -1; |
| 577 | } |
| 578 | |
| 579 | Message theMessage(fileName, fileNameLength); |
| 580 | if (theChannel.recvMsg(0, commitTag, theMessage) < 0) { |
| 581 | opserr << "FileStream::recvSelf() - failed to recv message\n"; |
| 582 | return -1; |
| 583 | } |
| 584 | sprintf(&fileName[fileNameLength],".%d",commitTag); |
| 585 | |
| 586 | if (this->setFile(fileName, theOpenMode) < 0) { |
| 587 | opserr << "FileStream::FileStream() - setFile() failed\n"; |
| 588 | if (fileName != 0) { |
| 589 | delete [] fileName; |
| 590 | fileName = 0; |
| 591 | } |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | return 0; |
| 596 | } |
| 597 | |
| 598 | |
| 599 | void |