MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / recvSelf

Method recvSelf

SRC/handler/DataFileStreamAdd.cpp:708–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

706}
707
708int
709DataFileStreamAdd::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
710{
711 static ID idData(3);
712
713 sendSelfCount = -1;
714 theChannels = new Channel *[1];
715 theChannels[0] = &theChannel;
716
717 if (theChannel.recvID(0, commitTag, idData) < 0) {
718 opserr << "DataFileStreamAdd::recvSelf() - failed to recv id data\n";
719 return -1;
720 }
721
722 int fileNameLength = idData(0);
723 if (idData(1) == 0)
724 theOpenMode = OVERWRITE;
725 else
726 theOpenMode = APPEND;
727
728 if (fileNameLength != 0) {
729 if (fileName != 0)
730 delete [] fileName;
731 fileName = new char[fileNameLength+10];
732 if (fileName == 0) {
733 opserr << "DataFileStreamAdd::recvSelf() - out of memory\n";
734 return -1;
735 }
736
737 Message theMessage(fileName, fileNameLength);
738 if (theChannel.recvMsg(0, commitTag, theMessage) < 0) {
739 opserr << "DataFileStreamAdd::recvSelf() - failed to recv message\n";
740 return -1;
741 }
742
743 int tag = idData(2);
744
745 sprintf(&fileName[fileNameLength],".%d",tag);
746
747 if (this->setFile(fileName, theOpenMode) < 0) {
748 opserr << "DataFileStreamAdd::DataFileStreamAdd() - setFile() failed\n";
749 if (fileName != 0) {
750 delete [] fileName;
751 fileName = 0;
752 }
753 }
754 }
755
756 return 0;
757}
758
759
760void

Callers

nothing calls this directly

Calls 3

setFileMethod · 0.95
recvIDMethod · 0.45
recvMsgMethod · 0.45

Tested by

no test coverage detected