00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
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