Definition
Each object has a name. The name is a character string that is unique among its sibling objects in the object hierarchy.
In a C function, the object name's type is OMobj_name.
For example:
/* Get the name of the object whose id is func_id. */
OMobj_id func_id;
OMobj_name func_name;
int status;
...
status = OMget_obj_name (func_id, &func_name);
OM_NULL_NAME
In an Object-Manager routine, where an object-name argument is optional, you can specify the following constant to indicate no object name:
OM_NULL_NAME
OMobj_name is an integer
The Object Manager does not store and manipulate an object's string directly, but rather allocates a unique integer value that maps directly to a particular string. OMobj_name holds that integer value.
This approach has two primary benefits: it prevents strings from being duplicated in memory; and it allows two strings to be compared with a single integer compare.
Converting to and from an object name
The Object Manager has routines to convert between an object name, which is an integer, and its corresponding string:
Routine
|
Purpose
|
Converts a string to an object name | |
Converts an object name to a string |
For example:
OMobj_name object_name; // An integer.
char object_string[30];
...
object_name = OMstr_to_name("My string");
strcpy(object_string, OMname_to_str(object_name));