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

Overview

A list of functions to call sequentially, as a batch.

topsCallList manages a list of functions to be called as a batch.

Since topsCallList extends topsConcurrent, a topsCallList object can be added as one of the components of a topsConcurrentComposite object, and its batch of functions can be invoked concurrently with other topsConcurrent objects.

A topsCallList object has no internal state to keep track of, so it has no natural way to decide when it's done running. The alwaysRunning property determines whether the object should be considered running following each call to runBriefly().

topsCallList expects functions of a particular form, which it calls "fevalable". Fevalables are cell arrays that have a function handle as the first element. Additional elements are treated as arguments to the function.

The fevalables convention makes it easy to make arbitrary function calls with Matlab's built-in feval() function–hence the name–so the cell array "foo" would be an fevalable if it could be executed with feval(foo{:}).

By default, all of the fevalables in the call list will be called during each runBriefly(). The activity of each call can be controlled with setActiveByName() or with callByName() with the isActive flag. A call can also be replaced by passing a new call with the same name to addCall().

Inheritance diagram for topsCallList:
Inheritance graph
[legend]

Properties and Events

 calls
 struct array with fevalable cell arrays to call as a batch
 
Property alwaysRunning = true
 true or false, whether to run indefinitely
 
Property invertOrder = false
 true or false, invert order of calls
 
- Properties and Events inherited from topsConcurrent
Property runBrieflyString = 'runBriefly'
 string used for topsDataLog entry just before runBriefly()
 
- Properties and Events inherited from topsRunnable
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 topsCallList (varargin)
 Constuct with name optional. More...
 
fig gui (self)
 Open a GUI to view object details. More...
 
index addCall (self, fevalable, name)
 Add an "fevalable" to the call list. More...
 
 setActiveByName (self, isActive, name)
 Toggle whether a call is active. More...
 
result callByName (self, name, isActive)
 Invoke a call now, whether or not it's active. More...
 
 runBriefly (self)
 Invoke active calls in a batch.
 
- Methods inherited from topsConcurrent
self topsConcurrent (varargin)
 Constuct with name optional. More...
 
 run (self, duration)
 Do flow control. More...
 
 runBriefly (self)
 Do a little flow control and return as soon as possible. More...
 
- Methods inherited from topsRunnable
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...
 

Static Methods

static fevalable makeFevalable (invertOrder)
 Utility to make a call list as an fevalable. More...
 
- 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

◆ topsCallList()

self topsCallList ( varargin  )

Constuct with name optional.

Parameters
nameoptional name for this object

If name is provided, assigns name to this object.

Methods

◆ gui()

fig gui ( self  )

Open a GUI to view object details.

Opens a new GUI with components suitable for viewing objects of this class. Returns a topsFigure object which contains the GUI.

◆ addCall()

index addCall ( self  ,
fevalable  ,
name   
)

Add an "fevalable" to the call list.

Parameters
fevalablea cell array with contents to pass to feval()
nameunique name to assign to fevalable

Appends or inserts the given fevalable to the calls struct array. name should be unique so that fevalable can be referred to later by name. It will replace any existing fevalable with the same name will be replaced.

Returns the index into the calls struct array where fevalable was appended or inserted.

◆ setActiveByName()

setActiveByName ( self  ,
isActive  ,
name   
)

Toggle whether a call is active.

Parameters
namegiven to an fevalable during addCall()
isActivetrue or false, whether to invoke the named fevalable during runBriefly()

Determines whether the named fevalable function call in the calls struct array will be invoked during runBriefly(). If multiple calls have the same name, isActive will be applied to all of them.

◆ callByName()

result callByName ( self  ,
name  ,
isActive   
)

Invoke a call now, whether or not it's active.

Parameters
namegiven to an fevalable during addCall()
isActivewhether to activate or un-activate the call at the same time

name must be the name of a call added to this call list with addCall(). Invokes the fevalable for that call, whether or not it's active. If isActive is provided, sets whether the named call is active, to be invoked in the future by runBriefly().

Returns the first output from the named call, if any.

◆ makeFevalable()

static fevalable makeFevalable ( invertOrder  )
static

Utility to make a call list as an fevalable.

Arguments: invertOrder ... flag to run in reverse order Returns: fevalable ... cell array that runs the callList


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