Oovaide Examples

Last updated: Aug 18, 2015

Contents

  1. Contents
  2. Example Notes
  3. Simple Example
    1. Classes
    2. Sequences
    3. Portion
    4. Code Test Coverage
  4. StaticLib Example
    1. Components
    2. Classes
    3. Sequences
  5. SharedLib GTK Example
    1. Components
    2. Classes
    3. Sequences
  6. Namespaces, Templates and Typedefs Example
  7. Oovaide Example

Example Notes

It should be fairly simple to analyze the samples with the downloadable Oovaide packages.  The Build may take more setup depending on the configuration. If the builds fail, the build configuration can be set up in the Analysis/Settings menu.

Simple Example

This example creates a single executable file. It only has two source files, and has a dependency on STL.

  1. Start Oovaide
  2. Select File/New Project from the menu.
  3. Select trunk/examples/simple using the "..." button. The project directory will default to "simple-oovaide".
  4. Wait for the drawing analysis to complete.
  5. View the "Class" tab, and click on "Lamb". The class diagram will display.
  6. Right click on the Lamb or other classes, and select Add Standard Relations or Add All Relations to see more of the related classes to the selected class.
  7. Performing a full analysis on some projects requires that the system include directories are found and other external directories are specified. This depends on the compiler and libraries installed on the system. For example, clang searches for some standard mingw or mingw-builds directories. Performing a full analysis can be set up by using Analysis/Settings and using "External Project Packages" to define other include paths. For example, mingw-w64 may be needed on Windows for stdio.h.
  8. Select Build/Settings from the menu. Select the Component Type of Program/Executable.
  9. Select Build/Build Debug to create a debug version of the program. The program will build if the clang or mingw compiler is available on the system. See the user guide if there are any build configuration problems.
  10. The executable will be in trunk/examples/simple-oovaide/out-Debug.
Additional files can be added to the component, and are automatically built into the executable.

Classes

The class diagram looks something like the following.


Relation Between
Description
World and Mary
The filled aggregation symbol (diamond) is a standard UML symbol, and means that the World owns or contains (controls the lifetime of) the Mary class. This relation is also sometimes called a "has-a" relationship. The filled circle indicates that the Mary object is private in scope.
Mary and Lamb
The Mary object owns the Lamb object, and the Lamb object is public. In other words, Mary has a Lamb.
Mary and Mammal
The inheritance symbol (triangle) is a standard UML symbol, and means that the Mary object inherits from the Mammal object.  The Mammal object is a superclass of Mary, and has public inheritance, as shown by the visibility symbol (nested circles).
Lamb and Mammal
The function parameter symbol (big circle with little circle) means that a function parameter refers to the Mammal object, and the V symbol means that this is a const reference.

Sequences

The Sequence diagram looks like the following.



Operation Operation Description
World::World The World object provides a World method constructor. The constructor constructs a Location object, then the move method is called to set the location of the MoveableThing. In this case, Mary is the MoveableThing that is moved.
Lamb::follows
The World object then calls the Lamb follows method, which gets the location of the Mary object, and sets the location of the Lamb object. The getLocation operation is shown as a dashed line, since it is a const operation, and will not modify the MoveableThing object.
Mary::showLocation
The World object calls showLocation for the Mary object.
Lamb::showLocation
The World object calls showLocation for the Lamb object, which shows the location for the Lamb, and the Fleece.

Portion

The Portion diagram for the Lamb class looks like the following.

Method Method Description
follows The follows method calls the move method, and interacts with the MoveableThing class.
showLocation The follows method either reads or writes the mFleece member variable, and interacts with the MoveableThing class.

Code Test Coverage

The Oovaide program contains tools to support flow path test coverage analysis. This shows the percentage of paths that have
been tested in each source file and shows the number of times that each instrumented line was executed. See Test Coverage for more details.

  1. Start Oovaide if it is not already running and open the simple-oovaide example.
  2. Select Coverage/Instrument from the menu. This adds instrumented lines to the source code.
  3. Select Coverage/Build from the menu. This creates a new sub-project and builds it.
  4. Run the output program in oov-cov-oovaide/out-Debug. This runs the program and generates a file that contains the number of times each instrumented line was executed.
  5. Select Coverage/Statistics from the command line. The oov-cov-oovaide/oovCovStats.txt file contains the percentage of coverage for each file. In addition, theoov-cov-oovaide directory contains all source code with indications of which lines have been executed. Search for "//<space>" to find lines that have not been executed.

StaticLib Example

This example creates an executable file with a static library.

  1. Start Oovaide
  2. Select File/New Project from the menu.
  3. Select trunk/examples/staticlib using the "..." button. The project directory will default to "staticlib-oovaide".
  4. Wait for the analysis to complete.
  5. View the "Class" tab, and click on "BlackSheep". The class diagram will display.
  6. Depending on the compiler and libraries installed on the system, it may be required that the Analysis/Settings must be used to set "External Project Packages that define other include paths. For example, mingw-w64 may be needed on Windows for stdio.h and vector.
  7. Select Build/Build Settings from the menu.
    1. Select the Component Type of Static/Compile-time Library for the BlackSheep component.
    2. Select the Component Type of Program/Executable for the <Root> component.
  8. Select Build/Build Debug to create a debug version of the program.
  9. The executable and static library will be in trunk/examples/simple-oovaide/out-Debug.

