Beispiel #1
0
boost::uint32_t StageIterator::read(PointBuffer& buffer)
{
    readBegin();
    readBufferBegin(buffer);
    boost::uint32_t numRead = readBuffer(buffer);
    readBufferEnd(buffer);
    readEnd();

    return numRead;
}
 /*
 * Read parameter block, including begin and end.
 */
 void McSimulation::readParam(std::istream& in)
 {
    if (isRestarting_) {
       if (isInitialized_) {
          return;
       }
    }
    readBegin(in, className().c_str());
    readParameters(in);
    readEnd(in);
 }
Beispiel #3
0
void Parser::readBlock(Block& block)
{
    do {
        std::string str = readKeyword();

        switch (nextToken()) {
        case Parser::Error:
            return;
        case Parser::Begin:
            readBegin();
            readBlock(block.addBlock(str));
            readEnd();
            break;
        case Parser::Equal:
            readEqual();
            if (nextToken() == QuoteStr) {
                block.addString(str, readQuotedString());
                while (nextToken() == Parser::Comma) {
                    readComma();
                    block.addString(str, readQuotedString());
                }
            } else if (nextToken() == Real) {
                block.addReal(str, readReal());
                while (nextToken() == Parser::Comma) {
                    readComma();
                    block.addReal(str, readReal());
                }
            } else if (nextToken() == RelativeReal) {
                block.addRelativeReal(str, readRelativeReal());
                while (nextToken() == Parser::Comma) {
                    readComma();
                    block.addRelativeReal(str, readRelativeReal());
                }
            } else if (nextToken() == Str) {
                block.addString(str, readString());
                while (nextToken() == Parser::Comma) {
                    readComma();
                    block.addString(str, readString());
                }
            } else {
                throw utils::InternalError();
            }
            readSemicolon();
            break;
        default:
            throw utils::InternalError("bad file");
        };
    } while (nextToken() != Parser::End and mStream);
}
Istream& Istream::readEndBegin(const char* funcName)
{
    readEnd(funcName);
    return readBegin(funcName);
}