<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- Documentation of the library functionality of AF3. @author ratiu @ConQAT.Rating GREEN Hash: EC13F88E064A8198F088B4F359B570AA --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Using the Library in AF3</title> </head> <body> <h2><u><font color="#336699">Libraries</font></u></h2> <font color="#ff0000"><b>Warning: this feature is experimental</b></font> <p> AF3 Library enables the reuse of components, user defined data types and functions. <h4><font color="#336699">Library View</font></h4> To toggle between the projects and library views, click on the following icon. <br><br> <img src="./pictures/Library.ToggleLibraryView.png"> <br><br> <h4><font color="#336699">Creating and organizing a library</font></h4> A library can be created by clicking on the following icon. <br><br> <img src="./pictures/Library.NewLibrary.png"> <br><br> Once a library is created, you can change its name. A file in the workspace <i>AF3-Lib</i> directory is associated to each library. This file is accessible by switching to the <i>Storage</i> perspective. In the next picture we can see the structure of workspace after creating a library called "MathLib". <br><br> <img src="./pictures/Library.FilesLayout.png"> <br><br> The content of a library is structured in packages. A package can contain sub-packages or library components. To create a package, right-click on the library and select <i>New package</i>. To create a sub-package, right-click on a package and select <i>New package</i>. <br><br> <img src="./pictures/Library.NewPackage.png"> <br><br> <h4><font color="#336699">Adding Components to a Library</font></h4> To add a component to a library, right-click on the component and select the <i>Add to Library</i> menu entry. Next, you should select the package that will contain the component. <br><br> <img src="./pictures/Library.AddComponent.png"> <br><br> When changing to the library view, a component that belongs to a library is displayed below the corresponding package as shown below. <br><br> <img src="./pictures/Library.LibraryComponent.png"> <br><br> <b> Important:</b> before a library component can be used in a project, the library MUST be saved. <h4><font color="#336699">Adding User Defined Functions and Types to a Library</font></h4> To add a user defined type (or user defined function) to a library, right-click on the type (or function) from the data-dictionary and select the <i>Add to Library</i> menu entry. Next, you should select the package where the component is saved in. <br><br> <img src="./pictures/Library.AddType.png"> <br><br> <br><br> <img src="./pictures/Library.AddFunction.png"> <br><br> When changing to the library view, the functions and types will be visible in the library under the corresponding package as shown below. <br><br> <img src="./pictures/Library.LibraryTypes_And_Functions.png"> <br><br> <h4><font color="#336699">Using Library Components in AF3 Projects</font></h4> Available library components are shown in the <i>Model Elements</i> view as shown below. To create a reference, just drag and drop the library component to the diagram. <br><br> <img src="./pictures/Library.CreatingComponentReference.png"> <br><br> If a library component is changed (in the library view), the change is propagated to all references immediately after saving its corresponding library. <h4><font color="#336699">Disconnecting Components from a Library</font></h4> A component reference can be disconnected from a library. In this case, changes are no more propagated from the library and the component can be changed independently of other library components. To disconnect a component from a library, right-click on the component and select <i>Disconnect from Library</i>. <br><br> <img src="./pictures/Library.DisconnectComponent.png"> <br><br> <h4><font color="#336699">Using Library Functions and Types in AF3 Projects</font></h4> Available library functions and types are shown in the <i>Model Elements</i> view as illustrated below. To create a reference, just drag and drop the library function / type into a data-dictionary. <br><br> <img src="./pictures/Library.CreatingTypes_And_FunctionsReference.png"> <br><br> Once functions are saved into a library, they can be referenced also from other library packages that contain a data-dictionary. In this manner, user defined functions and types can be used within library components. <br><br> <img src="./pictures/Library.UsingTypes_And_FunctionsReferenceWithinLibrary.png"> <br><br> </body> </html>