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

Method recvSelf

SRC/handler/FileStream.cpp:554–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554int
555FileStream::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
599void

Callers

nothing calls this directly

Calls 3

setFileMethod · 0.95
recvIDMethod · 0.45
recvMsgMethod · 0.45

Tested by

no test coverage detected