MFSM || reference guide

Alexandre R.J. François

Code release version: 0.8
ARJF © 2001-2006

contents

Introduction
Factories
Nodes
Cells
Other structures
Index

Introduction

This reference guide, part of the documentation for the MFSM project, describes the core FSF library. Individual modules should provide specific user and reference guides.

In its current implementation, the FSF library contains a set of C++ classes implementing SAI elements: the source, the nodes and pulses, the cells, the filters, the handles. It also contains classes for two implementation related object types: the factories and the System. This document provides detailed interface description and implementation notes for all the classes defined in the FSF library.

All FSF library structures are defined in the fsf namespace.

Time

All time variables are of type fsf::Time, which is currently a signed 64bit integer (long long int). The time unit is the nanosecond (1 ns = 10^-9 s).

Registered factories

Class factories are used to instantiate objects at run time, whose type is not known at compile time. Since cells and nodes constitute extensible sets of specialized object types derived from respective base classes, Cell and Node factories a necessary for instantiating cells and nodes at run time, and modify application graphs dynamically. Node factories also allow to instantiate filters for the corresponding node type. Note that all classes defined in the FSF library do not have a registered factory. Only those nodes and cells that require dynamic creation have registered factories.

This section lists all the node and cell factories registered by the FSF library, in the following format:

Node factories

Base node and pulses

Fundamental type nodes

Fundamental type nodes are template instantiations of CTypeNode.

Other nodes

Cell factories

Base Cell

Fundamental type cells

Fundamental type cells allow to get or set the value of corresponding type nodes. They are all template instantiations of template class CTypeCell, which implements modified semantics for the process member function in order to perform the get and set operations. The template instantiation nature of these classes is made apparent in the notation by not preceding the class name with a 'C'.

Node value access cells

Node value access cells allow to perform get and/or set operations on specific CNode members. These cells are derived from CTypeCellBase, and implement consistent modified semantics for the process member function in order to perform the get and set operations.

Character buffer value access cells

Character buffer node value access cells allow to perform get and/or set operations on specific CCharBuffer members. These cells are derived from CTypeCellBase, and implement the standard modified semantics for the process member function in order to perform the get and set operations.

Other cells

Nodes

The Fsf library contains a base node class, that implements connectivity elements for building hierarchical structures. Specialized node classes, encapsulating or implementing specific data structures, can be derived from the base class (or derived classes). FSF specializes and active pulse and a passive pulse classes from the base node class for active and passive pulse. These specialized classes serve as root nodes for active and passive pulse which are node hierarchies. Another node specialization implements nodes holding one variable of simple or standard type values (integer, floating point, boolean, string, etc.). These are called TypeNodes, and are implemented as template instances of a template classe, itself derived from a non template TypeNodeBase class (to allow undetermined pointers to a TypeNode object).

This section details each node class defined in the FSF library. Classes are listed in alphabetical order, according to the following formats:

Nodes

Template instances

BoolNode "FSF_BOOL_NODE"

Typedef for CTypeNode<bool>. [FsfTypeNode.h]

CActivePulse (CPulse) "FSF_ACTIVE_PULSE"

Active pulse. [FsfPulse.h]

Data members

Member functions

Constructors, destructor and other functions that are part of any derived node class
Member access

CBarrier (CNode) "FSF_BARRIER"

Barrier node for synchronization. [FsfBarrier.h]

Data members

Member functions

Constructors, destructor and other functions that are part of any derived node class
Memory allocation
Member access
Operations

CCharBuffer (CNode) "FSF_CHAR_BUFFER"

Character buffer node. [FsfCharBuffer.h]

Data members

Member functions

Constructors, destructor and other functions that are part of any derived node class
Memory allocation
Member access

CNode "FSF_NODE"

Base node class. [FsfNode.h]

Data members

Member functions

Constructors, destructor and other functions that are part of any derived node class
Member access
Wildcard matching
Special tree organization functions
Reference counting and garbage collecting

CPassivePulse (CPulse) "FSF_PASSIVE_PULSE"

Passive pulse. [FsfPulse.h]

