Difference between revisions of "Import/Export of Components in TASTE"

From TASTE
Jump to: navigation, search
(Instantiating a component type)
(Creating and exporting a component type)
Line 56: Line 56:
  
 
:[[File:ClipCapIt-200907-112128.PNG]]
 
:[[File:ClipCapIt-200907-112128.PNG]]
 +
 +
When the TASTE Interface View editor is executed, it parses the shared folder of components and gather the shared function types to update this workspace with the list of available components.
  
 
Non-exported shared components, if any, appear just below in the workspace.
 
Non-exported shared components, if any, appear just below in the workspace.
Line 62: Line 64:
  
 
When doing this, special care has to be given to the DataView namespace. If you import a component for modification in a new project that has already a different dataview, this dataview will also be exported to the shared component after you are done with your modifications. Since this is unlikely what you want, make sure you don't already have a dataview before importing.
 
When doing this, special care has to be given to the DataView namespace. If you import a component for modification in a new project that has already a different dataview, this dataview will also be exported to the shared component after you are done with your modifications. Since this is unlikely what you want, make sure you don't already have a dataview before importing.
 
  
 
=== Instantiating a component type ===
 
=== Instantiating a component type ===

Revision as of 09:36, 7 September 2020

Introduction

A new system is rarely created from scratch and having a library of reusable building blocks is a fundamental basics when working with models. This page explains the two forms of component reuse that are available in TASTE and how they operate:

  1. The shared library of component type that can be instantiated in a system
  2. The import/export of complete parts of an interface view

Shared library of component types

Overview

Component types are TASTE functions that contain a generic implementation in Ada, C++ or SDL and that can be instantiated several times in a system.

While the types can be defined locally in a project, they are usually exported to an external folder, from which they are shared and visible to all TASTE users.

In the TASTE VM, the default base folder for such shared component types is /home/taste/tool-inst/share/SharedTypes. It can be overridden by setting the TASTE_SHARED_TYPES environment variable and make it point to a different folder.

For example this component is present:

ClipCapIt-200907-105501.PNG

Details for its content are explained on this page: Technical topic: C++ Components and AIR IO Partitions

Creating and exporting a component type

A component type can be created in C++, Ada and SDL as these languages have a built-in Object-Oriented features that allow instantiation. It is not possible to create a component type in the plain C language.

The process the create the component type is the following:

  • Add a Function Type and select among the possible 3 languages in the Interface View editor
  • Add provided and required interfaces at will (but you cannot connect them to other functions)
  • Edit the function type properties, and in the Context Parameters tab, create the default state of the component
  • Generate the code skeletons and implement the generic behaviour of the component


Then the process to export the component type is the following:

  • Right-Click on the function and choose Export Type


When you export the function the tool proceeds with the following actions:

  • Create a new folder FunctionName in the shared component folder
  • Copy DataView.aadl in that new folder
  • Copy all the .asn files referenced in DataView.aadl in that new folder
  • Copy recursively the folder work/FunctionName (containing the component implementation) into that new folder
  • Create and copy a file named (in lowecase) functionname-iv-functionname.aadl


The file functionname-iv-functionname.aadl contains the component description itself. It is like an Interface View but containing a single package:

 PACKAGE FunctionName::IV::FunctionName

After the component is exported, it does not appear anymore in the local project (the block disappears). It now appears in the Workspace together with other shared components:

ClipCapIt-200907-112128.PNG

When the TASTE Interface View editor is executed, it parses the shared folder of components and gather the shared function types to update this workspace with the list of available components.

Non-exported shared components, if any, appear just below in the workspace.

It is possible to re-import a shared model to make local modifications and re-export it. Use the menu New -> Import Shared Types to proceed.

When doing this, special care has to be given to the DataView namespace. If you import a component for modification in a new project that has already a different dataview, this dataview will also be exported to the shared component after you are done with your modifications. Since this is unlikely what you want, make sure you don't already have a dataview before importing.

Instantiating a component type

To instantiate a component type, local or shared, the process is the following:

  • Drag and drop it from the workspace or use the contextual menu
  • Edit the instance properties and modify the Context Parameters default values to specialize your instance (the tool does not allow you to add new context parameters - you can only edit the default value of the ones defined in the component type)


ClipCapIt-200907-112848.PNG


When you instantiate a component type, the Interface view will make a reference to the component type using these two properties:


ClipCapIt-200907-113028.PNG


The tool does not copy any file from the component type. During the build, the component type will be retrieved and instantiated as expected.