tendril

The basic way of communication for a cell (whether as an input/output or as a parameter) is through a C++ object called tendril. A tendril abstracts the C++ type of the object it contains to allow the scheduling to be generic, to allow static introspection and to ease the Python interaction.

It is behaving like a boost::any (think void* with an encoded type) augmented with certain conversion rules, operators, introspection capabilities, docstrings and the like.

Overview

You will primarily encounter the tendril as the right hand side of the mappings which are the tendrils objects passed to ecto cell functions, that is, a tendrils object is essentially a map of std::string -> shared_ptr<tendril>. Each ecto cell has associated with it three sets of tendrils: parameters, input, and output. The scheduler, external to the cell, copies data between one cell’s output tendril and the input tendril of another cell.

struct Example01 
{
  static void declare_params(tendrils& p)
  {
    p.declare<int>("value", "Some integer");
  }

  void configure(const tendrils& p, const tendrils& i, const tendrils& o)
  {
    int n = p.get<int>("value");
    std::cout << "Value of n is " << n << "\n";
  }
};

See ../src/Example01.cpp

A script like this,

#!/usr/bin/python 

import ecto
from ecto.ecto_examples import Example01

ecell = Example01(value=17)
ecell.process()

Will output,

$ /home/vrabaud/workspace/recognition_kitchen/src/ecto/doc/kitchen/ecto/reference/../src/Example01.py
No module named PySide.QtCore
Value of n is 17

Tendril Conversions

The table below explains (somewhat) the type conversions that happen when one tendril or type is inserted to another.

Tendril Conversions

FROM

TO

none python object T U
none assignment (no-op) python object T U
python object ValueNone error assignment python object python object
T ValueNone error T via extract<> or conversion error assignment TypeMismatch error
U ValueNone error U via extract<> or conversion error TypeMismatch error assignment

spore

A spore is a typed handle for a tendril: it is basically a typed pointer that wraps a tendril. Its use is purely for ease of coding: instead of extracting the object from a tendril every time, you can just define a spore. You can think of a tendril as containing a void* and a spore as a cast of that pointer to a specific type.

tendrils

tendrils are containers for the tendril type, essentially a mapping from name to tendril. The tendrils also give a convenient form of templated type safe access to the data that tendril objects hold.

plasm

from the Greek plasma, meaning “something formed or molded” Think ectoplasm or protoplasm. Leading naturally to slime molds. The plasm is the ecto Directed Acyclic Graph, or DAG for short.