Example #1
0
void ArchiveParser::run (Archive &archive)
{
    ChannelIterator channel (archive);
    ValueIterator value (archive);
    stdString parameter, arg;
    bool go = true;

    while (go && nextLine ())
    {
        if (getParameter (parameter, arg))
        {
            if (parameter == "channel")
            {
                if (archive.findChannelByName (arg, channel))
                {
                    _last_time = channel->getLastTime ();
                }
                else
                {
                    if (! archive.addChannel (arg, channel))
                    {
                        printf("Cannot add channel '%s' to archive\n",
                               arg.c_str());
                        return;
                    }
                    _last_time = nullTime;
                }
            }
        }
        else
        {
            if (getLine() == "Header")
                go = handleHeader(archive);
            else if (getLine() == "CtrlInfo")
                go = handleCtrlInfo(channel);
            else
                go = handleValue(channel);
        }
    }
}