Ide/Creating new Project Items/Creating a Interface


Creating an Interface

An interface definition defines the named object type. All predicates declared in an interface are object members in objects of the interface type. To create a new interface and to add it into one of the packages registered in the project you should activate the File | New IDE command. In the left pane of the opened Create Project Item dialog you should select Interface. Then the dialog accepts the following shape:

The New Interface Dialog


In the Name edit control you should type in an interface name (the interfaceName on the picture).


In the Package list button you should select one of the packages registered in the project (the NewPackage.pack on the picture). The created interface will be included into this package. The created file with the default declaration of this interface will be placed into the selected package subdirectory. This subdirectory name is displayed after the package name; it is (NewPackage\) in the picture.

After you fill in all required settings you can press the Create button. The IDE creates the interface definition file (it appears in the project tree in the Project Window after compilation of the package) and the #include @"NewPackage\interfaceName.i" directive is added into the package header file of the specified package:

% exported interfaces
#include @"NewPackage\interfaceName.i"

Since the package header file should be inserted by the #include @"" directive in all places, where the package is used, so in all these places the #include @"NewPackage\interfaceName.i" directive also be seen. This means that the interface interfaceName is public.

If you wish to create an interface that should be private to the NewPackage package, then the include directive for this interface can be manually moved into the package implementation file NewPackage.pack:

% private interfaces 
#include @"NewPackage\interfaceName.i"

Therefore, the interface declaration will not be seen outside of the package implementation. So the interface will be private to the package implementation.

Notice that information about a new interface does not appear in the project browse information until the package including this interface is compiled.