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

From TASTE
Jump to: navigation, search
(Shared library of component types)
 
(3 intermediate revisions by the same user not shown)
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 ===
Line 69: Line 70:
  
 
* Drag and drop it from the workspace or use the contextual menu
 
* 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
+
* 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)
  (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)
+
 
  
 
:[[File:ClipCapIt-200907-112848.PNG]]
 
:[[File: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:
 
When you instantiate a component type, the Interface view will make a reference to the component type using these two properties:
 +
  
 
:[[File:ClipCapIt-200907-113028.PNG]]
 
:[[File: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.
 +
 +
== Import/Export of complete parts of Interface View ==
 +
 +
The second option is to export a function or a group of connected functions into a different folder and let the user import it in a new project. In that case there is no instantiation: the import function will copy the component and its implementation locally as if it was created for the new project. The implementation can be modified at will without impacting the exported component.
 +
 +
 +
This works for any combination of supported TASTE languages.
 +
 +
 +
The default folder for the library of components is ~/tool-inst/share/components_library
 +
It contains by default the PeekPoke component:
 +
 +
 +
:[[File:ClipCapIt-200907-115710.PNG]]
 +
 +
=== Export ===
 +
 +
The process for exporting is the following:
 +
 +
* Select a function or a group of functions and using the contextual menu choose ''Export Functions''
 +
 +
When doing so the tool will copy, as for the function types:
 +
 +
* All selected function implementations: ''work/<functionNames>'' folders (in the case of Peek Poke, the code is zipped, but this is not the default)
 +
* the DataView.aadl and ASN.1 files
 +
* a file named interfaceview.aadl containing the architecture (including connections) of the exported components
 +
 +
=== Import ===
 +
 +
The list of components appear in the workspace of the Interface View editor, as for the shared types:
 +
 +
:[[File:ClipCapIt-200907-115910.PNG]]
 +
 +
Individual functions or the complete imported architecture can be drag-and-dropped to the current system. The Dataview will be merged (ASN.1 files will be copied) to the local folder (make sure the name of the ASN.1 models is not DataView.asn when you export). All the function implementations will be copied to the ''work'' folder.

Latest revision as of 10:02, 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.

Import/Export of complete parts of Interface View

The second option is to export a function or a group of connected functions into a different folder and let the user import it in a new project. In that case there is no instantiation: the import function will copy the component and its implementation locally as if it was created for the new project. The implementation can be modified at will without impacting the exported component.


This works for any combination of supported TASTE languages.


The default folder for the library of components is ~/tool-inst/share/components_library It contains by default the PeekPoke component:


ClipCapIt-200907-115710.PNG

Export

The process for exporting is the following:

  • Select a function or a group of functions and using the contextual menu choose Export Functions

When doing so the tool will copy, as for the function types:

  • All selected function implementations: work/<functionNames> folders (in the case of Peek Poke, the code is zipped, but this is not the default)
  • the DataView.aadl and ASN.1 files
  • a file named interfaceview.aadl containing the architecture (including connections) of the exported components

Import

The list of components appear in the workspace of the Interface View editor, as for the shared types:

ClipCapIt-200907-115910.PNG

Individual functions or the complete imported architecture can be drag-and-dropped to the current system. The Dataview will be merged (ASN.1 files will be copied) to the local folder (make sure the name of the ASN.1 models is not DataView.asn when you export). All the function implementations will be copied to the work folder.