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

task.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/task.hpp> 00019 00024 Task::Task() { 00025 id = 0; 00026 setReactionWindow(0, 0, 2, 0); 00027 setWaitPrepareExecute(2, 0); 00028 setWaitExecuteFinish(2, 0); 00029 setWaitFinishNextTask(2, 0); 00030 } 00031 00040 Task::Task(int taskId, const timespec& prepExeWait, const timespec& exeFinWait, 00041 const timespec& finNextWait, const TimeInterval& window) { 00042 id = taskId; 00043 setWaitPrepareExecute(prepExeWait); 00044 setWaitExecuteFinish(exeFinWait); 00045 setWaitFinishNextTask(finNextWait); 00046 timespec a, b; 00047 window.getInterval(a, b); 00048 reactionWindow.setInterval(a, b); 00049 } 00050 00065 Task::Task(int taskId, long int prepExeWaitSec, long int prepExeWaitNano, 00066 long int exeFinWaitSec, long int exeFinWaitNano, 00067 long int finNextWaitSec, long int finNextWaitNano, 00068 long int windowStartSec, long int windowStartNano, 00069 long int windowEndSec, long int windowEndNano) { 00070 id = taskId; 00071 setWaitPrepareExecute(prepExeWaitSec, prepExeWaitNano); 00072 setWaitExecuteFinish(exeFinWaitSec, exeFinWaitNano); 00073 setWaitFinishNextTask(finNextWaitSec, finNextWaitNano); 00074 setReactionWindow(windowStartSec, windowStartNano, 00075 windowEndSec, windowEndNano); 00076 } 00077 00081 Task::Task(const Task& task) { 00082 id = task.id; 00083 reactionWindow = task.reactionWindow; 00084 waitPrepareExecute = task.waitPrepareExecute; 00085 waitExecuteFinish = task.waitExecuteFinish; 00086 waitFinishNextTask = task.waitFinishNextTask; 00087 } 00088 00092 Task::~Task() { 00093 // nothing to do here 00094 } 00095 00100 int Task::getId() const { 00101 return id; 00102 } 00103 00108 timespec Task::getWaitPrepareExecute() const { 00109 return waitPrepareExecute; 00110 } 00111 00116 timespec Task::getWaitExecuteFinish() const { 00117 return waitExecuteFinish; 00118 } 00119 00126 timespec Task::getWaitFinishNextTask() const { 00127 return waitFinishNextTask; 00128 } 00129 00134 const TimeInterval& Task::getReactionWindow() const { 00135 return reactionWindow; 00136 } 00137 00142 const vector<bool>& Task::getSuccessfulReaction() const { 00143 return successfulReaction; 00144 } 00145 00154 void Task::setReactionWindow(long int s1, long int ns1, long int s2, long int ns2) { 00155 timespec a, b; 00156 a.tv_sec = s1; a.tv_nsec = ns1; 00157 b.tv_sec = s2; b.tv_nsec = ns2; 00158 reactionWindow.setInterval(a, b); 00159 } 00160 00167 void Task::setReactionWindow(const timespec& a, const timespec& b) { 00168 reactionWindow.setInterval(a, b); 00169 } 00170 00176 void Task::setReactionWindow(const TimeInterval& time) { 00177 reactionWindow = time; 00178 } 00179 00185 void Task::setWaitPrepareExecute(long int s, long int ns) { 00186 waitPrepareExecute.tv_sec = s; 00187 waitPrepareExecute.tv_nsec = ns; 00188 } 00189 00195 void Task::setWaitExecuteFinish(long int s, long int ns) { 00196 waitExecuteFinish.tv_sec = s; 00197 waitExecuteFinish.tv_nsec = ns; 00198 } 00199 00206 void Task::setWaitFinishNextTask(long int s, long int ns) { 00207 waitFinishNextTask.tv_sec = s; 00208 waitFinishNextTask.tv_nsec = ns; 00209 } 00210 00215 void Task::setWaitPrepareExecute(const timespec& time) { 00216 waitPrepareExecute.tv_sec = time.tv_sec; 00217 waitPrepareExecute.tv_nsec = time.tv_nsec; 00218 } 00219 00224 void Task::setWaitExecuteFinish(const timespec& time) { 00225 waitExecuteFinish.tv_sec = time.tv_sec; 00226 waitExecuteFinish.tv_nsec = time.tv_nsec; 00227 } 00228 00234 void Task::setWaitFinishNextTask(const timespec& time) { 00235 waitFinishNextTask.tv_sec = time.tv_sec; 00236 waitFinishNextTask.tv_nsec = time.tv_nsec; 00237 } 00238 00243 void Task::setSuccessfulReaction(const vector<bool>& reaction) { 00244 successfulReaction = reaction; 00245 }

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