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 #ifndef __PTFCORE__ 00019 #define __PTFCORE__ 00020 00021 #include <ptf/core/scheduler.hpp> 00022 #include <ptf/core/sequenceiterator.hpp> 00023 #include <ptf/core/reactionhandler.hpp> 00024 #include <ptf/core/sequence.hpp> 00025 #include <ptf/core/reactionrecord.hpp> 00026 #include <ptf/core/taskrecord.hpp> 00027 #include <ptf/core/task.hpp> 00028 #include <ptf/input/inputdevice.hpp> 00029 #include <cc++/thread.h> 00030 #include <ptf/core/defaultsequenceiterator.hpp> 00031 #include <ptf/core/log.hpp> 00032 00033 // bring things into scope 00034 using ost::Mutex; 00035 00039 class PtfCore : public Singleton<PtfCore> { 00040 public: 00041 PtfCore(int, char**); 00042 ~PtfCore(); 00043 void run(); 00044 void setScheduler(Scheduler*); 00045 void setReactionHandler(ReactionHandler*); 00046 void setSequenceIterator(SequenceIterator*); 00047 Scheduler& getScheduler(); 00048 ReactionHandler& getReactionHandler(); 00049 SequenceIterator& getSequenceIterator(); 00050 vector<Sequence*>& getSequences(); 00051 vector<ReactionRecord*>& getReactionRecords(); 00052 vector<TaskRecord*>& getTaskRecords(); 00053 vector<InputDevice*>& getInputDevices(); 00054 Mutex& getReactionRecordsMutex(); 00055 Mutex& getTaskRecordsMutex(); 00056 void taskRegistrationHelper(Task*); 00057 const vector<Task*>& getTasks() const; 00058 Log& getMessageLog(); 00059 Log& getHandlerLog(); 00060 Log& getTaskLog(); 00061 Log& getEventLog(); 00062 Log& getMachineLog(); 00063 protected: 00064 Scheduler* scheduler; 00065 ReactionHandler* handler; 00066 SequenceIterator* iterator; 00067 vector<Sequence*> sequences; 00068 vector<ReactionRecord*> reactionRecords; 00069 vector<TaskRecord*> taskRecords; 00070 vector<Task*> tasks; 00071 vector<InputDevice*> inputDevices; 00072 Mutex reactionRecordsMutex; 00073 Mutex taskRecordsMutex; 00074 Log messageLog; 00075 Log handlerLog; 00076 Log taskLog; 00077 Log eventLog; 00078 Log machineLog; 00079 }; 00080 00081 #endif