Components


Classes

The class diagram looks like the following.


The BlackSheep and the WoolBag classes are in the BlackSheep Component. The other classes are in the MainClients component.

Sequences

The Sequence diagram looks like the following.


The lower takeBag operations are shown with square boxes to indicate that the definition has already been shown above.


SharedLib GTK Example

This example shows a more complex directory structure and contains shared libraries. (Known in Windows as DLL's).

  1. Start Oovaide
  2. Select File/New Project from the menu.
  3. Select trunk/examples/shardlibgtk using the "..." button. The project directory will default to "sharedlibgtk-oovaide".
  4. Wait for the analysis to complete.
  5. View the "Class" tab, and click on "Kingdom". The class diagram will display.
  6. Right click on the ResourceClient, and select "Add All Relations". This will add one more class.
  7. To prevent __builtin_... errors, add "-Iclang/3.6.0/include" so that it is on a line before any -EP arguments.
  8. Depending on the compiler and libraries installed on the system, performing a full analysis can be set up by using Analysis/Settings and selecting "External Project Packages" to define other include paths. For example, GTK3 may be needed on Windows for gmodule.h.
  9. Select Analysis/Settings in the Build Arguments tab, and click on Extern Project Packages. Press the Add button to add packages. Be sure to download the packages if they do not exist on your machine. Include paths are scanned in the order that packages and external references are specified. During the link, the libraries are scanned in opposite order. Project package order is determined by the builder.
    1. On Windows select gtk+-3.0.  View the packages to check if the directories and settings are correct. Remember that external references are recursive.
    2. In Linux add gmodule-2.0. Add the -fPIC and -lnk-rdynamic flags also to the build arguments.
  10. If the External Project Packages method does not work, the Linux settings can be set to something like this:
    1. -ER/usr/include/gtk-3.0
    2. -ER/usr/include/glib-2.0
    3. -I/usr/Include/linux
    4. -ER/usr/lib/x86_64-linux-gnu/glib-2.0/include
    5. -ER/usr/lib/x86_64-linux-gnu!libmcheck!libieee
    6. -lnk-rdynamic
    7. -fPIC
  11. Select Build/Build Settings from the menu.
    1. Select the Component Type of Shared/Run-time Library for the horses and men components.
    2. Select the Component Type of Program/Executable for the kingdom component.
  12. Select Build/Build Debug to create a debug version of the program.
  13. The executable and static library will be in trunk/examples/simple-oovaide/out-Debug.

Components

The components only show relationships to the external GTK package since they only have dynamic relationships between themselves. This dependency is on Windows where the GTK package includes the gmodule package. The two shared libraries are loaded by one program.


On Linux, the dependencies look like the following:




This project directory structure looks like the following:
        sharedlibgtk
	    kingdom
                kingdom.cpp
                kingdom.h
            resources
                horses
                    horses.cpp
                    horses.h
                men
                    men.cpp
                    men.h
    

Classes

The following is the class diagram. Only the main executable class diagram is shown here.


Sequences



Operation
Operation Description
Kingdom::open
Before the open, the *[:resources] is the C++ range-based for loop indication. The increasing lifeline width is showing the nesting of conditionals. This shows that if putTogether returns false, that then getResourceName is called.
ResourceClientInterface::putTogether
This function calls the function pointer in the shared library that was set up by the Kingdom::open call.
ResourceClient::loadSymbols
This symbol shows that the ResourceClient::open function called the ResourceClient::loadSymbols function.

Namespaces, Templates and Typedefs Example

This is a complex example showing nested namespaces, typedefs of templates, relations of typedefs to other classes, and many other features.

Template relations are shown as a UML dependency arrow, which is a dashed line with an arrow. Template definitions are shown with a "<< template>>" stereotype.

Typedefs are shown using a "<< typedef>>" stereotype, and is shown as being inherited from the class that is being renamed.


Oovaide Example

The Oovaide example will build all of the Oovaide programs, which includes multiple libraries and executables. This example has multiple processes and threads, graphics, and many other features. This example is under the test directory, and supports Windows or Linux.

Opening the project will automatically update the external project packages using the packages available on the system. Linux uses pkg-config, which should be on many distributions of Linux. On Windows, the Scan button may find the correct location, otherwise enter the directory manually. The packages can be manually set up using the External Project Packages button on the Analysis Settings Dialog.

The component types should be already set, but can be manually viewed or changed using Build/Settings. The oovBuilder, oovCMaker, oovCppParser, and oovEdit shoud be set to Program/Executable, and the oovCommon and oovGuiCommon should be set to be static libraries.

Explanations of the classes and components is in the Oovaide Design document.

Some extra points: