Trial Class Reference

Trial collaborates with ResponseHandler+TimingHdlr. More...

#include <visx/trial.h>

Inheritance diagram for Trial:

Inheritance graph
[legend]
Collaboration diagram for Trial:

Collaboration graph
[legend]

List of all members.

Public Types

enum  ChildStatus { CHILD_OK, CHILD_ABORTED, CHILD_REPEAT }
 Status type for child to tell its parent how it ended.

Public Member Functions

virtual io::version_id class_version_id () const
virtual void read_from (io::reader &reader)
virtual void write_to (io::writer &writer) const
int getCorrectResponse () const
void setCorrectResponse (int response)
nub::ref< ResponseHandlergetResponseHandler () const
void setResponseHandler (nub::ref< ResponseHandler > rh)
nub::ref< TimingHdlrgetTimingHdlr () const
void setTimingHdlr (nub::ref< TimingHdlr > th)
void setType (int t)
rutz::fwd_iter< Responseresponses () const
unsigned int numResponses () const
void clearResponses ()
double avgResponse () const
double avgRespTime () const
void addNode (nub::ref< GxNode > item)
void trNextNode ()
rutz::fwd_iter< nub::ref
< GxNode > > 
nodes () const
 Returns an iterator to all the nodes contained in the Trial.
unsigned int getCurrentNode () const
void setCurrentNode (unsigned int nodeNumber)
void clearObjs ()
rutz::fstring stdInfo () const
 Returns a standard set of descriptive information.
void setInfo (rutz::fstring info)
 Set the contents of what will be returned from vxInfo().
virtual const nub::soft_ref
< Toglet > & 
getWidget () const
 Return the Widget in which the experiment is running.
virtual int trialType () const
 returns some user-defined info about relationship between objects in trial
virtual int lastResponse () const
 Get the value of the last response.
virtual rutz::fstring vxInfo () const
 Overridden from Element.
virtual void vxRun (Element &parent)
 Run this element with a reference to its parent.
virtual void vxHalt () const
 Halt this element.
virtual void vxReturn (ChildStatus s)
 Called when an element's child finishes running.
virtual void vxUndo ()
 Undo one trial.
virtual void vxReset ()
 Reset this element to the starting state.
double trElapsedMsec ()
void trProcessResponse (Response &response)
void trDraw ()
void trRender ()
void trUndraw ()
void trSwapBuffers ()
void trRenderBack ()
void trRenderFront ()
void trClearBuffer ()
void trFinishDrawing ()
void trAllowResponses ()
void trDenyResponses ()
void trAbortTrial ()
void trEndTrial ()
virtual void vxEndTrialHook ()
 Hook function that gets called each time a leaf (i.e., trial) completes.
nub::uid id () const throw ()
rutz::fstring real_typename () const
 Returns the typename of the full object.
virtual rutz::fstring obj_typename () const
 Returns the (apparent) typename of the full object.
rutz::fstring unique_name () const
 Returns a short string describing the object by its typename and id.
void * operator new (size_t bytes)
void operator delete (void *space, size_t bytes)
void mark_as_volatile () throw ()
 Mark this object as a volatile (unshareable) object.
void incr_ref_count () const throw ()
 Increment the object's reference count.
void decr_ref_count () const throw ()
 Decrement the object's reference count.
void decr_ref_count_no_delete () const throw ()
 Decrement the object's reference count, but don't delete it.
bool is_shared () const throw ()
 Returns true if no external client has sole ownership of the object.
bool is_unshared () const throw ()
 Returns true if there is a sole external owner of the object.
bool is_not_shareable () const throw ()
ref_counts * get_counts () const throw ()
 Returns the object's reference count manager.
int dbg_ref_count () const throw ()
 FOR TEST/DEBUG ONLY! Returns the object's (strong) reference count.
int dbg_weak_ref_count () const throw ()
 FOR TEST/DEBUG ONLY! Returns the object's weak reference count.
void setFieldMap (const FieldMap &fields)
 Set the field map for this object.
const Fieldfield (const rutz::fstring &name) const
 Lookup the Field for a given name.
void touch () const
 Emit a signal saying that one of our values has changed.
void readFieldsFrom (io::reader &reader, const FieldMap &fields)
 Read all fields from the io::reader.
void writeFieldsTo (io::writer &writer, const FieldMap &fields, io::version_id svid) const
 Write all fields to the io::writer.
const FieldMapfields () const
 Get the FieldMap for this object.
virtual FieldContainerchild () const
 Get this container's child, if any. Default implementation returns null.

Static Public Member Functions

static Trialmake ()
static const FieldMapclassFields ()

Public Attributes

nub::signal0itsSignal

Static Public Attributes

static rutz::tracer tracer

Classes

class  Impl


Detailed Description

Trial collaborates with ResponseHandler+TimingHdlr.

Definition at line 60 of file trial.h.


Member Function Documentation

io::version_id Trial::class_version_id (  )  const [virtual]

Returns a serialization version id for the class. The default implementation returns zero. Classes should override this when they make a change that requires a change to their serialization protocol. Overriding versions of this function should follow the convention that a higher id refers to a later version of the class. Implementations of io::reader and io::writer will provide a way for a class to store and retrieve the serialization version of an object.

Reimplemented from io::serializable.

Definition at line 229 of file trial.cc.

void Trial::read_from ( io::reader reader  )  [virtual]

Subclasses implement this method to save the object's state via the generic interface provided by io::reader. Parsing the format of the input is handled by the io::reader, so implementors of read_from() of don't need to deal with formatting.

Implements io::serializable.

Definition at line 232 of file trial.cc.

References io::reader::ensure_version_id(), and SRC_POS.

void Trial::write_to ( io::writer writer  )  const [virtual]

