Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

Creating dynamic modules and program skeletons

Creating Modules
How to use the module creation wizard.

Creating Programs
How to use the program creation wizard.

Creating UUIDs
How to create UUIDs.

Creating Modules

Modules are created with the program PACCreateModuleFiles. After compiling and installing PAC you should find the binary file in the bin sub-directory of your PACLib directory. The program expects a single parameter: the filename of a module configuration file. Such a file has a very simple structure.

Each line is ended with a linebreak and may only contain a single word. The first line gives the name of the module. Now groups of class definitions follow. Each class definition consists of a class name and a list of interface names. A class definition is ended with an empty line. The names of the classes and interfaces must be given without the leading C or I as described in the conventions section. They are added automatically.

For example, suppose you want to create a module with the name MyModule which contains the classes Camera and BMPFile. The class Camera implements the interfaces ImageSource and CameraAccess and the class BMPFile implements the interfaces ImageSource and FileAccess, then the module configuration file looks like this:

MyModule
Camera
ImageSource
CameraAccess

BMPFile
ImageSource
FileAccess

PACCreateModuleFiles creates a subdirectory in its execution path with the module name. In this path you find the following files:

The source code created by PACCreateModuleFiles is documented. Please read this documentation thoroughly to get some idea of how all this works.

You should create new modules in the main PACLib path. The following steps give an example of what you should typically do to create a new module.

  1. Change to the main PACLib path, e.g. /home/chp/PACLib.

  2. Create a module configuration file as detailed above. Let's call it module.config.

  3. Execute the following command: bin/PACCreateModuleFiles module.config

  4. Change to the newly created directory and call SETUP and then BUILD to compile the module. The module is automatically installed in the lib subdirectory of PAC_HOME.


Creating Programs

Program skeletons can be created with the program PACCreateProgramFiles. This program expects two parameter: the name of the program that is to be created and its type. It then creates a subdirectory in its execution path with the name of the program. Again you will find a SETUP and a BUILD script and the standard doxygen files. The program source can be found in the source subdirectory. It contains many comments which should help you to understand how modules are used. Use the programs created in this way as templates for your own work. Note that the BUILD script installs the binary in the bin subdirectory of PAC_HOME. The command line syntax is as follows:

PACCreateProgramFiles -name [Name] -type [plain | pacapp]

If you choose type pacapp you get a program skeleton based on the CPACApplication class. This should be your preferred choice if you want to work with images.

You have to set PAC_HOME appropriately before executing PACCreateProgramFiles.


Creating UUIDs

PACCreateModuleFiles creates the necessary UUIDs for the interfaces that you specify. If you want to add new interfaces later on, you only want to create a UUID, not a whole new module.

This can be achieved with the program PACCreateUUID. The program expects a single parameter which is the name of the interface without the leading I. The appropriate source code is then created and written to the standard output. Simply copy and paste the output into your interface declaration header file.

For example, the output of PACCreateUUID TestClass looks like this:

#if !defined( _PAC_IFC_ITESTCLASS_0FC759AF_5184_45CB_BB3AD848755D4DDE_DEFINED_ )
#define _PAC_IFC_ITESTCLASS_0FC759AF_5184_45CB_BB3AD848755D4DDE_DEFINED_

/// To implement the UID { 0fc759af-5184-45cb-bb3ad848755d4dde } write:
PAC_IMPLEMENT_UID(ITestClass, 
				0x0f, 0xc7, 0x59, 0xaf, 
				0x51, 0x84, 
				0x45, 0xcb, 
				0xbb, 0x3a, 0xd8, 0x48, 
				0x75, 0x5d, 0x4d, 0xde);

// Insert your interface declaration here.

#endif
Perception-Action Components Library - PACLib
developed by the Cognitive Systems Group