Cascade Core  v0.12-1-g22cbbeb
 All Classes Namespaces Functions Variables Pages
Public Member Functions | List of all members
CascadeController Class Reference

CascadeController is container, where all blocks live. More...

Public Member Functions

 __construct (IAuth $auth=null, $replacement_table, $shebangs)
 Constructor. More...
 
 cloneEmpty ()
 Create new instance of cascade controller and copy current configuration. More...
 
 start ()
 Start cascade evaluation. More...
 
 getAuth ()
 Get authenticator object.
 
 getReplacementTable ()
 Get replacement table.
 
 addBlockStorage (IBlockStorage $storage, $storage_id)
 Register new block storage to cascade controller.
 
 getBlockStorages ()
 Get all registered block storages.
 
 resolveBlockName ($block_name)
 Lookup block name in the root namespace to retrieve a Block instance.
 
 rootNamespaceBlockNames ()
 Get all block names in the root namespace.
 
 currentStep ($increment=true)
 Get current step of cascade evaluation. More...
 
 addBlock ($parent, $id, $block, $force_exec, array $in_connections, array $in_values, Context $context, &$errors=null, $real_block=null)
 Create new block and add it into the cascade.
 
 addBlocksFromArray ($parent, array $blocks, Context $context, &$errors=null)
 Add multiple blocks using addBlock(). More...
 
 dumpNamespaces ()
 Debug method to display entire hierarchy of blocks.
 
 getExecutionTimes ($old_stats=null)
 Retrieve profiler statistics from all blocks in the cascade.
 
 getMemoryUsage ()
 Get total amount of memory used by cascade.
 
 exportGraphvizDot ($doc_link, $whitelist=array(), $step=null)
 Export entire cascade as Graphviz source code. More...
 
 execDot ($dot_source, $out_type, $out_file=null)
 Helper method to execute dot. More...
 
 getKnownBlocks ($writable_only=false)
 Get names of all existing blocks grouped by their prefix (plugin).
 
 describeBlock ($block, Context $context)
 Returns description of block. More...
 

Detailed Description

CascadeController is container, where all blocks live.

They are created by CascadeController, then they wait for an execution, and after their execution, they turn into a zombie to stay around and keep their outputs.

All blocks are created by private method CascadeController::createBlockInstance(), which is usually called by CascadeController::addBlock(). The createBlockInstance() walks thru registered block storages and ask them for requested block.

Constructor & Destructor Documentation

__construct ( IAuth  $auth = null,
  $replacement_table,
  $shebangs 
)

Constructor.

The $auth object is used to determine, whether or not is user allowed to add requested block into cascade. The authenticator object cannot be replaced.

The $replacement_table maps requested block type to some other block type.

Member Function Documentation

cloneEmpty ( )

Create new instance of cascade controller and copy current configuration.

Useful for making preview of cascade.

start ( )

Start cascade evaluation.

Can be called only once during CascadeController's lifetime.

currentStep (   $increment = true)

Get current step of cascade evaluation.

The step is monotonous value increasing as cascade is evaluated. Used to ensure a stable ordering of objects inserted into template, and to record order of block execution, so the cascade snapshot can be converted to video.

Here is the caller graph for this function:

addBlocksFromArray (   $parent,
array  $blocks,
Context  $context,
$errors = null 
)

Add multiple blocks using addBlock().

This is helper method distilled from various proxy blocks to make their implementation easier and data structures more uniform.

Block configuration passed in $blocks is the same as "blocks" section in JSON files.

Here is the call graph for this function:

exportGraphvizDot (   $doc_link,
  $whitelist = array(),
  $step = null 
)

Export entire cascade as Graphviz source code.

If $step is set, generated code will describe cascade state as it was in given moment. By calling this method with all steps from 0 to currentStep(), a video can be created – see bin/animate-cascade.sh.

Here is the call graph for this function:

execDot (   $dot_source,
  $out_type,
  $out_file = null 
)

Helper method to execute dot.

/

Todo:
Move to standalone class.
describeBlock (   $block,
Context  $context 
)

Returns description of block.

Description contains inputs and outputs with their default values, force_exec flag and real block type.