MasterScan  Lab_Matlab_control Master Branch
List of all members | Properties and Events | Methods
topsRunnable Class Reference

Overview

Superclass for flow-control classes.

The topsRunnable superclass provides a common interface for Tower of Psych classes that manage flow control. They organize function calls and log what they call. Some can combine with each other to make complex control structures.

Any topsRunnable can be run(), to begin execution. Sometimes its caller will be set to another topsRunnable, which invoked run() on it.

Inheritance diagram for topsRunnable:
Inheritance graph
[legend]

Properties and Events

Property startFevalable = {}
 optional fevalable cell array to invoke just before running
 
Property finishFevalable = {}
 optional fevalable cell array to invoke just after running
 
Property isRunning = false
 true or false, whether this object is currently busy running
 
Property caller
 topsRunnable that invoked run() on this object, or empty
 
Property startString = 'start'
 string used for topsDataLog entry just before run()
 
Property finishString = 'finish'
 string used for topsDataLog entry just after run()
 
- Properties and Events inherited from topsFoundation
Property name = ''
 a string name to indentify the object
 
Property clockFunction =@topsClock
 clock function, to standardize
 

Methods

self topsRunnable (varargin)
 Constuct with name optional. More...
 
 run (self)
 Do flow control. More...
 
gui (self)
 Show heirarchy of topsRunnable[Composite] objects.
 
 start (self)
 Log action and prepare to do flow control. More...
 
 finish (self)
 Log, action and finish doing flow control. More...
 
 logAction (self, actionName, actionData)
 Log an event of interest with topsDataLog. More...
 
 logFeval (self, fevalName, fevalable)
 Log a function call with topsDataLog. More...
 
- Methods inherited from topsFoundation
self topsFoundation (name)
 Constuct with name optional. More...
 
fig gui (self)
 Open a GUI to view object details. More...
 
guiPanel (self, varargin)
 Make a topsDetailPanel with details about this object. More...
 

Additional Inherited Members

- Static Methods inherited from topsFoundation
static c index cellAdd (c, item, index)
 Add an item to a cell array. More...
 
static selector cellContains (c, item)
 Does a cell array conatin an item? More...
 
static c cellRemoveItem (c, item)
 Remove an item from a cell array. More...
 
static c cellRemoveElement (c, index)
 Remove indexed elements from a cell array. More...
 
static index selector findStructName (s, name)
 Where is the given name in the given struct array? More...
 

Constructor

◆ topsRunnable()

self topsRunnable ( varargin  )

Constuct with name optional.

Parameters
nameoptional name for this object

If name is provided, assigns name to this object.

Methods

◆ run()

run ( self  )

Do flow control.

run() should take over flow-control from the caller and do custom behaviors. When it's done doing custom behaviors, the object should set its isRunning property to false.

Subclasses should redefine run() to do custom behaviors.

◆ start()

start ( self  )

Log action and prepare to do flow control.

Subclasses should extend start() to do initialization before running.

◆ finish()

finish ( self  )

Log, action and finish doing flow control.

Subclasses should extend finish() to do clean up after running.

◆ logAction()

logAction ( self  ,
actionName  ,
actionData   
)

Log an event of interest with topsDataLog.

Parameters
actionNamestring name for any event of interest
actionDataoptional data to log along with actionName

logAction is a convenient way to note in topsDataLog that some event of interest has occurred. The log entry will contain the name of this topsRunnable object, concatenated with actionName. It will store actionData, if given.

◆ logFeval()

logFeval ( self  ,
fevalName  ,
fevalable   
)

Log a function call with topsDataLog.

Parameters
fevalNamestring name to give to a function call
fevalablefevalable cell array specifying a function call

logFeval is a convenient way to note in topsDataLog that some function call of interest has occurred, and then call the function. The log entry will contain the name of this topsRunnable object, concatenated with fevalName. It will convert the function handle from the first element of fevalable to a string and store the string.

The log entry will not store any of the arguments from the second or later elements of fevalable. This is because the arguments may be handle objects, and Matlab does a bad job of storing large collections of handle objects–both in memory and in .mat files.

After making a new entry in topsDataLog, logFeval also invokes fevalable with the feval() function.


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