Member functions

Constructors, destructor and other functions that are part of any derived node class
Special tree organization functions
Garbage collecting

CPulse (CNode) "FSF_PULSE" - no factory

Pulse base class. [FsfPulse.h]

Member functions

Constructors, destructor and other functions that are part of any derived node class
Special tree organization functions

CTypeNode<class Type> (CTypeNodeBase) "FSF_TYPE_NODE" - no factory

Type node template class. [FsfTypeNode.h]

Data members

Member functions

Constructors, destructor and other functions that are part of any derived node class
Member access

CTypeNodeBase (CNode) "FSF_TYPE_NODE_BASE" - no factory

Base type node. [FsfTypeNode.h]

Member functions

Constructors, destructor and other functions that are part of any derived node class

Float32Node "FSF_FLOAT32_NODE"

Typedef for CTypeNode<float>. [FsfTypeNode.h]

Float64Node "FSF_FLOAT64_NODE"

Typedef for CTypeNode<double>. [FsfTypeNode.h]

Int32Node "FSF_INT32_NODE"

Typedef for CTypeNode<long int>. [FsfTypeNode.h]

Int64Node "FSF_INT64_NODE"

Typedef for CTypeNode<long long int>. [FsfTypeNode.h]

StringNode "FSF_STRING_NODE"

Typedef for CTypeNode<std::string>. [FsfTypeNode.h]

Cells

The Fsf library contains a base cell class, that implements cell-cell and cell-source connectivity mechanisms (lists of pointers). It also implements all the computation associated with the parallel processing of active pulses. In MFSM, in each cell, each active pulse is processed in a separate thread. Each passive filtering operation is also carried in a separate thread. As a result, some precautions must be taken for concurrent data access. Thanks to inheritance and virtual functions, when implementing a specialized cell derived from the base cell, only the specific computation must be coded, in an overloaded process virtual member funtion. All the events leading to the call to this process function, including filtering, will be automatically performed. A cell can be active or inactive. For efficiency purposes, passive filtering only occurs when the cell is activated (activation fails if passive filtering fails), and when explicitely notified by the source after a cell notified the source of a structural change in the passive pulse.

If the root of the active filter specifies a pattern, the specialized process function is invoked for each handle generated by the filtering (sequentially, in the same thread). If the root of the passive filter specifies a pattern, only one passive handle is generated (pointing to the first encountered node satisfying the pattern).

This section details each cell class defined in the FSF library. Classes are listed in alphabetical order, according to the following format:

Cells

Template instances

Value access cells

<--

Cell classes inheritance hierarchy

Figure 2: Cell classes inheritance hierarchy -->

BoolCell "FSF_BOOL_CELL"

Active filter[FSF_BOOL_NODE "*"]*
Passive filter[FSF_BOOL_NODE "*"]
Output(FSF_BOOL_NODE "Output") -- GET only

Typedef for CTypeCell<bool>. [FsfTypeCell.h]

CCell "FSF_CELL"

Base cell. [FsfCell.h]

Data members

Member functions

Constructors, destructor and other functions that are part of any derived cell class
Member access
Passive stream connections
Passive stream processing
Active stream connections
Active stream processing
Flow control

CCharBufferSize (CTypeCellBase) "FSF_CHAR_BUFFER_SIZE"

Active filter[FSF_ACTIVE_PULSE "Root"]
Passive filter[FSF_CHAR_BUFFER "*"]
Output(FSF_INT32_NODE "Output") -- GET only

