ecto
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ecto::cell Struct Referenceabstract

ecto::cell is the non virtual interface to the basic building block of ecto graphs. This interface should never be the parent of client cell, but may be used for polymorphic access to client cells. More...

#include <cell.hpp>

Inheritance diagram for ecto::cell:
Inheritance graph
[legend]
Collaboration diagram for ecto::cell:
Collaboration graph
[legend]

Public Types

typedef boost::shared_ptr< cellptr
 A convenience pointer typedef. More...
 

Public Member Functions

 cell ()
 
virtual ~cell ()
 
void declare_params ()
 Dispatches parameter declaration code. After this code, the parameters for the cell will be set to their defaults. More...
 
void declare_io ()
 Dispatches input/output declaration code. It is assumed that the parameters have been declared before this is called, so that inputs and outputs may be dependent on those parameters. More...
 
void configure ()
 Given initialized parameters,inputs, and outputs, this will dispatch the client configuration code. This will allocated an instace of the clients cell, so this should not be called during introspection. More...
 
void activate ()
 Activate the cell. i.e. Put it into a "ready" state, opening sockets, etc. More...
 
void deactivate ()
 Deactivate the cell. i.e. Put it into an "unready" state, closing sockets, etc. More...
 
void start ()
 
void stop ()
 
ReturnCode process ()
 Dispatches the process function for the client cell. This should only be called from one thread at a time. Also, this function may throw exceptions... More...
 
ReturnCode process_with_only_these_inputs (const tendrils &connected_inputs)
 
std::string type () const
 Return the type of the child class. More...
 
std::string name () const
 Grab the name of the instance. More...
 
void name (const std::string &name)
 Set the name of the instance. More...
 
std::string short_doc () const
 Set the short_doc_ of the instance. More...
 
void short_doc (const std::string &short_doc)
 Set the short_doc_ of the instance. More...
 
void reset_strand ()
 
void set_strand (ecto::strand)
 
std::string gen_doc (const std::string &doc="A module...") const
 Generate an Restructured Text doc string for the cell. Includes documentation for all parameters, inputs, outputs. More...
 
void verify_params () const
 
void verify_inputs () const
 
bool process_connected_inputs_only () const
 Processing mode query - only connected tendrils or all. Typically used by the scheduler to arrange input tendrils when invoking a process. More...
 
void set_process_connected_inputs_only (const bool &value)
 
ptr clone () const
 
virtual bool init ()=0
 

Public Attributes

tendrils parameters
 Parameters. More...
 
tendrils inputs
 Inputs, inboxes, always have a valid value ( may be NULL ) More...
 
tendrils outputs
 Outputs, outboxes, always have a valid value ( may be NULL ) More...
 
boost::optional< strandstrand_
 The strand that this cell should be executed in. More...
 

Protected Member Functions

virtual void dispatch_declare_params (tendrils &t)=0
 
virtual void dispatch_declare_io (const tendrils &params, tendrils &inputs, tendrils &outputs)=0
 
virtual void dispatch_configure (const tendrils &params, const tendrils &inputs, const tendrils &outputs)=0
 
virtual void dispatch_activate ()=0
 
virtual void dispatch_deactivate ()=0
 
virtual ReturnCode dispatch_process (const tendrils &inputs, const tendrils &outputs)=0
 
virtual void dispatch_start ()=0
 
virtual void dispatch_stop ()=0
 
virtual std::string dispatch_name () const =0
 
virtual ptr dispatch_clone () const =0
 
virtual std::string dispatch_short_doc () const
 
virtual void dispatch_short_doc (const std::string &)
 

Private Member Functions

 cell (const cell &)
 

Private Attributes

std::string instance_name_
 
bool configured_
 
bool activated_
 
bool process_connected_inputs_only_
 

Detailed Description

ecto::cell is the non virtual interface to the basic building block of ecto graphs. This interface should never be the parent of client cell, but may be used for polymorphic access to client cells.

Clients should expose their code to this interface through ecto::wrap, or ecto::create_cell<T>().

For a client's cell to satisfy the ecto::cell idiom, it must look similar to the following definition.

struct MyEctoCell
{
//called first thing, the user should declare their parameters in this
//free standing function.
static void declare_params(tendrils& params);
//declare inputs and outputs here. The parameters may be used to
//determine the io
static void declare_io(const tendrils& params, tendrils& in, tendrils& out);
//called right after allocation of the cell, exactly once.
void configure(tendrils& params, tendrils& inputs, tendrils& outputs);
//called at every execution of the graph
int process(const tendrils& in, tendrils& out);
};

