• No results found

Object-Oriented Language

An object-oriented language is a programming language that has built in key words or constructs that either force or facilitate object oriented programming. For example, C++ is one, because it supports classes, objects, inheritance, and polymorphism. The C language is not.

However, you can do object oriented programming with a non-object oriented language; it is just harder. You can certainly have an object model with inheritance of attributes and methods without using an object oriented language. This is what we present through ITK.

Internally, much of Teamcenter is written in C++. This provides an easy way of handling polymorphism. You can take advantage of this in the ITK as well. If you want to execute a method on an object, you do not need to call a function specific to that action-class pair. You may call any function with that action up the tree of superclasses for the selected object. For example, if you want to ask the name of an envelope, you do not need to call the EMAIL_ask_envelope_name function (in fact, that function does not exist). You can call the WSOM_ask_name function two levels up in the hierarchy instead. That function realizes that it was actually passed an envelope and invokes the envelope’s method to get the name.

Chapter

5

Using ITK Functions

Format . . . 5-1 Variable Naming Conventions . . . 5-3 Class Hierarchy . . . 5-3 Debugging . . . 5-4 Journal Files . . . 5-4 System Logs . . . 5-6 Logging . . . 5-6 Error Handling . . . 5-7 Teamcenter Errors . . . 5-7 Fixing Invalid Unicode Characters . . . 5-7 Memory Management . . . 5-10 Include Files . . . 5-10 Initializing Modules . . . 5-12 Special Data Types . . . 5-12 Compiling . . . 5-13 Linking Standalone Programs . . . 5-13 Important Comment for linkitk . . . 5-14 Linking User Exits in UNIX and Linux . . . 5-14 Linking User Exits in Windows . . . 5-15 Exporting New Symbols From libuser_exits.dll on Windows . . . 5-16 Compiling and Linking Server Exits in Windows . . . 5-17 Running the Executable . . . 5-20 Batch ITK . . . 5-21 Batch Program Template . . . 5-21 Compiling and Linking Batch Programs . . . 5-23 Supplier Custom Hooks . . . 5-24 Introduction . . . 5-24 Environment . . . 5-24 Building the Library File . . . 5-24

Registering User Exits Customization . . . 5-26 Registering Server Exits Customization . . . 5-28 Executing Multiple Customizations . . . 5-29 Registering Customizations . . . 5-30 CUSTOM_register_callbacks . . . 5-30 CUSTOM_register_exit . . . 5-30 CUSTOM_execute_callbacks . . . 5-31 CUSTOM_execute_callbacks_from_library . . . 5-32 Example . . . 5-33 Registering Runtime Properties Using Custom Hooks . . . 5-34

Chapter

5

Using ITK Functions

This chapter describes the format of ITK functions as well as details about writing, compiling, linking, and running ITK programs.

Format

All ITK functions have a standard format that attempts to give the most information possible in a small space. A template is shown below, followed by a more detailed description. All prototypes are located in include files named classname.h for the class of objects that the functions operate on. For more information about specific functions, see the Integration Toolkit Function Reference

The design intent for the format of ITK functions is to provide the maximum amount of information in a small space. The standard format is:

int module_verb_class_modifier ( const type variable-name[dimension] /* [I/O/OF] */ );

int Nearly all ITK functions return an integer error code. This code can be passed to the EMH_get_error_string function.

module This is the module designator. Related classes are grouped together in modules. For example, the Dataset,

DatasetType, Tool, and RevisionAnchor classes are all

handled by the AE module. Other examples of modules are

PSM, POM, FL, and MAIL.

verb This is the first key word describing an action to be taken on an object or set of objects. Common actions are create, add,

remove, copy, set, and ask.

class This is the class name or an abbreviation of the class name. The exceptions are for modules that only deal with one class, like Workspace or modules that deal with many classes, like WSOM and POM.

modifier This is a word or several words that give more description of how the action of the verb applies to the class. For example, in the RLM_update_af_status function, status indicates what is being updated in the af (authorization folder).

const Input pointer variables which are not meant to be modified

normally are declared with a const to ensure that they are not accidentally modified.

Chapter 5 Using ITK Functions

type This is the data type of the argument (for example, int,

tag_t*, or char***).

variable-name This is a variable name that is descriptive enough so a programmer does not need to look it up in the documentation.

dimension This value is normally specified for arrays where the calling program is responsible for allocating space. They are normally specified with a constant definition of the form module_description_c. These constants should be used in dimensioning arrays or looping through the values of an array to make your programs more maintainable. However, you may see the values of these constants in the include files. This is useful so you do not establish naming conventions that leads to name strings longer than can be passed to the functions.

I/O/OF These characters indicate whether the particular argument

is input, output or output-free. Output-free means that the function allocates space for the returned data and this space should be freed with the MEM_free function.

Using ITK Functions