Subclasses implement this method to restore the object's state via the generic interface provided by io::writer. Formatting the output is handled by the io::writer, so implementors of write_to() of don't need to deal with formatting.

Implements io::serializable.

Definition at line 260 of file trial.cc.

References io::writer::ensure_output_version_id(), SRC_POS, io::writer::write_object(), io::write_utils::write_object_seq(), io::writer::write_value(), and io::write_utils::write_value_obj_seq().

fstring Trial::stdInfo (  )  const

Returns a standard set of descriptive information.

This is here mostly for legacy reasons; this function used to be the implementation of vxInfo().

Definition at line 430 of file trial.cc.

References GxShapeKit::category(), rutz::sfmt(), and nub::object::unique_name().

Referenced by vxInfo().

void Trial::setInfo ( rutz::fstring  info  ) 

Set the contents of what will be returned from vxInfo().

If setInfo() is called with an empty string, then vxInfo() will by default return the result of stdInfo() instead.

Definition at line 464 of file trial.cc.

void Element::vxEndTrialHook (  )  [virtual, inherited]

Hook function that gets called each time a leaf (i.e., trial) completes.

Shouldn't be used for substantive action, but just for bookkeeping such as timekeeping, autosaving, etc. Default version is a no-op.

Reimplemented in Block, and ExptDriver.

Definition at line 41 of file element.cc.

Referenced by Block::vxEndTrialHook().

nub::uid nub::object::id (  )  const throw () [inherited]

Returns the unique id for this object. The unique id will always be strictly positive; zero is always an invalid unique id.

Definition at line 62 of file object.cc.

rutz::fstring nub::object::real_typename (  )  const [inherited]

Returns the typename of the full object.

The result is a demangled version of typeid(*this).name(), which should very closely resemble the way the object was declared in source code.

Definition at line 67 of file object.cc.

References rutz::demangled_name().

Referenced by nub::object::obj_typename().

rutz::fstring nub::object::obj_typename (  )  const [virtual, inherited]

Returns the (apparent) typename of the full object.

The default implementation just returns real_typename(). However, certain kinds of objects -- e.g., proxy objects -- might usefully choose to have obj_typename() return something besides the real_typename(), in order to masquerade as a different type of object.

Reimplemented in io::proxy< C >, io::const_proxy< C >, MtxObj, and TrialMemFuncEvent.

Definition at line 73 of file object.cc.

References nub::object::real_typename().

Referenced by io::legacy_reader::read_root(), and nub::object::unique_name().

void * nub::ref_counted::operator new ( size_t  bytes  )  [inherited]

Class-specific operator new; protected to ensure that clients use factory functions.

Definition at line 157 of file refcounted.cc.

void nub::ref_counted::operator delete ( void *  space,
size_t  bytes 
) [inherited]

Class-specific operator delete; private since deletion should only happen in ref_counted::decr_ref_count.

Definition at line 163 of file refcounted.cc.

void nub::ref_counted::incr_ref_count (  )  const throw () [inherited]

Increment the object's reference count.

This operation (on the strong reference count) is not permitted if the object is unshareable. Unshareable objects can only have their weak reference counts manipulated.

Definition at line 207 of file refcounted.cc.

References nub::ref_counts::acquire_strong().

Referenced by GxEmptyNode::make().

void nub::ref_counted::decr_ref_count (  )  const throw () [inherited]

Decrement the object's reference count.

If this causes the reference count to fall to zero or below, the pointee and the pointer will be destroyed by a call to 'delete this'. This operation (on the strong reference count) is not permitted if the object is unshareable. Unshareable objects can only have their weak reference counts manipulated.

Definition at line 212 of file refcounted.cc.

References nub::ref_counts::release_strong().

void nub::ref_counted::decr_ref_count_no_delete (  )  const throw () [inherited]

Decrement the object's reference count, but don't delete it.

Unlike decr_ref_count(), the object will NOT be delete'd if the reference count falls to zero. This operation (on the strong reference count) is not permitted if the object is unshareable. Unshareable objects can only have their weak reference counts manipulated.

Definition at line 221 of file refcounted.cc.

References nub::ref_counts::release_strong_no_delete().

bool nub::ref_counted::is_shared (  )  const throw () [inherited]

Returns true if no external client has sole ownership of the object.

This may occur if either (1) the reference count is greater than one, or (2) the object is_not_shareable(), meaning that the object itself is the only "owner".

Definition at line 226 of file refcounted.cc.

References rutz::mutex_atomic_int::atomic_get(), nub::ref_counted::is_not_shareable(), and nub::ref_counts::m_strong.

Referenced by nub::ref_counted::is_unshared().

bool nub::ref_counted::is_unshared (  )  const throw () [inherited]

Returns true if there is a sole external owner of the object.

This occurs if the reference count is one or less and the object is shareable.

Definition at line 236 of file refcounted.cc.

References nub::ref_counted::is_shared().

bool nub::ref_counted::is_not_shareable (  )  const throw () [inherited]

Returns true if the object is not shareable for any reason. This could be because its lifespan is volatile (such as objects representing on-screen windows that can be dismissed by the user). The default is for objects to be shareable; objects can declare themselves as unshareable by calling mark_as_volatile().

Definition at line 242 of file refcounted.cc.

References nub::ref_counts::m_volatile.

Referenced by nub::ref_counted::is_shared().

const Field & FieldContainer::field ( const rutz::fstring name  )  const [inherited]

Lookup the Field for a given name.

An exception will be thrown if no such Field is found.

Definition at line 176 of file fields.cc.

References FieldMap::field().


Member Data Documentation

This tracer dynamically controls the tracing of Trial member functions.

Definition at line 66 of file trial.h.


The documentation for this class was generated from the following files:

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