All functions are optional.

Member Typedef Documentation

typedef boost::shared_ptr<cell> ecto::cell::ptr

A convenience pointer typedef.

Constructor & Destructor Documentation

ecto::cell::cell ( )
virtual ecto::cell::~cell ( )
virtual
ecto::cell::cell ( const cell )
private

Member Function Documentation

void ecto::cell::activate ( )

Activate the cell. i.e. Put it into a "ready" state, opening sockets, etc.

ptr ecto::cell::clone ( ) const
void ecto::cell::configure ( )

Given initialized parameters,inputs, and outputs, this will dispatch the client configuration code. This will allocated an instace of the clients cell, so this should not be called during introspection.

void ecto::cell::deactivate ( )

Deactivate the cell. i.e. Put it into an "unready" state, closing sockets, etc.

void ecto::cell::declare_io ( )

Dispatches input/output declaration code. It is assumed that the parameters have been declared before this is called, so that inputs and outputs may be dependent on those parameters.

void ecto::cell::declare_params ( )

Dispatches parameter declaration code. After this code, the parameters for the cell will be set to their defaults.

virtual void ecto::cell::dispatch_activate ( )
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual ptr ecto::cell::dispatch_clone ( ) const
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_configure ( const tendrils params,
const tendrils inputs,
const tendrils outputs 
)
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_deactivate ( )
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_declare_io ( const tendrils params,
tendrils inputs,
tendrils outputs 
)
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_declare_params ( tendrils t)
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual std::string ecto::cell::dispatch_name ( ) const
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual ReturnCode ecto::cell::dispatch_process ( const tendrils inputs,
const tendrils outputs 
)
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual std::string ecto::cell::dispatch_short_doc ( ) const
inlineprotectedvirtual

Reimplemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_short_doc ( const std::string &  )
inlineprotectedvirtual

Reimplemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_start ( )
protectedpure virtual

Implemented in ecto::cell_< Impl >.

virtual void ecto::cell::dispatch_stop ( )
protectedpure virtual

Implemented in ecto::cell_< Impl >.

std::string ecto::cell::gen_doc ( const std::string &  doc = "A module...") const

Generate an Restructured Text doc string for the cell. Includes documentation for all parameters, inputs, outputs.

Parameters
docThe highest level documentation for the cell.
Returns
A nicely formatted doc string.
virtual bool ecto::cell::init ( )
pure virtual

Implemented in ecto::cell_< Impl >.

std::string ecto::cell::name ( ) const
inline

Grab the name of the instance.

Returns
The name of the instance, or the address if none was given when object was constructed.
void ecto::cell::name ( const std::string &  name)
inline

Set the name of the instance.

ReturnCode ecto::cell::process ( )

Dispatches the process function for the client cell. This should only be called from one thread at a time. Also, this function may throw exceptions...

Returns
A return code, ecto::OK , or 0 means all is ok. Anything non zero should be considered an exit signal.
bool ecto::cell::process_connected_inputs_only ( ) const
inline

Processing mode query - only connected tendrils or all. Typically used by the scheduler to arrange input tendrils when invoking a process.

Returns
flag only connected input tendrils if true, all otherwise.
ReturnCode ecto::cell::process_with_only_these_inputs ( const tendrils connected_inputs)
void ecto::cell::reset_strand ( )
void ecto::cell::set_process_connected_inputs_only ( const bool &  value)
inline
void ecto::cell::set_strand ( ecto::strand  )
std::string ecto::cell::short_doc ( ) const
inline

Set the short_doc_ of the instance.

void ecto::cell::short_doc ( const std::string &  short_doc)
inline

Set the short_doc_ of the instance.

void ecto::cell::start ( )

scheduler is going to call process() zero or more times.

void ecto::cell::stop ( )

scheduler is not going to call process() for a while.

std::string ecto::cell::type ( ) const
inline

Return the type of the child class.

Returns
A human readable non mangled name for the client class.
void ecto::cell::verify_inputs ( ) const
void ecto::cell::verify_params ( ) const

Member Data Documentation

bool ecto::cell::activated_
private
bool ecto::cell::configured_
private
tendrils ecto::cell::inputs

Inputs, inboxes, always have a valid value ( may be NULL )

std::string ecto::cell::instance_name_
private
tendrils ecto::cell::outputs

Outputs, outboxes, always have a valid value ( may be NULL )

tendrils ecto::cell::parameters

Parameters.

bool ecto::cell::process_connected_inputs_only_
private
boost::optional<strand> ecto::cell::strand_

The strand that this cell should be executed in.


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