Abstract base class for each actual BinaryReader class.
Handles registrations and storing of every BinaryReader instance. BinaryReaders implement Singleton design pattern.
Definition at line 51 of file BinaryReader.hh.
Constructs a Binary object by reading data from the given binary stream.
Looks for the concrete binary reader class that can read the given binary stream. If found, that reader is used to read and construct a Binary object. This method cleans keytables of reference manager so after running this method reference manager contain keys of just read binary file.
- Parameters
-
stream | Stream to read binarys data from. |
- Returns
- Binary that was created from the given stream.
- Exceptions
-
Definition at line 88 of file BinaryReader.cc.
91 unsigned long startPos = stream.readPosition();
93 set<BinaryReader*>::iterator readers =
prototypes_->begin();
98 assert(stream.readPosition() == startPos);
100 if ((*readers)->isMyStreamType(stream)) {
103 assert(stream.readPosition() == startPos);
107 Binary *
readBinary = (*readers)->readData(stream);
112 std::stringstream newErrorMsg;
114 <<
"Error was probably caused by a broken input file."
116 <<
"Unresolved references during reading: ";
131 std::stringstream newErrorMsg;
133 <<
"Error was probably caused by a broken input file."
135 <<
"Unresolved references during finalization of "
156 "Cannot find suitable reader implementation for file.");
References __func__, assert, TPEF::ReferenceManager::SafePointer::cleanupKeyTables(), Exception::errorMessage(), TPEF::SectionReader::finalizeBinary(), prototypes_, TPEF::BinaryStream::readPosition(), TPEF::ReferenceManager::SafePointer::resolve(), and Exception::setCause().
Referenced by TTAProgram::Program::loadFromTPEF(), TTAProgram::Program::loadFromUnscheduledTPEF(), loadInputs(), loadTPEF(), and main().