tclpkg-trialevent.cc

Go to the documentation of this file.
00001 
00003 
00004 //
00005 // Copyright (c) 2003-2004 California Institute of Technology
00006 // Copyright (c) 2004-2007 University of Southern California
00007 // Rob Peters <rjpeters at usc dot edu>
00008 //
00009 // created: Thu May 22 14:37:17 2003
00010 // commit: $Id: tclpkg-trialevent.cc 10065 2007-04-12 05:54:56Z rjpeters $
00011 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/visx/tclpkg-trialevent.cc $
00012 //
00013 // --------------------------------------------------------------------
00014 //
00015 // This file is part of GroovX.
00016 //   [http://ilab.usc.edu/rjpeters/groovx/]
00017 //
00018 // GroovX is free software; you can redistribute it and/or modify it
00019 // under the terms of the GNU General Public License as published by
00020 // the Free Software Foundation; either version 2 of the License, or
00021 // (at your option) any later version.
00022 //
00023 // GroovX is distributed in the hope that it will be useful, but
00024 // WITHOUT ANY WARRANTY; without even the implied warranty of
00025 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00026 // General Public License for more details.
00027 //
00028 // You should have received a copy of the GNU General Public License
00029 // along with GroovX; if not, write to the Free Software Foundation,
00030 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00031 //
00033 
00034 #ifndef GROOVX_VISX_TCLPKG_TRIALEVENT_CC_UTC20050628171009_DEFINED
00035 #define GROOVX_VISX_TCLPKG_TRIALEVENT_CC_UTC20050628171009_DEFINED
00036 
00037 #include "visx/tclpkg-trialevent.h"
00038 
00039 #include "io/outputfile.h"
00040 
00041 #include "nub/objfactory.h"
00042 
00043 #include "tcl/itertcl.h"
00044 #include "tcl/objpkg.h"
00045 #include "tcl/pkg.h"
00046 
00047 #include "visx/trialevent.h"
00048 
00049 #include <typeinfo>
00050 
00051 #include "rutz/trace.h"
00052 
00053 namespace
00054 {
00055   typedef TrialEvent* (CreatorFunc)();
00056 
00057   int addEventType(Tcl_Interp* interp,
00058                    CreatorFunc* func,
00059                    const char* name) throw()
00060   {
00061     GVX_PKG_CREATE(pkg, interp, name, "4.$Revision: 10065 $");
00062     nub::obj_factory::instance().register_creator(func, name);
00063     pkg->inherit_pkg("TrialEvent");
00064 
00065     GVX_PKG_RETURN(pkg);
00066   }
00067 
00068   void addEvents(nub::ref<MultiEvent> multi, tcl::list event_ids)
00069   {
00070     tcl::list::iterator<nub::ref<TrialEvent> >
00071       itr = event_ids.begin<nub::ref<TrialEvent> >(),
00072       end = event_ids.end<nub::ref<TrialEvent> >();
00073 
00074     while (itr != end)
00075       {
00076         multi->addEvent(*itr);
00077         ++itr;
00078       }
00079   }
00080 }
00081 
00082 extern "C"
00083 int Trialevent_Init(Tcl_Interp* interp)
00084 {
00085 GVX_TRACE("Trialevent_Init");
00086 
00087   GVX_PKG_CREATE(pkg, interp, "TrialEvent", "4.$Revision: 10065 $");
00088   pkg->inherit_pkg("io");
00089   tcl::def_basic_type_cmds<TrialEvent>(pkg, SRC_POS);
00090 
00091   pkg->def_get_set("delay", &TrialEvent::getDelay, &TrialEvent::setDelay, SRC_POS);
00092 
00093   GVX_PKG_FINISH(pkg);
00094 
00095   addEventType(interp, &makeAbortTrialEvent, "AbortTrialEvent");
00096   addEventType(interp, &makeDrawEvent, "DrawEvent");
00097   addEventType(interp, &makeRenderEvent, "RenderEvent");
00098   addEventType(interp, &makeUndrawEvent, "UndrawEvent");
00099   addEventType(interp, &makeEndTrialEvent, "EndTrialEvent");
00100   addEventType(interp, &makeNextNodeEvent, "NextNodeEvent");
00101   addEventType(interp, &makeAllowResponsesEvent, "AllowResponsesEvent");
00102   addEventType(interp, &makeDenyResponsesEvent, "DenyResponsesEvent");
00103   addEventType(interp, &makeSwapBuffersEvent, "SwapBuffersEvent");
00104   addEventType(interp, &makeRenderBackEvent, "RenderBackEvent");
00105   addEventType(interp, &makeRenderFrontEvent, "RenderFrontEvent");
00106   addEventType(interp, &makeClearBufferEvent, "ClearBufferEvent");
00107   addEventType(interp, &makeFinishDrawingEvent, "FinishDrawingEvent");
00108 
00109   return GVX_PKG_STATUS;
00110 }
00111 
00112 extern "C"
00113 int Nulltrialevent_Init(Tcl_Interp* interp)
00114 {
00115 GVX_TRACE("Nulltrialevent_Init");
00116 
00117   GVX_PKG_CREATE(pkg, interp, "NullTrialEvent", "4.$Revision: 10065 $");
00118   pkg->inherit_pkg("TrialEvent");
00119   tcl::def_creator<NullTrialEvent>(pkg);
00120 
00121   GVX_PKG_RETURN(pkg);
00122 }
00123 
00124 extern "C"
00125 int Filewriteevent_Init(Tcl_Interp* interp)
00126 {
00127 GVX_TRACE("Filewriteevent_Init");
00128 
00129   GVX_PKG_CREATE(pkg, interp, "FileWriteEvent", "4.$Revision: 10065 $");
00130   pkg->inherit_pkg("TrialEvent");
00131   tcl::def_creator<FileWriteEvent>(pkg);
00132 
00133   pkg->def_get_set("file",
00134                    &FileWriteEvent::getFile,
00135                    &FileWriteEvent::setFile,
00136                    SRC_POS);
00137   pkg->def_get_set("byte",
00138                    &FileWriteEvent::getByte,
00139                    &FileWriteEvent::setByte,
00140                    SRC_POS);
00141 
00142   GVX_PKG_RETURN(pkg);
00143 }
00144 
00145 extern "C"
00146 int Genericevent_Init(Tcl_Interp* interp)
00147 {
00148 GVX_TRACE("Genericevent_Init");
00149 
00150   GVX_PKG_CREATE(pkg, interp, "GenericEvent", "4.$Revision: 10065 $");
00151   pkg->inherit_pkg("TrialEvent");
00152   tcl::def_creator<GenericEvent>(pkg);
00153 
00154   pkg->def_getter("callback", &GenericEvent::getCallback, SRC_POS);
00155   pkg->def_setter("callback", &GenericEvent::setCallback, SRC_POS);
00156 
00157   GVX_PKG_RETURN(pkg);
00158 }
00159 
00160 extern "C"
00161 int Multievent_Init(Tcl_Interp* interp)
00162 {
00163 GVX_TRACE("Multievent_Init");
00164 
00165   GVX_PKG_CREATE(pkg, interp, "MultiEvent", "4.$Revision: 10065 $");
00166   pkg->inherit_pkg("TrialEvent");
00167   tcl::def_creator<MultiEvent>(pkg);
00168 
00169   pkg->def_getter("events", &MultiEvent::getEvents, SRC_POS);
00170   pkg->def("addEvent", "<this> event_id", &MultiEvent::addEvent, SRC_POS);
00171   pkg->def("addEvents", "<this> event_id(s)", &addEvents, SRC_POS);
00172   pkg->def("eraseEventAt", "<this> index", &MultiEvent::eraseEventAt, SRC_POS);
00173   pkg->def("clearEvents", "<this>", &MultiEvent::clearEvents, SRC_POS);
00174 
00175   GVX_PKG_RETURN(pkg);
00176 }
00177 
00178 static const char __attribute__((used)) vcid_groovx_visx_tclpkg_trialevent_cc_utc20050628171009[] = "$Id: tclpkg-trialevent.cc 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00179 #endif // !GROOVX_VISX_TCLPKG_TRIALEVENT_CC_UTC20050628171009_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.