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

Method recvSelf

SRC/handler/BinaryFileStream.cpp:537–586  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

setFileMethod · 0.95
recvIDMethod · 0.45
recvMsgMethod · 0.45

Tested by

no test coverage detected