Recent Changes - Search:

edit SideBar

Implement

An accessor may specify that it implements an interface or the interface of another accessor in its setup() function by invoking:

  • implement(<string> name): Implement an interface with the specified name.

This has the effect of executing the setup() function of the specified interface or accessor, so any inputs, outputs, and parameters defined by the specified interface or accessor will also be inputs, outputs, and parameters of this accessor.

For example, suppose an interface MyInterface has the following:

  exports.setup = function() {
    parameter('foo', {'value':42});
    output('bar');
  }

Then if an accessor specifies the following:

  exports.setup = function() {
    implement('MyInterface');
  }

then it will also have a parameter named 'foo' and an output named 'bar'. A derived accessor may modify the options of the interface specification. For example,

  exports.setup = function() {
    implement('MyInterface');
    parameter('foo', {'value':43});
  }

modifies the default value of 'foo' to 43.

See Lee and Seshia, Chapter 14 for the meaning interface inheritance.

See Support for implement and extend in Ptolemy II.


Back to accessor specification

Edit - History - Print - Recent Changes - Search
Page last modified on July 06, 2015, at 02:55 PM