trial.h

Go to the documentation of this file.
00001 
00004 
00005 //
00006 // Copyright (c) 1999-2004 California Institute of Technology
00007 // Copyright (c) 2004-2007 University of Southern California
00008 // Rob Peters <rjpeters at usc dot edu>
00009 //
00010 // created: Mon Mar  1 08:00:00 1999
00011 // commit: $Id: trial.h 10065 2007-04-12 05:54:56Z rjpeters $
00012 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/visx/trial.h $
00013 //
00014 // --------------------------------------------------------------------
00015 //
00016 // This file is part of GroovX.
00017 //   [http://ilab.usc.edu/rjpeters/groovx/]
00018 //
00019 // GroovX is free software; you can redistribute it and/or modify it
00020 // under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // GroovX is distributed in the hope that it will be useful, but
00025 // WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 // General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with GroovX; if not, write to the Free Software Foundation,
00031 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00032 //
00034 
00035 #ifndef GROOVX_VISX_TRIAL_H_UTC20050626084016_DEFINED
00036 #define GROOVX_VISX_TRIAL_H_UTC20050626084016_DEFINED
00037 
00038 #include "io/fields.h"
00039 
00040 #include "rutz/tracer.h"
00041 
00042 #include "visx/element.h"
00043 
00044 namespace rutz
00045 {
00046   template <class T> class fwd_iter;
00047 }
00048 
00049 namespace nub
00050 {
00051   template <class T> class ref;
00052 }
00053 
00054 class GxNode;
00055 class Response;
00056 class ResponseHandler;
00057 class TimingHdlr;
00058 
00060 class Trial : public Element, public FieldContainer
00061 {
00062 public:
00063 
00066   static rutz::tracer tracer;
00067 
00069   // creators //
00071 
00072 protected:
00073   Trial();
00074 public:
00075   static Trial* make();
00076 
00077   virtual ~Trial () throw();
00078 
00079   virtual io::version_id class_version_id() const;
00080   virtual void read_from(io::reader& reader);
00081   virtual void write_to(io::writer& writer) const;
00082 
00083   static const FieldMap& classFields();
00084 
00086   // accessors+manipulators //
00088 
00089   int getCorrectResponse() const;
00090   void setCorrectResponse(int response);
00091 
00092   nub::ref<ResponseHandler> getResponseHandler() const;
00093   void setResponseHandler(nub::ref<ResponseHandler> rh);
00094 
00095   nub::ref<TimingHdlr> getTimingHdlr() const;
00096   void setTimingHdlr(nub::ref<TimingHdlr> th);
00097 
00098   void setType(int t);
00099 
00100   rutz::fwd_iter<Response> responses() const;
00101 
00102   unsigned int numResponses() const;
00103 
00104   void clearResponses();
00105 
00106   double avgResponse() const;
00107   double avgRespTime() const;
00108 
00109   void addNode(nub::ref<GxNode> item);
00110 
00111   void trNextNode();
00112 
00114   rutz::fwd_iter<nub::ref<GxNode> > nodes() const;
00115 
00116   unsigned int getCurrentNode() const;
00117   void setCurrentNode(unsigned int nodeNumber);
00118 
00119   void clearObjs();
00120 
00122 
00124   rutz::fstring stdInfo() const;
00125 
00127 
00129   void setInfo(rutz::fstring info);
00130 
00131   //
00132   // Element interface
00133   //
00134 
00135   virtual const nub::soft_ref<Toglet>& getWidget() const;
00136 
00138   virtual int trialType() const;
00139 
00140   virtual int lastResponse() const;
00141 
00143   virtual rutz::fstring vxInfo() const;
00144 
00145   virtual void vxRun(Element& parent);
00146 
00147   virtual void vxHalt() const;
00148 
00149   virtual void vxReturn(ChildStatus s);
00150 
00151   virtual void vxUndo();
00152 
00153   virtual void vxReset();
00154 
00156   // actions //
00158 
00159   double trElapsedMsec();
00160 
00161   void trProcessResponse(Response& response);
00162   void trDraw();
00163   void trRender();
00164   void trUndraw();
00165   void trSwapBuffers();
00166   void trRenderBack();
00167   void trRenderFront();
00168   void trClearBuffer();
00169   void trFinishDrawing();
00170   void trAllowResponses();
00171   void trDenyResponses();
00172   void trAbortTrial();
00173   void trEndTrial();
00174 
00175 private:
00176   Trial(const Trial&);
00177   Trial& operator=(const Trial&);
00178 
00179   class Impl;
00180   Impl* const rep;
00181 };
00182 
00183 static const char __attribute__((used)) vcid_groovx_visx_trial_h_utc20050626084016[] = "$Id: trial.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00184 #endif // !GROOVX_VISX_TRIAL_H_UTC20050626084016_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:42 2008 by Doxygen version 1.5.5.