CCharBuffer size value access cell (get only). [FsfCharBuffer.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
ActiveStream processing

CNodeName (CTypeCellBase) "FSF_NODE_NAME"

Active filter[FSF_ACTIVE_PULSE "Root"]
Passive filter[FSF_NODE "*"]
Output(FSF_STRING_NODE "Output") -- GET only

CNode name value access cell (get only). [FsfNodeCells.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
ActiveStream processing

CNodeTimeStamp (CTypeCellBase) "FSF_NODE_TIME_STAMP"

Active filter[FSF_ACTIVE_PULSE "Root"]
Passive filter[FSF_NODE "*"]
Output(FSF_INT32_NODE "Output") -- GET only

CNode time stamp value access cell (get only). [FsfNodeCells.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
ActiveStream processing

CNodeTypeID (CTypeCellBase) "FSF_NODE_TYPE_ID"

Active filter[FSF_ACTIVE_PULSE "Root"]
Passive filter[FSF_NODE "*"]
Output(FSF_STRING_NODE "Output") -- GET only

CNode type ID value access cell (get only). [FsfNodeCells.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
ActiveStream processing

CPulsar (CCell) "FSF_PULSAR"

Active filter[]
Passive filter[FSF_INT64_NODE "Pulse delay"]
Output(FSF_ACTIVE_PULSE "Root")

Pulsar cell. [FsfPulsar.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
Flow control
Pulsing

CSync (CCell) "FSF_SYNC"

Active filter[FSF_ACTIVE_PULSE "Root"]
Passive filter[FSF_BARRIER "Barrier"]
Output()

Barrier synchronization cell. Holds the incoming active pulse until filtering with the active pulse specified in the Barrier node succeeds or the operation times-out (time-out value specified in the barrier node). [FsfBarrier.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
Active stream processing

CTypeCell<class Type> (CTypeCellBase) "FSF_TYPE_CELL" - no factory

Active filter[Type "*"]*
Passive filter[Type "*"]
Output(Type "Output")

Type cell template class. Modified semantics for process function to implement get and set value. [FsfTypeCell.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
Active stream processing

CTypeCellBase (CCell) "FSF_TYPE_CELL_BASE" - no factory

Type cell base class. Implements modified semantics for its process member function in order to perform the get and set operations. [FsfTypeCellBase.h]

Member functions

Constructors, destructor and other functions that are part of any derived cell class
Active stream processing

Float32Cell "FSF_FLOAT32_CELL"

Active filter[FSF_FLOAT32_NODE "*"]*
Passive filter[FSF_FLOAT32_NODE "*"]
Output(FSF_FLOAT32_NODE "Output") -- GET only

Typedef for CTypeCell<float>. [FsfTypeCell.h]

Float64Cell "FSF_FLOAT64_CELL"

Active filter[FSF_FLOAT64_NODE "*"]*
Passive filter[FSF_FLOAT64_NODE "*"]
Output(FSF_FLOAT64_NODE "Output") -- GET only

Typedef for CTypeNode<double>. [FsfTypeCell.h]

Int32Cell "FSF_INT32_CELL"

Active filter[FSF_INT32_NODE "*"]*
Passive filter[FSF_INT32_NODE "*"]
Output(FSF_INT32_NODE "Output") -- GET only

Typedef for CTypeCell<long int>. [FsfTypeCell.h]

Int64Cell "FSF_INT64_CELL"

Active filter[FSF_INT64_NODE "*"]*
Passive filter[FSF_INT64_NODE "*"]
Output(FSF_INT64_NODE "Output") -- GET only

Typedef for CTypeCell<long long int>. [FsfTypeCell.h]

StringCell "FSF_STRING_CELL"

Active filter[FSF_STRING_NODE "*"]*
Passive filter[FSF_STRING_NODE "*"]
Output(FSF_STRING_NODE "Output") -- GET only

Typedef for CTypeCell<std::string>. [FsfTypeCell.h]

Other Structures

This section details all the classes defined in the FSF library not described in the previous sections. These include classes for source, filters, handles, factories and system objects.

Source. The source class is fairly simple. It holds a single passive pulse, and keeps a list of pointers to connected cells. Note that connectors are not implemented as objects, but simply lists of pointers in the components. This results from the simplicity of the role played by connectors in the SAI style. In particular, they do not perform any computation. Sources also perform garbage collecting on their passive pulse when notified of a structural change by a connected cell.

Filters. Two sets of classes are implemented, for active and passive filters respectively. For each, a template class derived from a non template base class provides support for intantiating filters corresponding to any node type. The non template base class allows to have pointers to undetermined filters (e.g. in cells). The filter objects also implement the filtering functionality. Active filtering instantiates and returns a list of active handles, passive filtering instantiates and returns a list of passive handles.

Handles. Two sets of classes are implemented, for active and passive handles respectively. Active handle simply provide a pointer to a node in an active pulse. An optional handle ID, inherited during the filtering operation, allows to identify the node with respect to the filter. Passive handles play the additional role of locks for node deletion and garbage collecting (not required in active pulses). When a cell removes a node, it does not destroy it, but marks it as deleted, so it is not used in subsequent filtering operations. The cell must notify the source, which in turns notify all connected cells to re-filter the passive pulse, and initiates a garbage collecting process, which will physically deleted the node when is it free of handles from ongoing process.

Factories. Class factories are used to instantiate objects at run time, whose type is not known at compile time. Since cells and nodes constitute extensible sets of specialized object types derived from respective base classes, Cell and Node factories a necessary for instantiating cells and nodes at run time, and modify application graphs dynamically. Node factories also allow to instantiate filters for the corresponding node type.

System. By convention, any application using FSF must have a single instance of the System type. The corresponding class therefore implements the Singleton pattern, so that this unique instance is automatically created the first time it is needed. This object provides the reference clock, and holds the lists of node and cell factories available for building application graphs. In order to use a module in an application, its node and cell factories must be declared and registered with the system instance.

Classes are listed in alphabetical order.

Source:

Filters:

Handles:

Factories:

System:

CActiveFilter<class N> (CActiveFilterBase)

Active filter template class. [FsfFilter.h]

Member functions

Constructors, destructor and cloning
Type checking

CActiveFilterBase (CFilter)

Virtual base active filter class. [FsfFilter.h]

Data members

Member functions

Constructors, destructor and cloning
Tree functions
Type checking
Filtering

CActiveHandle

Active handle. [FsfHandle.h]

Data members

Member functions

Constructors and destructor
Member access

CCellFactory<class C> (CCellFactoryBase)

Cell factory template class. [FsfClassFactories.h]

Member functions

Constructors and destructor
Instantiation

CCellFactoryBase (CClassFactoryBase)

Cell factory base class. [FsfClassFactories.h]

Member functions

Constructors

CClassFactoryBase

Virtual base class factory class. [FsfClassFactories.h]

Data members

Member functions

Constructors and destructor
Member access
Class instantiation

CFilter

Filter base class. [FsfFilter.h]

Data members

Member functions

Constructors and destructor
Member access
Helper functions

CNodeFactory<class N> (CNodeFactoryBase)

Node factory template class. [FsfClassFactories.h]

Member functions

Constructors and destructor
Instantiation

CNodeFactoryBase (CClassFactoryBase)

Node factory virtual base class. [FsfClassFactories.h]

Member functions

Constructors
Instantiation

CPassiveFilter<class N> (CPassiveFilterBase)

Passive filter template class. [FsfFilter.h]

Member functions

Constructors, destructor and cloning
Type checking

CPassiveFilterBase (CFilter)

Virtual base passive filter class. [FsfFilter.h]

Data members

Member functions

Constructors, destructor and cloning
Tree functions
Type checking
Filtering

CPassiveHandle

Active handle. [FsfHandle.h]

Data members

Member functions

Constructors and destructor
Member access

CSource

Source. [FsfSource.h]

Data members

Member functions

Constructor and destructor
Pulse functions
Cell functions

CSystem

System class. Implements system clock and node and cell factories management.

Follows the Singleton pattern, as exactly one instance of this class must exists in an MFSM-based application. Although FSF is highly multi-threaded, the unique instance will be allocated before multi-threading kicks in, and thus a double lock mechanism is probably not needed...

Maps should be made thread-safe with critical sections. However, for now they are set at start time and never modified... Critical sections would not hurt anyways, since the map access is not a highly time critical operation.

Typedefs

Data members

Singleton specifics
System clock
Class factories

Member functions

Constructor and destructor
Singleton specifics
System clock
Node factories management
Cell factories management

Index

B

C

F

I

S

T