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

Method recvSelf

DEVELOPER/core/BinaryFileStream.cpp:536–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534}
535
536int
537BinaryFileStream::recvSelf(int commitTag, Channel &theChannel, FEM_ObjectBroker &theBroker)
538{
539 static ID idData(3);
540
541 sendSelfCount = -1;
542 theChannels = new Channel *[1];
543 theChannels[0] = &theChannel;
544
545 if (theChannel.recvID(0, commitTag, idData) < 0) {
546 opserr << "BinaryFileStream::recvSelf() - failed to recv id data\n";
547 return -1;
548 }
549
550 int fileNameLength = idData(0);
551 if (idData(1) == 0)
552 theOpenMode = OVERWRITE;
553 else
554 theOpenMode = APPEND;
555
556 if (fileNameLength != 0) {
557 if (fileName != 0)
558 delete [] fileName;
559 fileName = new char[fileNameLength+5];
560 if (fileName == 0) {
561 opserr << "BinaryFileStream::recvSelf() - out of memory\n";
562 return -1;
563 }
564
565 Message theMessage(fileName, fileNameLength);
566 if (theChannel.recvMsg(0, commitTag, theMessage) < 0) {
567 opserr << "BinaryFileStream::recvSelf() - failed to recv message\n";
568 return -1;
569 }
570
571 int tag = idData(2);
572
573 sprintf(&fileName[fileNameLength],".%d",tag);
574
575 if (this->setFile(fileName, theOpenMode) < 0) {
576 opserr << "BinaryFileStream::BinaryFileStream() - setFile() failed\n";
577 if (fileName != 0) {
578 delete [] fileName;
579 fileName = 0;
580 }
581 }
582 }
583
584 return 0;
585}
586
587
588int

Callers

nothing calls this directly

Calls 3

setFileMethod · 0.95
recvIDMethod · 0.45
recvMsgMethod · 0.45

Tested by

no test coverage detected