Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

defaultsequenceiterator.cpp

Go to the documentation of this file.
00001 // PTF - Psychological Test Framework 00002 // http://ptf.sourceforge.net 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Library General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 #include <ptf/core/defaultsequenceiterator.hpp> 00019 #include <ptf/core/ptfcore.hpp> 00020 #include <stdexcept> 00021 00025 DefaultSequenceIterator::DefaultSequenceIterator(){ 00026 next = 0; 00027 } 00028 00032 DefaultSequenceIterator::~DefaultSequenceIterator(){ 00033 // nothing to do here 00034 } 00035 00040 bool DefaultSequenceIterator::hasNextTaskId(){ 00041 return ((PtfCore::getSingleton().getSequences().size() > 0) && 00042 (PtfCore::getSingleton().getSequences()[0]->size() > next)); 00043 } 00044 00050 int DefaultSequenceIterator::getNextTaskId(){ 00051 // get vector with sequences 00052 vector<Sequence*>& sequences = PtfCore::getSingleton().getSequences(); 00053 // are there more task ids? 00054 if (hasNextTaskId()) { 00055 // return next task id from sequence 0 and increase step count 00056 return (sequences[0]->getTaskId(next++)); 00057 } 00058 else { 00059 PtfCore::getSingleton().getMessageLog() 00060 << "ERROR: Sequence has no more task ids.\n"; 00061 throw std::runtime_error("Sequence has no more task ids."); 00062 } 00063 }

Generated on Fri Dec 17 14:54:23 2004 for Psychological Test Framework by doxygen 1.3.8