TOC PREV NEXT INDEX

Core AVS/Express and the Object Manager


1 Object Manager Application Programming Interface


This appendix describes the routines in AVS/Express' Object Manager C and C++ Application Programming Interfaces (APIs).

Note: The Object Manager also provides a FORTRAN API which is documented separately in Appendix D.

This chapter discusses:

1.1 Organization of this appendix

This appendix begins with a set of tables that summarize routines by functional category. Use these tables to help you find a routine you need to perform a particular task. This appendix then introduces basic data types used by the Object Manager API, then presents the routines in the API.

Types of routines

There are five different types of routines in this appendix:

Generally, the routines are organized alphabetically with the following exceptions:

Mapping between C and C++ API routines

When a C++ API method is documented with a C API routine, the parameters, return code, and functionality will be the same with one exception. The first argument to the C API routine is replaced by the object on which the C++ method is invoked. For example, the following C API call:

OMobj_id obj_id = ...
OMset_int_val(obj_id, 3);

is the same as the following C++ method call:

OMXobj *obj = ...
obj->set_int_val(3);
Defaulted C++ arguments

Some C++ methods have defaulted arguments. If you do not supply a value for these arguments, the default value is supplied. In this document, the defaulted arguments are indicated in the declaration of the routine. For example:

void *OMXobj::ret_array_ptr(
int  mode,
int  *size = NULL,
int  *type = NULL);

In this definition, you can call this routine as:

void *my_ptr = my_obj->ret_array_ptr(OM_GET_ARRAY_RD);

If you do, NULL values are supplied for the size and type arguments.

1.2 Summary of routines by category

This section summarizes the Object Manager Library routines, by category.

In the tables below, where two or more routines appear together, you can find the details for them under the entry for the first routine listed.

1.2.1 Getting and comparing an object's id and name
Routine
Description
Returns the object id for a specified object name.
Treats an object's set of subobjects as an array and returns the object id of a specified subobject.
OMget_num_subobjs
Returns the number of subobjects for a given parent object.
Gets, sets, or deletes an object id in a one-dimensional array object. The object is either an array of pointers/references to other objects or a by-value group array.
Gets the id of an object's parent.
Compares two object ids.
Determines whether an object id is null.
Convert a OMobj_name to a string, and vice versa.
Returns the id of an object's subobject, specified as a path.

1.2.2 Creating or deleting an object
Routine
Description
Creates an object from a specified class object
Creates an object from a specified primitive type
Creates an object from a specified class or primitive type
Decrements an object's reference count, deleting the object if the reference count is 0
Deletes all references to an object, then deletes the object
Returns an object name that is unique among a specified object's subobjects
Makes one object the subobject of another
Deletes an object from its parent
Makes one object an immediate subobject of another
Add to reference count of an object

1.2.3 Getting and setting an object's definition
Routine
Description
Gets an object's data type
Gets or sets an attribute of an object
Gets or sets an object's name
Gets the current sequence number
Gets a particular object's sequence number
OMget_obj_prop and OMset_obj_prop
OMget_obj_iprop
OMget_obj_rprop
OMget_obj_sprop
OMset_obj_iprop
OMset_obj_rprop
OMset_obj_sprop
OMset_obj_iarray_prop
Gets or sets a property of an object
Gets or sets an object's reference mode
Returns an object's name as a character string
Returns an object's full pathname as a character string
Returns an object's partial pathname as a character string
Tests an object's base type
Returns the base type id corresponding to a type name

1.2.4 Getting and setting an object's connections

Routine
Description
Connects one object to another (useful for connecting to an array of objects)
Inserts a new connection into an existing list of connections
Connects one object to another (useful for connecting to a single object)
Disconnects one object from another
Gets a list of connections from an object
Gets a single connection from an object
Gets the number of connections for an object
Connects one object to another using an intermediate name-link object
Gets the connections from an object
Gets the list of ports for an object

1.2.5 Getting and setting a scalar object's value
Routine
Description
Gets or sets an object's value. You use these routines when an object's mode is by-reference or by-pointer, to determine the pointed-to object.
OMget_int_val and OMset_int_val
OMget_name_int_val
OMset_name_int_val
Gets or sets an integer object's value
OMget_ptr_val and OMset_ptr_val
OMget_name_ptr_val
OMset_name_ptr_val
Gets or sets a pointer object's value
OMget_real_val and OMset_real_val
OMget_name_real_val
OMset_name_real_val
Gets or sets a floating-point object's value
OMret_str_val
OMget_str_val and OMset_str_val
OMret_name_str_val
OMget_name_str_val
OMset_name_str_val
Gets or sets a string object's value

1.2.6 Getting and setting an array object's value
Routine
Description
Returns the value of an array (used for getting and setting an array objects' value)
Allocates space for an array object
Frees an array object's space
Increments reference count on array allocated with ARRalloc
Gets an array object's dimensions
OMget_array_ref
OMset_array_size
Gets or sets a one-dimensional array object's size
Gets or sets an element in a one-dimensional string-array object
OMget_sub_barray and OMset_sub_barray
OMget_sub_sarray
OMget_sub_iarray
OMget_sub_farray
OMget_sub_rarray
OMset_sub_barray
OMset_sub_sarray
OMset_sub_iarray
OMset_sub_farray
OMset_sub_rarray
Gets or sets a subarray of an array object
Sets an array object (i.e., all elements in an array object)

1.2.7 Method utility routines

Routine
Description
Indicates whether or not a parameter has changed
Updates method's percent done, running module and allows interrupt
Allows reuse of code that uses OMstatus_check

1.2.8 Controlling execution
Routine
Description
Adds or deletes a notification request
Defines a push/pop context
Suspends and resumes object execution
EVadd_select
EVdel_select
Adds or deletes an event callback handler
EVXinit_display
EVXadd_event_hndlr
EVXdel_event_hndlr
EVXdel_events
Defines callback handlers for X events
OMset_state_mode
Sets the state mode in a context
Delivers any pending expose events
Sets an object's instanced flag so it can execute


1.2.9 Debugging an application
Routine
Description
OMedit_obj
OMedit_root_obj
OMedit_obj_ptr
Brings up the VCP on an object
OMprint_obj
OMprint_obj_ptr
Prints an object's definition
Prints the notifications on an object
OMprint_path
OMprint_path_ptr
Prints an object's path
Sets the verbose mode for a set of events

1.2.10 Managing processes

Routine
Description
Adds a function to be called when the process exits
Determines whether the calling process is the scheduler
Starts the main loop for dispatching events
Returns an object's process id
Exits cleanly from the currently running process
OMprocess_exit
Causes the specified process to exit.; can be used to get the main process to exit from an external process
Initializes the Object Manager
Returns value of XP_PATH

1.2.11 Saving and restoring objects
Routine
Description
Parses V statements stored in a character string
OMparse_obj_val
OMparse_obj_ref
Parses the value of an object using V
Reads and parses a stream of V statements
Reads an ascii V file into AVS/Express
Reads an ascii or binary V file into AVS/Express
Saves an object to a a text V file

1.2.12 Mapping method objects to actual functions
Routine
Description
Adds a single entry to AVS/Express' function-identifier table
Adds several entries to AVS/Express' function-identifier table
Returns the identifier corresponding to a function
Returns the function corresponding to an identifier
Gets or sets a method object's function pointer

1.2.13 Methods on a C++ API object

C++ method
Description
Constructor for creating a new AVS/Express object
Implements the cast operation for AVS/Express C++ objects
OMret_omx_ptr
Returns a pointer to a C++ class corresponding to an AVS/Express object
Returns a pointer to a user-defined C++ class associated with an AVS/Express object
For C++ method...
See C API routine..
Description
OMXobj::add_obj_ref
Adds a connection to an object
OMXobj::del_obj_ref
Deletes a connection from an object
OMXobj::set_obj_ref
Sets the connection for an object
OMXobj::get_array
Gets the value of an array (for reading and/or writing)
OMXobj::set_array
Set the value of an array
OMXobj::get_array_size
Gets the size of a one-dimensional array
OMXobj::get_int_val
OMXobj::set_int_val
Gets and sets an integer value
OMXobj::get_real_val
OMXobj::set_real_val
Gets and sets a real value
OMXobj::ret_array_ptr
Returns the pointer to an array type
OMXobj::
ret_typed_array_ptr
Returns the pointer to an array object and forces the type to a supplied type
OMXobj::changed
Indicates whether or not a parameter has changed
OMXobj::push_ctx
OMXobj::pop_ctx
Controls method execution

1.2.14
Routine
Description
ERRsquash_start
ERRsquash_end
Suppresses errors generated by API routines
Error handling
1.2.15 Worldwide language support

Routine
Description
Loads a dictionary file
Translates a string

1.3 Object id
1.3.1 OMobj_id
Definition

AVS/Express assigns each object a unique id.

In a C function, the id's type is OMobj_id.

For example, the following V code defines group object grp1 and two subobjects, a and b:

group grp1 {
int a;
int b;
};

A C program can obtain the object ids of grp1, a, and b. Assume that grp1's parent id is parent_id:

OMobj_id parent_id, grp1_id, a_id, b_id;
...
grp1_id = OMfind_subobj(parent_id, OMstr_to_name("grp1"),
OM_OBJ_RW);
a_id = OMfind_subobj(grp1_id, OMstr_to_name("a"),
OM_OBJ_RW);
b_id = OMfind_subobj(grp1_id, OMstr_to_name("b"),
OM_OBJ_RW);
OMobj_id is a structure

OMobj_id is a two-value structure defined in the header file <avs/om.h> as follows:

typedef struct _OMobj_id {
OMobj_id_type  obj_id; /* Pointer within a process. */
OMproc_id  proc_id; /* Process id. */
} OMobj_id;
Initializing a OMobj_id

You generally can ignore the fact that OMobj_id is a structure. But be aware that on some compilers, you cannot initialize a OMobj_id in its declaration:

OMobj_id id = OMnull_obj;  /* Error on some compilers. */

Instead, do the following:

OMobj_id id;
id = OMnull_obj;
Comparing ids

To compare object ids, use the routine OMequal_objs:

if (OMequal_objs(obj_id1, obj_id2))
...
Determining whether an id is null

To determine whether an object id is null, use the routine OMis_null_obj:

if (OMis_null_obj(obj_id))
...
1.3.2 Predefined object ids

The following are variables of type OMobj_id. They are provided by the Object Manager, in <avs/om.h>, and initialized at system start-up.

This predefined variable...
is set to...
OMinst_obj
The id of the Applications object
OMnull_obj
A null object id
OMroot_obj
The id of the Root object
OMtempl_obj
The id of the Templates object

1.4 Object names
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
OMstr_to_name
Converts a string to an object name
OMname_to_str
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));
1.5 Type id
Definition

An object's base type has a unique id.

In a C function, the id's type is OMtype_id.

Creating objects

OMtype_id is needed only if you are creating objects explicitly in a C function, which is not a typical use of the Object Manager.

1.6 Header files
Basic C API header files

For a program that accesses the Object Manager C API, you typically include the following basic header files:

#include  <avs/om.h>

If you use the definition of any attributes or properties, you may also need to include the header file:

#include <avs/om_att.h>

If you manipulate any base types, you have to include the header file:

#include <avs/om_type.h>
Basic C++ API header files

For a program that accesses the Object Manager C++ API, you typically include the header files:

#include <avs/omx.hxx>
Event handling header files

If you use any of the routines in event handling section (these are routines prefixed with EV) you need to include the header file:

#include <avs/event.h>
Other header files

You may have to include other header files, depending on the AVS/Express kits your program accesses.

1.7 Return status
Status codes

Most routines return a status code:

Status code
Value
Meaning
OM_STAT_SUCCESS
1
The routine completed successfully.
OM_STAT_UNDEF
0
The routine attempted to get a value from an object that has no defined value.
OM_STAT_ERROR
-1
The routine failed for any other reason.

Error messages

Some routines, when they fail with a status of OM_STAT_ERROR, generate error messages containing diagnostic information. These messages are printed to stderr. To suppress errors printed during a routine, you can "squash" errors for a duration of your code. Typically you only want to squash errors for one routine at a time. You can do this using the macro ERRsquash_start before the routine and ERRsquash_end after the routine. For example:

ERRsquash_start(); // begin suppressing errors
stat = OMget_int_val(obj_id, &val);
ERRsquash_end(); // end suppressing errors
Routines returning OMobj_id

Several routines, like OMfind_subobj, return an object id. If the routine fails, the returned value is OMnull_obj. You can test for this value with the routine OMis_null_obj. The following example attempts to get the object id of subobject x:

OMobj_id parent_id, x_id;
...
x_id = OMfind_subobj(parent_id, OMstr_to_name("x"),
OM_OBJ_RW);
if (OMis_null_obj(x_id))
printf("Error searching for x\n");

1.8 ARRalloc
Synopsis
char *   ARRalloc (
NULL,
int  type,
int  number_of_elements,
NULL  );
Description

The ARR package is used by AVS/Express to maintain arrays in memory with reference counts. These arrays are typically allocated with the C malloc facility. The ARRalloc routine calls malloc and gives the resulting array a reference count of 1. The ARRfree routine decrements the reference count, and if 0, calls the free routine. There is another routine ARRincr_refcnt that adds 1 to the refcnt of an array. These arrays are identified directly by the pointer to the array.

You typically do not call ARRalloc. You only need it when you are setting an array with the OMset_array function, the mode is OM_SET_ARRAY_FREE, and you want to maintain your own reference to the array after the call. See Section 1.38, OMget_array  [page 1-74].

Arguments
type

An integer code specifying the array's data type. AVS/Express provides the following symbolic constants, defined in <avs/dtype.h>:

Type
Meaning
DTYPE_CHAR
Character
DTYPE_BYTE
Byte
DTYPE_SHORT
Short integer
DTYPE_INT
Integer
DTYPE_FLOAT
Single-precision floating point
DTYPE_DOUBLE
Double-precision floating point
DTYPE_PTR
Pointer
DTYPE_STRING
Character string

number_of_elements

The size of the array, in terms of number of elements.

Returned value

A pointer to the array, or NULL if ARRalloc failed.

Example
/* Allocate space for a 100-element floating-point array. */
#include <avs/dtype.h>
int alloc_size = 100;
float *my_array;
...
my_array = (float *) ARRalloc(NULL, DTYPE_FLOAT, alloc_size, NULL);
if (my_array == NULL)
printf("Error allocating the array.\n");
See also
Section 1.99, OMset_array  [page 1-187]
1.9 ARRfree
Synopsis
void  ARRfree (
char  *array_pointer  );)
Description

ARRfree decrements an array's internal reference counter.

A process calls this routine once it has finished with an array object that was retrieved with a call to OMret_array_ptr, OMret_typed_array_ptr or OMget_array in which the array_pointer argument was NULL.

Arguments
array_pointer

The address of the array to be freed.

Example

See the example under OMget_array.

See also
Section 1.38, OMget_array  [page 1-74]
Section 1.89, OMret_array_ptr  [page 1-171]
Section 1.90, OMret_typed_array_ptr  [page 1-174]
1.10 ARRincr_refcnt
Synopsis
void  ARRincr_refcnt(
char  *array_pointer  );)
Description

ARRincr_refcnt increments an array's internal reference counter. The array_ptr must have been returned from a call to ARRalloc.

You can call this routine when you want to retain your own reference to an array allocated with ARRalloc. You release this reference by calling ARRfree.

Arguments
array_pointer

The address of the array whose reference is to be incremented.

See also
Section 1.8, ARRalloc  [page 1-23]
Section 1.9, ARRfree  [page 1-25]
1.11 ERRsquash_start
Synopsis
void ERRsquash_start();
void ERRsquash_end();
Description

These C macros can be used to suppress errors generated from AVS/Express library routines. Place a call to ERRsquash_start before you call a routine that may generate an error and place a corresponding call to ERRsquash_end after the routine call. Any errors generated between these calls are not presented to the user.

Example
ERRsquash_start();
// errors generated here are not displayed
stat = OMget_int_val(obj_id, &value);
ERRsquash_end();
1.12 EVadd_select
Synopsis
void EVadd_select (
int  type,
int  fd,
void  (*function) (char *),
NULL,
char *  arg,
int  dir  );

void EVdel_select (
int  type,
int  fd,
void  (*function) (char *),
NULL,
char *  arg,
int  dir  );
Description

EVadd_select adds an event callback handler of type type.

For all types, function is a pointer to a user-supplied callback function that takes a single pointer argument. The arg parameter specifies the argument.

type can be any of the following:

Of the two types, EV_SELECT0 is the one you typically specify. EV_SELECT0 specifies that the handler should be invoked only when there are no outstanding push/pop contexts. You should use EV_SELECT0 when the callback uses the routines OMpush_ctx/OMpop_ctx. Otherwise, you can use EV_SELECT. EV_SELECT specifies that the handler can be called in the middle of a push/pop context, but in this case, it should not begin a new context.

Of the two types, EV_PRE0 is the one you typically specify. EV_PRE0 specifies that the handler should be invoked only when there are no outstanding push/pop contexts. You should use EV_PRE0 when the callback creates its own push/pop context. Otherwise, you can use EV_PRE. EV_PRE specifies that the handler can be called in the middle of a push/pop context.

EVdel_select deletes an event callback handler. The parameters to EVdel_select must match those of the EVadd_select that created the handler.

Arguments
type

An event type, as described above:

EV_SELECT0
EV_SELECT
EV_PRE0
EV_PRE
EV_POST
EV_POLL
EV_TIMEOUT
    

fd

A file descriptor. fd has meaning only when type is EV_SELECT0 or EV_SELECT. Otherwise, it should be 0.

function

A pointer to a user-supplied callback function. The function should take a single pointer argument.

NULL

The fourth argument should be NULL.

arg

The argument passed to function.

dir

When the type is EV_SELECT0 or EV_SELECT, a further refinement of the event type:

When the type is EV_TIMEOUT, dir specifies the number of milliseconds to wait before invoking the event handler.

For other types, dir has no meaning and should be 0.

1.13 EVflush_events
Synopsis
void EVflush_events();
Description

EVFlush_events flushes out pending window system expose events. It is particularly useful on UNIX systems since the Motif library uses window system expose events to refresh widgets after widget attributes have been changed. You may need to call this routine after you have performed an OMpop_ctx call that triggered a widget's update function. Even though the widget's update function was called, the display of the widget may not have been updated until all pending expose events are handled.

Example

In this example, the OMpush_ctx and OMpop_ctx routines bracket an operation which changes a slider's value. The slider itself is not updated until after the EVflush_events call.

OMpush_ctx(my_obj_id, 0, 0, 0);
OMset_name_real_val(slider_id, OMstr_to_name("value"), 3.0);
OMpop_ctx(my_obj_id);
EVflush_events();
See also
Section 1.86, OMpush_ctx and OMpop_ctx  [page 1-163]
1.14 EVXinit_display
Synopsis
void EVXinit_display (disp);
void EVXadd_event_hndlr (disp, wind, mask, hndlr, udata, 0, NULL, NULL);
void EVXdel_event_hndlr (disp, wind, mask, hndlr, udata);
void EVXdel_events (disp, wind);

Display *  disp;
Window  wind;
unsigned int  mask;
EVXhndlr  hndlr;
void *  udata;
Description

These routines define callback handlers for X events (UNIX platforms only).

EVXinit_display initializes an X display. The routine must be called once per X display if you are using the routine EVXadd_event_hndlr.

EVXadd_event_hndlr adds an X event callback handler. When a set of X events occurs on an X window, the system will call the function you supply. The parameters specify the X display; window; event mask; callback function; and data argument for the callback function. The sixth parameter must be 0. The seventh and eighth parameters must be NULL.

EVXdel_event_hndlr deletes an X event callback handler. The parameters to EVXdel_event_hndlr must match the corresponding parameters of the EVXadd_event_hndlr that created the handler.

EVXdel_events deletes all X event callback handlers for a particular X-display window. If you have not deleted the handlers individually using EVXdel_event_hndlr, you should call EVXdel_events either closely before or closely after destroying a window. If you destroy a window without deleting the event handler, pending events in the X queue for this window may be delivered after the window is deleted causing intermittent X BadWindow errors.

Arguments
disp

An X display.

wind

An X window.

mask

An X event mask.

hndlr

A callback function. The function must have the following prototype:

void hndlr (Display * disp, Window wind, XEvent event, void * udata);

disp is an X display. wind is an X window. event is an X event. udata is the data argument specified by the udata parameter in EVXadd_event_hndlr.

udata

The data argument passed to hndlr.

1.15 FILEfopen, FILEpath_fopen, and FILEfind
Synopsis
#include avs/f_utils.h
FILE *
FILEfopen(char *filename, char *type)

#include <avs/f_utils.h>
FILE *
FILEpath_fopen(char *filename, char *type, char *path, char sep)

#include <avs/f_utils.h>
char *
FILEfind(char *filename, char *path, char sep, int mode,
   unsigned long *mod_time, int *path_index)
Description

These routines provide file handling capabilities.

FILEfopen calls the standard fopen C library routine but will perform the following preprocessing on the filename argument:

The return value contains the value returned by the fopen C library routine.

FILEpath_fopen opens the first file named filename found in a given list of directories specified by the path argument.Variables and directory separators in both the path and filename arguments are mapped as described for FILEfopen above.

FILEfind returns the absolute pathname of the file specified by filename in the specified path. The mode argument specifies permissions that this file must contain. The mod_time and path_index arguments optionally return the file modification time and an integer index specifying which directory was used to find the filename returned respectively.The return value is allocated with the malloc facility. You must call free when you are finished with this filename.

Arguments
filename

A pointer to a character string that contains the name of a file.

type

A character string. The initial portion of type must consist of one of the following character sequences (b character suffixes indicate binary file operation)

r or rb - open for reading
w or wb - truncate or create for writing
a or ab - append: open for writing at end of file or create for writing
r+,r+b, or rb+ - open for update (reading and writing)
w+,w+b, or wb+ - truncate or create for update
a+,a+b, or ab+ - append; open for update at end-of-file or create for update
Note: The b character indicates that the file to operate upon is binary
path

A pointer to a character string that contains a path specification. Directories in path are separated by the separator character sep.

sep

A string containing the separator character (typically either ' ' or ':').

mode

Integer specifying permissions that a file returned by FILEfind must contain. It should contain an or'd list of the flags:

FILE_EXEC (execute permission)
FILE_DIR (must be a directory)
FILE_READ (must be readable)
FILE_WRITE (must be writable)
mod_time

Returns the modification time of the file found by FILEfind as returned by the stat system call. This argument can be specified as NULL if the return of this information is not desired.

path_index

Returns an integer index specifying which directory was used to find the filename returned by FILEfind. If the first directory is used, 0 is returned, if the second directotry is used, 1 is returned, and so on. If the filename argument itself was an absolute path, the path_index value of -1 is returned (that is, no directories in path were used to find the value in this case). This argument itself can be specified as NULL if you do not need this information.

1.16 OMadd_exit_func
Synopsis
void OMadd_exit_func(
void (*func) (void *),
void  *arg);
Description

OMadd_exit_func adds a callback function to be called when the process exits. The functions added with this mechanism are called in the reverse order in which they are added.

Arguments
func

A pointer to a void function that is called with a single void * argument.

arg

A void * argument that is passed to the func argument when the process exits.

1.17 OMadd_named_func
Synopsis
void  OMadd_named_func (
OMpfi  function,
OMobj_name  identifier  );
Description

OMadd_named_func adds a single entry to AVS/Express' internal table that maps functions to function identifiers.

If identifier already exists in the table, AVS/Express prints a warning message and replaces the existing entry.

This routine is used by code generated by AVS/Express to build this database. Users do not typically need to call this routine themselves.

Arguments
function

The name of a C function.

identifier

A function identifier.

Example
/* Add a single entry to the function-identifier table. */
OMadd_named_func((OMpfi)add_num, OMstr_to_name("add numbers"));
See also
Section 1.17, OMadd_named_func  [page 1-38]
Section 1.37, OMfunc_to_name  [page 1-73]
Section 1.74, OMname_to_func  [page 1-149]
1.18 OMadd_named_funcs
Synopsis
void  OMadd_named_funcs (
OMfunc_table  *table_name,
unsigned int  number_of_entries  );
Description

OMadd_named_funcs adds several entries to AVS/Express' internal table that maps functions to function identifiers.

This internal table is constructed by code that AVS/Express generates. User code does not typically have to use this routine directly.

Arguments
table_name

A set of function-to-identifier mappings.

The table should be defined as follows:

OMfunc_table  table_name[] = {
{ (OMpfi)function, "identifier"  },
{ (OMpfi)function, "identifier"  };
...
};

If an identifier already exists in AVS/Express' internal table, AVS/Express prints a warning message and replaces the existing entry.

number_of_entries

The number of entries in table_name.

Example
/* Add a table of entries to the function-identifier table. */
static OMfunc_table user_funcs[] = {
{ (OMpfi)add_num, "add numbers" },
{ (OMpfi)subtract_num, "subtract numbers" }
};
...
OMadd_named_funcs(user_funcs,
(sizeof(usr_funcs)/sizeof(OMfunc_table)));
See also
Section 1.17, OMadd_named_func  [page 1-38]
Section 1.37, OMfunc_to_name  [page 1-73]
Section 1.74, OMname_to_func  [page 1-149]
1.19 OMadd_notify_req and OMdel_notify_req
Synopsis
void  OMadd_notify_req (
OMobj_id  object_id,
OMobj_id  template_id,
OMobj_id  method_id,
OMobj_id  argument_id,
unsigned int  event_mask,
int  mode  );

void  OMdel_notify_req (
OMobj_id  object_id,
OMobj_id  template_id,
OMobj_id  method_id,
OMobj_id  argument_id,
unsigned int  event_mask,
int  mode  );
Description

These routines add or delete a notification request. These routines are used by method objects to implement their callback functionality. You do not typically need to call them yourself.

Arguments
object_id

The id of the object on which to place the notification request. That is, a notification request is to be generated when an event occurs in object_id.

template_id

The optional id of a template of subobjects on which to place the notification. See Example 2 below.

To indicate no object, specify OMnull_obj.

method_id

The id of the method object to be notified when the event occurs.

argument_id

An optional object id to be passed to the invoked function.

To indicate no id, specify OMnull_obj.

event_mask

The events that, when they occur in object_id, will cause a notification on the function.

The events are as follows:

Event name
Event
Properties
(see notes a and b)
OM_EVENT_VAL
Value changed
Propagated
Queued
OM_EVENT_ADD_SUBOBJ
Subobject added
Not propagated
Queued
OM_EVENT_DEL_SUBOBJ
Subobject deleted
Not propagated
Not queued
OM_EVENT_INST
Object instanced
Not propagated
Queued
OM_EVENT_ATT
Attribute changed
Not propagated
Queued
OM_EVENT_DEL
Object about to be deleted
Not propagated
Not queued
OM_EVENT_PROP
Property changed
Not propagated
Queued

Notes:

a. Propagated means that the notification request extends to objects referenced in the object_id's value parameter, and to objects referenced by those objects, and so forth.
b. Queued means that if the notification is generated, it is added to AVS/Express' internal queue of notifications to process. Not queued means that AVS/Express processes the notifications immediately.
mode

Options when adding notifications. mode is ignored in a call to OMdel_notify_req.

mode can be any of the following. You can OR together individual modes.

Mode
Meaning
0
No options apply.
OM_NOTIFY_NOSUBOBJS
The notification is generated only if an event occurs on object_id itself. By default, a notification is generated if the event occurs on either object_id or any of its subobjects.
OM_NOTIFY_IMM
If the notification is generated, it is processed immediately, even if its property is queued on the events specified.

Example 1
/* Notify myfunc_id when val1_id's property has changed.
   Pass myfunc_id as an argument. */
OMobj_id myfunc_id, val1_id,my_arg;
...
OMadd_notify_req(val1_id, OMnull_obj, myfunc_id, my_arg,
OM_EVENT_PROP, 0);
Example 2

Here is an example of using template_id.

The V code below defines group g3 as follows:

group g1 {
int a;
int b;
};
group g2 {
int c;
};
g1+g2 g3 {
int d;
};

If you put a notification request on g3, by default a notification will be generated if any of g3's subobjects change, including subobjects a, b, c, and d.

To limit the notification to g3 and the subobjects inherited from g1, you can do the following:

OMobj_id myfunc_id, g3_id, g1_id, my_arg;
...
OMadd_notify_req(g3_id, g1_id, myfunc_id, may_arg,
OM_EVENT_VAL, 0);
1.20 OMadd_obj_ref
Synopsis
int  OMadd_obj_ref (
OMobj_id  referencing_object,
OMobj_id  referenced_object,
int mode  );

int OMXobj::add_obj_ref(
OMobj_id  referenced_object,
int mode = 0 );
Description

OMadd_obj_ref makes a connection in referencing_object to referenced_object.

OMadd_obj_ref is useful for both single connections and arrays of connections. For an array of connections, call OMadd_obj_ref multiple times, specifying the same referencing object each time and a different referenced object.

An error occurs if the referencing object is a scalar that is already connected to an object.

To replace or remove an object reference, call OMset_obj_ref instead. You can also use OMset_obj_ref to connect an object to a single other object.

For making special types of connections, call OMlink_objs.

Arguments
referencing_object
referenced_object

Object ids.

mode

The mode argument can specify the value OM_OBJ_REF_QUERY to obtain a status code that indicates whether or not the connection will be valid without actually making the connection. For normal operation, specify 0 for the mode.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.101, OMset_obj_ref  [page 1-192]
Section 1.70, OMlink_objs  [page 1-143]
1.21 OMadd_subobj
Synopsis
int  OMadd_subobj (
OMobj_id  parent,
OMobj_id  object,  );
Description

OMadd_subobj makes object an immediate subobject of parent.

Positionally, object becomes the last subobject in parent. To control object's placement in parent, use OMinsert_subobj instead.

Section 1.68, OMinsert_subobj  [page 1-141]

After you move an object that may have connections to it (using OMdel_subobj and OMadd_subobj), you should update the references to this object using OMupd_name_refs.

Section 1.106, OMupd_name_refs  [page 1-200]
Arguments
parent

The id of the parent object. parent must be an object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro object.

object

The id of the object being parented. object must not currently have a parent.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

1.22 OMadd_to_refcnt
Synopsis
int  OMadd_to_refcnt (
OMobj_id  object,
1    );
Description

OMadd_to_refcnt increments object's reference count.

This routine is useful when you are storing the object in a way that is unknown to the Object Manager. It ensures that the object will not be deleted until you delete your reference. If you call OMadd_to_refcnt, you should decrement the refcnt when you are finished with object by calling OMdestroy_obj.

Arguments
object

The id of an object.

1

The second argument must be set to 1.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.31, OMdestroy_obj  [page 1-62]
1.23 OMbegin_op and OMend_op
Synopsis
void  OMbegin_op ();

void  OMend_op ();
Description

OMbegin_op and OMend_op suspend then subsequently resume execution of objects.

You use OMbegin_op and OMend_op in pairs:

OMbegin_op();
... /* Statements that update objects, such as
   by making connections or setting values. */
OMend_op();

Calls to OMbegin_op and OMend_op can be nested. OMend_op delivers the notifications queued since the most recent call to OMbegin_op. It also removes those notifications from the queue.

OMend_op acts as a synchronization point. When OMend_op returns, all notifications queued since the most recent call to OMbegin_op will have been delivered and the objects will have finished executing.

OMbegin_op is generally easier to use than its lower-level alternative, OMpush_ctx, but is not as flexible. OMbegin_op and OMend_op are equivalent to the following calls to OMpush_ctx and OMpop_ctx:

OMpush_ctx(OMroot_obj, OM_STATE_TRANSIENT, 0, 0);
...
OMpop_ctx(OMroot_obj);
See also
Section 1.86, OMpush_ctx and OMpop_ctx  [page 1-163]
1.24 OMchanged
Synopsis
int OMchanged(
OMobj_id  object_id,
int  seq_num);

int OMXobj::changed(
int  seq_num);
Description

OMchanged is normally called from a method's update function. It can be used to determine whether or not one of the parameters has changed since the last invocation of the method.

Arguments
object_id

The id of one of the parameters to the object.

seq_num

The sequence number of the method. This is passed as an argument to methods written with the omethod and cxxmethod method types.

Returned value

Returns a 1 if the parameter has changed. Returns a 0 value otherwise.

Example

Given this V code for a simple module

module my_module {
int my_param1;
omethod+notify+read update = "my_module_update";
};
this C code can determine whether my_param1 has changed since the module last ran:
int
my_module_update(OMobj_id obj_id, OMevent_mask mask,
int seq_num)
{
OMobj_id param_id;

param_id = OMfind_subobj(obj_id,
OMstr_to_name("my_param1"),
OM_OBJ_RD);
if (OMchanged(param_id, seq_num)) { /* param1 changed */
...
}
...
1.25 OMclose_obj
Synopsis
int  OMclose_obj (
OMobj_id  object);
Description

OMclose_obj sets the instanced flag for an object and its subobjects so that the object may now execute.

For a discussion of using OMclose_obj, see the mode argument in Section 1.26, OMcopy_obj  [page 1-52].
Arguments
object

The id of an object. The object must be an instance, for example, an object in Applications or SingleWindowApp.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.26, OMcopy_obj  [page 1-52]
1.26 OMcopy_obj
Synopsis
OMobj_id  OMcopy_obj (
OMobj_id  template,
OMobj_name  newobj_name,
OMobj_id  parent,
OMproc_id  proc,
int  mode  );
Description

OMcopy_obj is a low level routine that you can use to create a new object. It provides slightly more flexibility than the higher level routine OMcreate_obj_from_path in how the new object is named if there is already an existing object with that name. Normally, you should use OMcreate_obj_from_path.

OMcopy_obj creates an object whose type is template, a template object, and whose name is newobj_name. The object becomes an immediate subobject of parent. The object executes in the process specified by template or, if template has no process, the process indicated by proc. The close parameter indicates whether the object's instanced flag should be set.

To create an object whose type is a base type, such as group, macro, or int, call OMcreate_obj or OMcreate_obj_from_path instead.

Arguments
template

The id of a template object.

newobj_name

The name of the new object.

If you specify OM_NULL_NAME, the Object Manager gives the new object the same name as class.

It is your responsibility to assure that the new object's name is unique within parent. If an object of the same name already exists in parent, the Object Manager replaces the existing object with the new one.

The routine OMget_uniq_name is useful for determining a unique name for an object.

By contrast, the routine OMcreate_obj_from_path assures that the new object has a unique name.

parent

The id of the new object's parent. parent can be any object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro.

For parent you can specify OMnull_obj. The new object is created with no parent. You can subsequently assign it a parent with OMadd_subobj.

proc

The default process id for the new object. The process id takes effect only if the class object does not specify a process.

Typically you specify OMlocal_proc_id, a predefined variable set to the id of the calling process.

Alternatively, you can call OMobj_proc to get the process id of a particular object.

mode

A mode indicating whether to set the instanced flag for the object and its subobjects. mode applies only when creating an instance, for example, an object in Applications or SingleWindowApp. An instance executes only when its instanced flag is set.

Specify one of the following:

Section 1.24, OMchanged  [page 1-49].
Returned value

The id of the new object; or OMnull_obj on an error.

See also
Section 1.21, OMadd_subobj  [page 1-46]
Section 1.24, OMchanged  [page 1-49]
Section 1.27, OMcreate_obj  [page 1-55]
Section 1.28, OMcreate_obj_from_path  [page 1-58]
Section 1.66, OMget_uniq_name  [page 1-139]
Section 1.77, OMobj_proc  [page 1-153]
1.27 OMcreate_obj
Synopsis
OMobj_id  OMcreate_obj (
OMobj_name  newobj_name,
OMtype_id  type,
OMobj_id  parent,
OMnull_obj
OMproc_id  proc  );
Description

This is a low-level routine for creating a new object from a base type. Most users should use the routine OMcreate_obj_from_path to create new objects. Only use this routine if there is no template object defined of the type you wish to create.

OMcreate_obj creates an object whose type is type, a primitive type such as group, macro, or int. The new object's name is newobj_name. The object becomes an immediate subobject of parent. The object executes in the process indicated by proc.

The new object's instanced flag is not set, even if the object is an instance. You can set the instanced flag explicitly with a call to OMclose_obj.

To create an object whose type is a class, call OMcopy_obj or OMcreate_obj_from_path instead.

Arguments
newobj_name

The name of the new object.

If you specify OM_NULL_NAME, the Object Manager gives the new object the same name as class.

It is your responsibility to ensure that the new object's name is unique within parent. If an object of the same name already exists in parent, the Object Manager replaces the existing object with the new one.

The routine OMget_uniq_name is useful for determining a unique name for an object.

By contrast, the routine OMcreate_obj_from_path assures that the new object has a unique name.

type

The object's primitive type.

The include file om_type.h defines the type variables you can specify for type, including the following common ones:

Alternatively, you can use the routine OMstr_to_type to return the type id corresponding to the type's string name.

parent

The id of the new object's parent. parent can be any object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro.

For parent you can specify OMnull_obj. The new object is created with no parent. You can subsequently assign it a parent with OMadd_subobj.

OMnull_obj

The fourth argument must be OMnull_obj.

proc

The new object's process.

Typically you specify OMlocal_proc_id, a predefined variable set to the id of the calling process.

Alternatively, you can call OMobj_proc to get the process id of a particular object.

Returned value

The id of the new object; OMnull_obj on an error.

See also
Section 1.24, OMchanged  [page 1-49]
Section 1.26, OMcopy_obj  [page 1-52]
Section 1.28, OMcreate_obj_from_path  [page 1-58]
Section 1.66, OMget_uniq_name  [page 1-139]
Section 1.77, OMobj_proc  [page 1-153]
Section 1.105, OMstr_to_type  [page 1-199]
1.28 OMcreate_obj_from_path
Synopsis
OMobj_id  OMcreate_obj_from_path (
char * template_path,
char * newobj_name,
OMobj_id  parent  );
Description

OMcreate_obj_from_path creates an object from a template object. The template object can be any object in the Templates hierarchy. It is specified by a character string that represents the pathname to that object. The new object's name is newobj_name. The object becomes an immediate subobject of parent. The new object's default process id is the id of the calling process. If the new object is an instance, its instanced flag is set so that it will execute.

OMcreate_obj_from_path is generally easier to use than its lower-level alternatives, OMcopy_obj and OMcreate_obj.

Arguments
template_path

The path name of a template object, specified as a string. Do not specify an instanced object.

You specify a name just as you would in V code. Typically, this means that you can specify an unqualified name. For example:

OMcreate_obj_from_path("Viewer3D", ...);
OMcreate_obj_from_path("group", ...);

Depending on the object, you may need to specify a pathname if the library containing the object is not global. For example, the Data Visualization Kit's module objects require the prefix MODS:

OMcreate_obj_from_path("MODS.crop", ...);
newobj_name

The name of the new object, specified as a string. If you specify a null string, the Object Manager gives the new object the same name as type.

OMcreate_obj_from_path ensures that the resulting name is unique within the parent specified. If necessary, the routine makes the name unique by appending the string #n.

parent

The id of the new object's parent. parent can be any object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro.

For parent you can specify OMnull_obj. The new object is created with no parent. You can subsequently assign it a parent with OMadd_subobj.

Returned value

The id of the new object; or OMnull_obj on an error.

See also
Section 1.27, OMcreate_obj  [page 1-55]
Section 1.27, OMcreate_obj  [page 1-55]
1.29 OMdel_obj_ref
Synopsis
int  OMdel_obj_ref (
OMobj_id  referencing_object,
OMobj_id  referenced_object,
0  );

int  OMXobj::del_obj_ref (
OMobj_id  referenced_object);
Description

OMdel_obj_ref deletes a connection in referencing_object to referenced_object. This routine can be used, in particular, when deleting a single object reference from an object that has a list of references.

Arguments
referencing_object
referenced_object

Object ids.

0

The third argument must be 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

1.30 OMdel_subobj
Synopsis
int  OMdel_subobj (
OMobj_id  parent,
OMobj_id  object,
0  );
Description

OMdel_subobj deletes an object from its parent. The object still exists, but it has no parent object.

Arguments
parent

The id of object's current parent.

object

The subobject being deleted from parent.

0

The third argument must be 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

1.31 OMdestroy_obj
Synopsis
int  OMdestroy_obj (
OMobj_id  object,
int  mode  );

OMdestroy_objis a low level routine used for destroying objects. Normally, users use the routine OMuser_destroy_obj to destroy an object. This routine does not remove connections to this object and therefore only destroys the object when the last connection is deleted.

Description

OMdestroy_obj decrements an object's reference count. If the reference count is 0, it also deletes the object. Depending on the mode argument, it may also call OMdel_subobj to remove the object from the parent's subobject list.

The Object Manager maintains a reference count for each object, indicating the extent to which the object is in use. For example, you create an object, either in V or with a routine such as OMcreate_obj. The object's reference count is 1. If another object connects to the object, the object's reference count is incremented. If the connection to the object is removed, the object's reference count is decremented. An object's reference count can be incremented explicitly with a call to OMadd_to_refcnt. If the object's reference count is 0, which can happen only on a call to OMdestroy_obj, the object is deleted.

Arguments
object

The id of the object being deleted.

mode

A mode indicating whether the routine should call OMdel_subobj after decrementing the object's reference count. If called, OMdel_subobj removes the object from its parent so that the object now has a null parent id.

Specify one of the following:

Returned value

0 if the reference count is greater than 0 after being decremented; 1 if the reference count is 0 after being decremented; -1 if an error has occurred, regardless of the reference count.

See also
Section 1.22, OMadd_to_refcnt  [page 1-47]
Section 1.27, OMcreate_obj  [page 1-55]
Section 1.30, OMdel_subobj  [page 1-61]
Section 1.107, OMuser_destroy_obj  [page 1-201]
1.32 OMedit_obj
Synopsis
void OMedit_obj(
OMobj_id  object_id);

void OMedit_root_obj();

void OMedit_obj_ptr(
int elem_id,
int proc_id);
Description

These routines invoke the V command processor on the object specified. They are particularly useful when called from the debugger to help you debug your program. The variants of these routines help overcome the limitations that various debuggers have.

The routine OMedit_root_obj brings up the VCP on the Root object. Since it takes no arguments, it can be called from most debuggers.

The routine OMedit_obj_ptr is useful when your debugger prohibits you from passing structures as arguments to functions. The OMobj_id structure consists of two members: elem_id and proc_id. The elem_id member is passed as the first argument to the function, the proc_id is passed as the second. You call this routine from the debugger like:

(dbx) p OMedit_obj_ptr(obj_id.elem_id, obj_id.proc_id)

Once you are finished with the VCP, you can return to debugging your program by closing all open objects and entering the EOF character on your system (often Ctrl-d).

1.33 OMequal_objs
Synopsis
int  OMequal_objs (
OMobj_id  object1_id,
OMobj_id  object2_id  );
Description

OMequal_objs compares two object ids.

Arguments
object1_id
object2_id

Object ids.

Returned value

The returned value indicates whether the object ids are the same:

Returned value
Meaning
1
The object ids are the same.
0
The object ids are not the same.
OM_STAT_ERROR
OMequal_objs has failed. See Section 1.7, Return status  [page 1-22]

Example
/* Compare two object ids. */
OMobj_id object1_id, object2_id;
...
if (OMequal_objs(object1_id, object2_id) == 1)
printf("Object ids are equal.\n");
else
printf("Object ids are not equal or an error has occurred.\n");
1.34 OMexit
Synopsis
void  OMexit (
int  status  );
Description

OMexit exits the currently executing process using the exit system call. If you want to cause the main process to exit from an external process, see OMprocess_exit.

Arguments
status

An exit status for this process to pass to the exit system call.

See also
Section 1.85, OMprocess_exit  [page 1-162]
1.35 OMfind_str_subobj
Synopsis
OMobj_id  OMfind_str_subobj (
OMobj_id  ancestor,
char *  subobject_path,
int  mode  );
Description

OMfind_str_subobj returns the id of any subobject of ancestor. subobject_path is the object's V pathname relative to ancestor. The mode parameter indicates how the process intends to use the object.

Arguments
ancestor

The id of an ancestor (parent, grandparent, etc.) of the object you are seeking.

subobject_path

The relative V pathname of the object you are seeking, specified as a character string. This pathname string can contain the <- characters to go up in the hierarchy and can contain simple array dimension specification to go through array values.

mode

A mode indicating how the process intends to use the object:

Returned value

The id of the found object; or OMnull_obj on an error.

Example

Given the following group

group grp1 {
int var1;
group grp2 {
int var2;
};
};

the following are valid calls to OMfind_str_subobj. Assume grp1_id contains grp1's object id:

var1_id = OMfind_str_subobj (grp1_id, "var1", OM_OBJ_RW);
var2_id = OMfind_str_subobj (grp1_id, "grp2.var2",
OM_OBJ_RW);

You can use this call to access a subobject of an array of groups. Given the V code

group grp3 {
group arr[2] {
int a;
};
};

If you have the id of the object grp3 in variable grp3_id, you can get id of the subobject a in the 0'th element in the array using the call:

a_id = OMfind_str_subobj(grp3_id, "arr[0].a",
OM_OBJ_RW);

You can go up the hierarchy using the <- operator. Given the V code

group grp4 {
group sub_grp1 {
int a;
};
group sub_grp2 {
int b;
};
};

If you have the id of sub_grp1 in the variable sub_grp1_id, you can get the object id of the b subobject with

b_id = OMfind_str_subobj(sub_grp1_id, "<-.sub_grp2.b",
OM_OBJ_RW);
1.36 OMfind_subobj, OMlookup_subobj and OMfind_obj
Synopsis
OMobj_id  OMfind_subobj (
OMobj_id  parent_id,
OMobj_name  search_name,
int  mode  );

OMobj_id  OMlookup_subobj (
OMobj_id  parent_id,
OMobj_name  search_name,
int  mode  );

OMobj_id  OMfind_obj (
OMobj_id  object_id,
OMobj_name  search_name,
int  mode  );
Description

These routines search for an object, which you specify by name, and return the object's id.

The routines differ in the scope of their search.

This routine...
confines its search to...
OMfind_subobj
Immediate subobjects of parent_id.
This is the routine you typically call.
OMlookup_subobj
Any subobject of parent_id, including immediate subobjects and lower-level subobjects. If multiple instances of search_name exist, AVS/Express returns the id of the first one it finds.
OMfind_obj
The following objects, in order:
The object specified by object_id.
The immediate subobjects of object_id.
An ancestor of object_id.

These routines extend their search beyond the scope described above when they encounter a global library object as a subobject. In this case, they will search through the subobjects of the global library as well. This functionality can be disabled by OR'ing in the flag OM_FIND_NO_LIBRARIES into the mode argument.

Arguments
parent_id
object_id

An object id. The search is performed in the context of this object.

search_name

The unqualified name of the object to find.

mode

Indication of how the process intends to use the object.

Mode
Meaning
OM_OBJ_RD
The process intends to read the object, but not write to it (or any object that it might get using this id).
OM_OBJ_RW
The process intends to read and possibly write to the object.

Consider the following V code:

group g {
int a=1;
};
g g1;

When g1 is created, AVS/Express does not immediately create its subobjects. Rather, for each subobject, AVS/Express waits until the subobject is actually referenced, for example, a value is assigned to it.

If mode is OM_OBJ_RD and the subobject has not yet been created, AVS/Express returns instead the id of the template subobject, in this example, g.a. This works provided the program intends only to read the object.

If mode is OM_OBJ_RW, AVS/Express always returns the id of the subobject, in this example, g1.a. If the subobject does not yet exist, AVS/Express creates it.

Optionally, you can OR into the mode parameter additional flags to qualify the object search.


Flag
Meaning
OM_FIND_NO_LIBRARIES
Do not search recursively for subobjects in global libraries.
OM_FIND_NO_VIRTUAL
Do not search for virtual objects.
OM_SUB_TEMPL
If parent_id is a group pointer or reference, by default AVS/Express returns the id of parent_id's subobject.
OM_SUB_TEMPL specifies that AVS/Express should instead return the id of the subobject in parent_id's template object.

Returned value

The returned value is either the found object's id or, if OMfind_obj failed, OMnull_obj(see Section 1.7, Return status  [page 1-22]).

Example 1
/* Find subobject x. Its parent's id is grp1_id. */
OMobj_id grp1_id, x_id;
...
x_id = OMfind_subobj(grp1_id, OMstr_to_name("x"),
OM_OBJ_RD);
if OMis_null_obj(x_id)
printf("Error searching for x\n");
Example 2
/* Find object x in the context of the object whose id
  is grp1_id. */
OMobj_id grp1_id, x_id;
...
x_id = OMfind_obj(grp1_id, OMstr_to_name("x"), OM_OBJ_RD);
if (OMis_null_obj(x_id))
printf("Error searching for x\n");
1.37 OMfunc_to_name
Synopsis
OMobj_name  OMfunc_to_name (
OMpfi  function  );
Description

OMfunc_to_name queries AVS/Express' internal table that maps functions to function identifiers, and returns the identifier corresponding to a specified function.

Arguments
function

The name of a C function.

Example
/* Return the identifier corresponding to function add_num. */
OMobj_name function_identifier;
...
function_identifier = OMfunc_to_name((OMpfi)add_num);
See also
Section 1.17, OMadd_named_func  [page 1-38]
Section 1.18, OMadd_named_funcs  [page 1-39]
Section 1.74, OMname_to_func  [page 1-149]
1.38 OMget_array
Synopsis
int  OMget_array (
OMobj_id  object_id,
int  *type,
char  **array_ptr,
int  *ndims,
int  *dims,
int  mode  );

int OMXobj::get_array(
int  *type,
char  **array,
int  *ndim,
int  *dims,
int  mode  );
Description

Most users do not need the complete generality provided by the OMget_array routine. You should first try to use the simplified wrapper routines OMret_array_ptr and OMret_typed_array_ptr.

OMget_array gets the value of an array object but unlike the other "get" routines can also be used to set the value of the array. The mode parameter indicates how the program intends to use the array: for read-only, write-only, or read-write access.

The type, ndims, and dims parameters are read-write arguments that allow you to constrain the returned value for the array. The type parameter can either be used to constrain the data type so that only a specific type of data is returned or can be left unconstrained so that the most efficient data type is returned. For example, if you want to get an array of type float, set the initial value of the type parameter to OM_TYPE_FLOAT before making the call. If the array cannot satisfy the call, OMget_array will attempt to convert the array to the requested type, but will return an error rather than an array of the wrong type. If you want an unconstrained data type, use the value OM_TYPE_UNSET. If the type parameter is not set before calling OMget_array, the routine usually fails, depending on the type of the field.

The ndims and dims parameters can be used to either constrain the call to return only a specific array dimensionality or to leave the dimensions unconstrained. To constrain the number of dimensions of the returned array, set ndims to a non-zero value. To leave the dimensions unconstrained, you should initially specify the ndims argument as 0; the dimensions of the array are then returned in ndims when the call is complete.

The dims parameter depends on the value of the ndims parameter. If ndims is non-zero (that is, the array is constrained), dims must specify the value for each dimension. If ndims is 0 (that is, the array is unconstrained), dims will be returned; in this case, declare dims as int dims[OM_ARRAY_MAXDIM];.

Note: The OMget_array routine works on arrays of primitives only - not on arrays of groups or arrays of strings. For details of the calls appropriate for handling arrays of groups, please see Section 1.43, OMget_array_val, OMset_array_val, OMdel_array_val  [page 1-89]. For details of the calls appropriate for handling arrays of strings, please see Section 1.63, OMget_str_array_val and OMset_str_array_val  [page 1-129]

The OMget_array routine is designed to minimize copying the array. In some situations, you are given a pointer to the same piece of memory that AVS/Express is using to store the memory for the array.

Here is an outline of what happens on a call to OMget_array. For details, see the table following the argument descriptions.

1. Depending on mode, array_ptr, and whether the array is local to the calling process, AVS/Express does one of the following:
2. The program works on the array. Results are undefined if the program performs an action inconsistent with the mode in which the array was retrieved.
3. When the program has finished working on the array, if the array_pointer was NULL, the program must call ARRfree. Depending on mode, array_ptr, and whether the data is local to the calling process, AVS/Express does one or both of the following:
Arguments
object_id

The id of an array object.

type

As an output argument, indicates the array's type. AVS/Express provides the following symbolic constants, defined in <avs/om.h>:

Type
Meaning
OM_TYPE_CHAR
Character
OM_TYPE_BYTE
Byte
OM_TYPE_SHORT
Short integer
OM_TYPE_INT
Integer
OM_TYPE_FLOAT
Single-precision floating-point
OM_TYPE_DOUBLE
Double-precision floating-point
OM_TYPE_PTR
Pointer
OM_TYPE_UNSET
Not set (i.e., it was created with base type prim)

array_ptr

The array's address. array_ptr must be a variable. array_ptr is both an input and an output argument.

On input, if array_ptr is not NULL, AVS/Express returns the array into the specified address. This array must contain enough memory to hold the resulting array. If array_ptr is NULL, AVS/Express returns the array into an address of its choosing.

array_ptr must be NULL if the mode is OM_GET_ARRAY_WR or OM_GET_ARRAY_RW.

On output, array_ptr is set to the address of the array.

ndims

Determines whether the number of dimensions of the returned array should be constrained.If ndims is set to 0, the dimensions of the array are unconstrained and when the call is completed, ndims contains the number of dimensions in the returned array. If non-zero, the dims array should contain an array of ndims values specifying constraints for the dimensions of the array. This value must be set before the call to OMget_array is made.

dims

If the ndims argument is set to a non-zero value, this array should contain an array of ndims values specifying constraints for the dimensions of the array. If the ndims argument was specified as 0, this array is set by the OMget_array call to contain the dimensions of the returned array. The first element of the array is set to the size of the fastest varying dimension. This is the rightmost value in the V specification.

dims should be an integer array large enough for the maximum number of dimensions that can be returned. The constant OM_ARRAY_MAXDIM specifies the maximum number of dimensions allowed by AVS/Express.

mode

The mode, indicating how the program intends to use the array.

Mode
Meaning
OM_GET_ARRAY_RD
The program intends to read the array, but not write to it.
OM_GET_ARRAY_RD_COPY
The program requires a copy of the array for its own, private use (reading or writing).
OM_GET_ARRAY_RW
The program intends to both read and write to the array.
OM_GET_ARRAY_WR
The program intends to write to the array, completely replacing it, but not read it.

For details on the different modes, see the table below.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

If the calling process specifies NULL for array_pointer, it must call ARRfree after it has finished processing the array. This prompts AVS/Express to perform a set of actions. The actions differ depending on the circumstances. See the table below.

The following action table describes what happens with OMget_array under different conditions. ("Local" means that the array is local to the calling process).

If array_ptr is specified as...
and the array is...
then the following occurs depending on the mode...
RD
RD_COPY
RW
WR
NULL
Local
P/A
C/A
P/A/N
P/A/N
External
C/A
C/A
C/A/W/N
P/A/W/N
Not NULL
Local
C
C
not appl. array_ptr must be NULL.
not appl. array_ptr must be NULL.
External
C
C

Code
Meaning
P
On the call to OMget_array, AVS/Express returns a pointer to the Object Manager's copy of the array. The process then reads directly from and/or writes directly to the Object Manager's copy.
In the case of WR mode for an external array, AVS/Express allocates space for the array in the calling process and returns a pointer to that array.
C
On the call to OMget_array, AVS/Express makes a copy of the array and returns a pointer to the copy.
A
The program must call ARRfree when finished working on the array.
W
On the call to ARRfree, AVS/Express replaces the original copy of the array.
N
On the call to ARRfree, AVS/Express generates a notification that the array object has been changed.

Example
/* Get the contents of an array for reading and writing. */
OMobj_id array_id;
/* Constrain the data type. */
int array_type = OM_TYPE_FLOAT;// force type to float array
float *array = NULL;
/* Don't constrain dims */
int ndims = 0;
int dimension_size[OM_ARRAY_MAXDIM];
int index, number_of_elements;
int status;
...
status = OMget_array(array_id, (char *) &array_type, &array,
&ndims, dimension_size, OM_GET_ARRAY_RW);

if (status != 1) {
printf("error occurred\n");
return(0);
}

/* Determine the number of elements in the array. */
number_of_elements = 1;
for (index=0;index<ndims;index++)
number_of_elements *= dimension_size[index];

/* Multiply each element of the array by 2. */
for(index=0; index<number_of_elements; index++)
array[index] *= 2 * array[index];

/* After processing the array, call ARRfree to decrement the
   arrays internal reference counter and to trigger    updates.*/
ARRfree(array);
See also
Section 1.9, ARRfree  [page 1-25]
Section 1.43, OMget_array_val, OMset_array_val, OMdel_array_val  [page 1-89]
Section 1.63, OMget_str_array_val and OMset_str_array_val  [page 1-129]
Section 1.89, OMret_array_ptr  [page 1-171]
Section 1.90, OMret_typed_array_ptr  [page 1-174]
1.39 OMget_array_dims
Synopsis
int  OMget_array_dims (
OMobj_id  object_id,
int  *ndims,
int  *size_of_each_dimension  );
Description

OMget_array_dims returns the dimensions of the specified object.

Arguments
object_id

The id of an array object.

ndims

An output argument, set to the number of dimensions in the array.

size_of_each_dimension

An array output argument indicating the size in each dimension. The first element of the array is set to fastest varying dimension which is the size of the rightmost dimension, and so forth.

size_of_each_dimension should be an integer array large enough for the maximum number of dimensions that can be returned. The constant OM_ARRAY_MAXDIM specifies the maximum number of dimensions allowed by AVS/Express.

If you do not care about each dimensions's size, you can set size_of_each_dimension to NULL.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

Assume you have an integer array object defined as follows in the V code:

int ndims = 100, mdims = 200;
int my_array[ndims][mdims];

You can then query the array's dimensions and size in each dimension. In the code below, assume that parent_id contains the id of my_array's parent object:

OMobj_id parent_id, my_array;
int i, ndims;
int dim_sizes[OM_ARRAY_MAXDIM];
...
my_array = OMfind_subobj(parent_id,
OMstr_to_name("my_array"),
OM_OBJ_RD);
status = OMget_array_dims(my_array, &ndims, &dim_sizes);
if (status == 1) {
printf("Number of dimensions: %d\n", ndims);
printf("Dimensions:  ");
for (i=0; i<ndims; i++)
printf("[%d]", dim_sizes[i]);
printf("\n");
};
1.40 OMget_array_ref
Synopsis
int OMget_array_ref (
OMobj_id  object_id,
int  ref_index,
OMobj_id  *ref_id,
int  mode  );
Description

OMget_array_ref is used in conjunction with OMget_num_refs to access an objects list of connections as an array. The object specified can be any object that has connections but if the object is not an array object, the ref_index parameter must always be 0.

Arguments
object_id

The id of an object. The object can be any object that has connections currently.

ref_index

An array value. AVS/Express uses 0-based indexing; i.e., the index of the first connection in an array is 0.

ref_id

The id of the specified connection is returned.

mode

This argument is typically supplied with 0 but the constant OM_REF_SYMBOLIC can be used to obtain the id of a subobject of a by-reference group instead of the id of the subobject of the by-referenced group's value. This is the value that the Network Editor uses to display hierarchical connections properly.

Returned value

A status code. See Section 1.7, Return status  [page 1-22].

Example

With V code specified as

group a, b, c;
group &grp1[] => {a, b, c};

and with grp1's object_id in grp1_id, the C code can be used to access the object ids of a, b, and c.

OMobj_id grp1_id, ref_id;
int i, num_refs;

grp1_id = ...
if (OMget_num_refs(grp1_id, &num_refs) != 1) num_refs = 0;
for (i = 0; i < num_refs; i++) {
if (OMget_array_ref(grp1_id, i, &ref_id, 0) != 1)
continue;
printf("object is: %s\n",OMret_obj_name(ref_id));
};
See also
Section 1.50, OMget_num_refs  [page 1-103]
Section 1.57, OMget_obj_val, OMget_obj_pval, and OMset_obj_val  [page 1-116]
1.41 OMget_array_size and OMset_array_size
Synopsis
int  OMget_array_size (
OMobj_id  object_id,
int  *size  );

int  OMXobj::get_array_size (
int  *size  );

int  OMset_array_size (
OMobj_id  object_id,
int  size  );
Description

These routines get and set the size of the specified array object.

OMset_array_size is suitable only for one-dimensional arrays. To set the dimensions of multi-dimensional arrays, define the dimensions of your object in terms of integer AVS/Express objects and set the values of these objects directly.

Arguments
object_id

The id of an array object.

size

In OMget_array_size, an output argument containing the array size. For a multi-dimensional array, OMget_array_size returns the product of the sizes in each dimension.

In OMset_array_size, an input argument specifying the new array size.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

Assume you have integer array objects defined as follows in the V code:

int mdims = 100, ndims = 200;
int my_array1[mdims][ndims];
int my_array2[mdims];

my_array1 is a multidimensional array, so you cannot set its size with this routine. To get the values of each dimension independently, use: OMget_array_dims. To set the values of each dimension independently, you set the values of the mdims and ndims objects using OMset_int_val.

my_array2 is one-dimensional, so you can get and set its size with these routines. In the code below, assume that parent_id contains the id of the arrays' parent object:

OMobj_id parent_id, my_array1, my_array2;
int size;
int dim_sizes[OM_ARRAY_MAXDIM];
...
my_array1 = OMfind_subobj(parent_id,
OMstr_to_name("my_array1"),
OM_OBJ_RD);
my_array2 = OMfind_subobj(parent_id,
OMstr_to_name("my_array2"),
OM_OBJ_RW);
status = OMget_array_size(my_array1, &size);
printf("Array size: %d", size) /* Prints 20000. */
status = OMget_array_size(my_array2, &size);
printf("Array size: %d", size) /* Prints 100. */
status = OMset_array_size(my_array2, 300);
1.42 OMget_array_subobj
Synopsis
int  OMget_array_subobj (
OMobj_id  object_id,
int  subobject_index,
OMobj_id  *subobject_id,
int  mode  );
Description

OMget_array_subobj treats the immediate subobjects of object_id as an array of objects and returns the id of the specified subobject. You identify the subobject in terms of its index into the array. Use this routine in conjunction with the routine OMget_num_subobjs to traverse the list of subobjects of a hierarchical object.

Arguments
object_id

The id of an object with subobjects.

subobject_index

The index of a subobject. AVS/Express uses 0-based indexing; i.e., the index of the first subobject is 0.

subobject_id

An output argument, set to the id of the requested subobject.

mode

The access mode indicating how the calling process intends to use the subobject:

Mode
Meaning
OM_OBJ_RD
The program intends to read the subobject, but not write to it.
OM_OBJ_RW
The program intends to read and possibly write to the subobject.

Consider the following V code:

group g {
int a=1;
};
g g1;

When g1 is created, AVS/Express does not immediately create its subobjects. Rather, for each subobject, AVS/Express waits until the subobject is actually referenced, for example, when a value is assigned to it.

If mode is OM_OBJ_RD and the subobject has not yet been created, AVS/Express returns instead the id of the template subobject, in this example, g.a. This works provided the program intends only to read the object.

If mode is OM_OBJ_RW, AVS/Express always returns the id of the subobject, in this example, g1.a. If the subobject does not yet exist, AVS/Express creates it.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

Given the following V code

group grp1 {
int a;
int b;
int c;
};

the following C statements return the ids of the subobjects. Assume grp1_id is set to the id of object grp1:

OMobj_id grp1_id, subobjs[10];
int i;
int num;
int status;
...
status = OMget_num_subobjs (grp1_id, &num);
for (i=0; i < num; i++)
status = OMget_array_subobj(grp1_id, i, &subobjs[i],
OM_OBJ_RD);
See also
Section 1.49, OMget_num_subobjs  [page 1-102]
1.43 OMget_array_val, OMset_array_val, OMdel_array_val
Synopsis
int OMget_array_val (
OMobj_id  object_id,
int  value_index,
OMobj_id  *value_id,
int  mode  );

int OMset_array_val (
OMobj_id  object_id,
int  value_index,
OMobj_id  value_id  );

int  OMdel_array_val (
OMobj_id  object_id,
OMobj_id  value_id  );
Description

These routines get, set, or delete an object id in a one-dimensional array of groups, modules or macros.

The object is either an array of pointers/references to other objects or a by-value group array.

The object can be...
Description
An array of pointers/references to other objects
For example, the V code below defines object my_images as a one-dimensional array of references (&) to other objects:
image &my_images[] = {im1,im2,im3};
The routines operate on the object ids specified in the value parameter. For example, in a call to OMget_array_val, if value_index is 0, AVS/Express returns the id of the first object in the list, in this case, im1.
A by-value group array
For example, the V code below defines object coordinates as a one-dimensional group array with subobjects:
group coordinates[4] {
int x, y;
};
Internally, coordinates is actually four group objects, each with its own id. The routines operate on the object ids of each occurrence of the group. For example, in a call to OMget_array_val, if value_index is 0, AVS/Express returns the id of the first occurrence of coordinates.

In some cases, the OMget_array_val routine returns the OMobj_id of a link object and not the end value in and of itself. It is a good practice to use the routine OMget_obj_val, OMget_obj_pval, and OMset_obj_val on the return value from OMget_array_val and to check the status return of that routine. This problem occurs in the following V definition:

group &v1;
group &v_arr[] => {v1};

The OMget_array_val routine will return the id of v1 which does not have a valid value at this time. The call OMget_obj_val returns 0 in this case.

OMset_array_val only works when the array object's reference mode is by-reference or by-pointer, not by-value. It has two different behaviors depending upon whether the dimensions of the array are explicitly defined or not defined. If the V definition of the object looks like

group &arr[]; // array dimensions not defined

the OMset_array_val call inserts the new value into the array at the specified location, moving forward the contents of the array, and increasing the array's size by one. If you specify the value_index parameter with the constant OM_ARRAY_APPEND, a new value is added onto the end of the array.

If the V definition looks like

group a, b, c;
group &foo[3] => {a, b, c};

the OMset_array_val call replaces the object specified index with the object value specified with the value_id parameter.

OMdel_array_val deletes an object's reference to another object, but does not delete that other object. You can use OMdel_array_val when the object's mode is by-reference or by-pointer, but not when its mode is by-value.

Arguments
object_id

The id of an object. The object must be a one-dimensional array of pointers (* mode) or references (& mode) to other objects.

value_index

An array value. AVS/Express uses 0-based indexing; i.e., the index of the first value in an array is 0.

In OMset_array_val, index can be OM_ARRAY_APPEND, meaning that the object should be added to the end of the array.

value_id

In OMget_array_val, the id of the specified object.

In OMset_array_val, the id of the object to place into the array.

In OMdel_array_val, the id of the object to be deleted from the array.

mode

In a call to OMget_array_val, the access mode indicating how the process intends to use the subobject:

Mode
Meaning
OM_OBJ_RD
The process intends to read the subobject, but not write to it.
OM_OBJ_RW
The process intends to read and possibly write to the subobject.

Consider the following V code:

group coordinates[4]
int x=100, y=200;
};

When coordinates is created, AVS/Express does not immediately create all four occurrences of it. Rather, AVS/Express creates a template copy of the group, then, for each occurrence, waits until the occurrence is actually referenced, for example, when a value is assigned to one of its subobjects.

If mode is OM_OBJ_RD and the occurrence has not yet been created, AVS/Express returns instead the id of the template occurrence. This works provided the program intends only to read the object.

If mode is OM_OBJ_RW, AVS/Express always returns the id of the occurrence. If the occurrence does not yet exist, AVS/Express creates it.

Returned value

A status code. See Section 1.7, Return status  [page 1-22].

Example

A V file contains the following definitions:

image a, b, c, d, e;
image &my_images[] = {a,b,c};

The following code illustrates how you can modify the values in my_images:

OMobj_id a_id, b_id, c_id, d_id, e_id, my_images_id;
OMobj_id parent_object;
OMobj_id returned_id;
int status;
...
/* Get the object ids of the images. */
a_id = OMfind_subobj(parent_object, OMstr_to_name("a"),
OM_OBJ_RD);
... /* Same for the other objects. The mode for my_images_id is
   OM_OBJ_RW. */

/* Get the object id of the first value in my_images. */
status = OMget_array_val(my_images_id, 0, &returned_id,
OM_OBJ_RD);

/* Set the second value in my_images to object d. */
status = OMset_array_val(my_images_id, 1, d_id);

/* Add object e to the end of my_images. */
status = OMset_array_val(my_images_id, OM_ARRAY_APPEND, e_id);

/* Delete object c from my_images. */
status = OMdel_array_val(my_imdages_id, c_id);

1.44 OMget_cur_seq
Synopsis
int  OMget_cur_seq (
OMobj_id  object_id  );
Description

OMget_cur_seq returns the current sequence number. When an object's value is changed, its sequence number is updated with the current sequence number. This sequence number is used until the next call to OMpush_ctx or OMpop_ctx.

Arguments
object_id

The id of any object in the application.

Returned value

The sequence number or an error status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.56, OMget_obj_seq  [page 1-113]
1.45 OMget_data_type and OMset_data_type
Synopsis
int  OMget_data_type (
OMobj_id  object_id,  
int   *data_type  );

int  OMset_data_type (
OMobj_id  object_id,  
int   data_type  );
Description

OMget_data_type gets an object's data type.

OMset_data_type sets an objects' data type. This routine is used to convert an object defined as type prim into an object of type int, float, etc.

Arguments
object_id

The id of an object.

data_type

For OMget_data_type, an output argument containing the object's data type.

For OMset_data_type an input argument defining the objects' new type.

data_type specifies the integer code for the data type. AVS/Express provides the following symbolic constants, defined in <avs/om.h>:

Type
Meaning
OM_TYPE_CHAR
Character
OM_TYPE_BYTE
Byte
OM_TYPE_SHORT
Short integer
OM_TYPE_INT
Integer
OM_TYPE_FLOAT
Single-precision floating point
OM_TYPE_DOUBLE
Double-precision floating point
OM_TYPE_PTR
Pointer
OM_TYPE_STRING
Character string
OM_TYPE_UNSET
Not set, e.g., its type is prim.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Get object var1_id's data type and call the
appropriate routine to process the variable. */
OMobj_id  var1_id;
int status;
int var1_data_type;
...
status = OMget_data_type(var1_id, &var1_data_type);
if(var1_data_type == OM_TYPE_INT)
process_integer(var1_id);
1.46 OMget_func_val and OMset_func_val
Synopsis
int  OMget_func_val (
OMobj_id  object_id,
OMpfi  *function  );

int  OMset_func_val (
OMobj_id  object_id,
OMpfi  function  );
Description

These routines get and set a method object's function pointer; i.e., the function that is executed when the method is invoked.

Arguments
object_id

The id of a function object.

function

A function pointer.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Set the function called by my_func_id (the object id
  of a method). */
OMobj_id  my_func_id;
int status;
...
status = OMset_func_val(my_func_id, (OMpfi) add_vals);
1.47 OMget_iarray_val and OMget_rarray_val
Synopsis
int  OMget_iarray_val (OMobj_id object_id, int index,  int  *ivalue  );
int  OMget_rarray_val (OMobj_id object_id, int index,  double  *rvalue  );;
Description

These routines get a single element in an array object. These routines are suitable only for one-dimensional arrays. See the documentation for OMget_sub_barray and OMset_sub_barray for a more general routine that operates on multi-dimensional arrays.

The routines operate on different types of arrays.

This routine...
operates on...
OMget_iarray_val
An integer array
OMget_rarray_val
A floating-point array

Arguments
object_id

The id of an object. The object must be a one-dimensional array.

index

The index of the value to retrieve. AVS/Express uses 0-based indexing; i.e., the index of the first value in an array is 0.

ivalue
rvalue

An output argument containing the requested array value.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

The V file below defines a one-dimensional array:

int myarray[5] = {1,2,3,4,5};

The following code segment gets the second element:

OMobj_id myarray_id;
int value;
int status;
...
status = OMget_iarray_val(my_array_id, 1, &value);
1.48 OMget_int_val and OMset_int_val
Synopsis
int  OMget_int_val (
OMobj_id  object_id,
int  *value  );

int  OMset_int_val (
OMobj_id  object_id,
int  value  );

int  OMget_name_int_val (
OMobj_id  object_id,
OMobj_name  subobject_name,
int  *value  );

int  OMset_name_int_val (
OMobj_id  object_id,
OMobj_name  subobject_name,
int  value  );

int  OMXobj::get_int_val(
int *value  );

int OMXobj::set_int_val(
int value  );
Description

These routines get and set an integer object's value.

The routines access the target object in different ways.

The routines...
access...
OMget_int_val
OMset_int_val
An object identified by id
OMget_name_int_val
OMset_name_int_val
A named subobject of an object
OMXobj::get_int_val
OMXobj::set_int_val
A method on the OMXobj corresponding to the object

Arguments
object_id

The id of an object.

subobject_name

The name of one of object_id's immediate subobjects.

value

In OMget_int_val and OMget_name_int_val, an output argument containing the object's value.

In OMset_int_val and OMset_name_int_val, an input argument specifying the new value.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example 1
/* Get and set object var1_id's value. */
OMobj_id  var1_id;
int status;
int var1_value;
...
status = OMget_int_val(var1_id, &var1_value);
if (status == 1) {
var1_value *= 2;
status = OMset_int_val(var1_id, var1_value);
}
Example 2
/* Get the value of object x, an integer subobject of
  grp1_id. */
OMobj_id  grp1_id;
int status;
int x_value;
...
status = OMget_name_int_val(var1_id, OMstr_to_name("x"),
&x_value);
1.49 OMget_num_subobjs
Synopsis
int  OMget_num_subobjs (
OMobj_id  object_id,
int  *num,  );
Description

OMget_num_subobjs returns the number of subobjects in the specified object.

Arguments
object_id

The id of an object.

num

An output argument, set to the number of subobjects.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

Given the following V code

group grp1 {
int a;
int b;
int c;
};

the following C statements return the ids of the subobjects. Assume grp1_id is set to the id of object grp1:

OMobj_id grp1_id, subobjs[10];
int i;
int num;
int status;
...
status = OMget_num_subobjs (grp1_id, &num);
for (i=0; i < num; i++)
status = OMget_array_subobj(grp1_id, i, &subobjs[i],
OM_OBJ_RD);
See also
Section 1.42, OMget_array_subobj  [page 1-87]
1.50 OMget_num_refs
Synopsis
int  OMget_num_refs (
OMobj_id  object_id,
int  *num,
int mode  );
Description

OMget_num_refs returns the number of connections for the specified object.

Arguments
object_id

The id of an object.

num

An output argument, set to the number of connections.

mode

Should be set to 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.40, OMget_array_ref  [page 1-83]
1.51 OMget_obj_att and OMset_obj_att
Synopsis
int  OMget_obj_att (
OMobj_id  object_id,
OMobj_name  attribute,
int  *state  );

int  OMset_obj_att (
OMobj_id  object_id,
OMobj_name  attribute,
int  state  );
Description

These routines get and set an object's attribute.

Arguments
object_id

The id of an object.

attribute

The name of an attribute. You can specify any of the following variables, which are defined in <avs/om_att.h>:

Attribute
Meaning
OM_att_nosave
Do not save the object. Do not write it in a $print command.
OM_att_req
Make the object required. The object's associated function object will execute only if the object has a valid value.
OM_att_virtual
Make the object virtual.
OM_att_read
Method reads this parameter.
OM_att_noread
Method does not read this parameter.
OM_att_write
Method writes this parameter.
OM_att_nowrite
Method does not write this parameter.
OM_att_notify
Method notifies this parameter.
OM_att_nonotify
Method does not notify this parameter.

state

In OMget_obj_att, an output argument containing the attribute's state.

In OMset_obj_att, an input argument specifying the new state.

The state is one of the following:

State
Meaning
1
The attribute is set.
0
The attribute is not set.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Flip object grp1_id's notify state. */
#include <avs/OM_att.h>
OMobj_id grp1_id;
int state;
int status;
...
status = OMget_obj_att(grp1_id, OM_att_notify, &state);
state = !state;
status = OMset_obj_att(grp1_id, OM_att_notify, state);
1.52 OMget_obj_name and OMset_obj_name
Synopsis
int  OMget_obj_name (
OMobj_id  object_id,
OMobj_name  *object_name  );

int  OMset_obj_name (
OMobj_id  object_id,
OMobj_name  object_name  );
Description

These routines get and set an object's name.

After you have changed an object's name, if this object may have any connections to it or to any of its subobjects, you should update these references by calling the routine OMupd_name_refs.

Arguments
object_id

The id of an object.

object_name

In OMget_obj_name, an output argument containing the object's name.

In OMset_obj_name, an input argument specifying the new object name.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Get object var1_id's name. */
OMobj_id  var1_id;
int status;
OMobj_name var1_name;
...
status = OMget_obj_name(var1_id, &var1_name);
See also
Section 1.106, OMupd_name_refs  [page 1-200]
Section 1.91, OMret_obj_name  [page 1-176]
1.53 OMget_obj_parent
Synopsis
int  OMget_obj_parent (
OMobj_id  *object_id,
OMobj_id  *parent_id  );
Description

OMget_obj_parent gets the id of an object's parent.

Arguments
object_id

The id of an object.

parent_id

An output argument containing the parent's id.

parent_id is set to OMnull_obj(an object id predefined in <avs/om.h>) if the object has no parent.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Get object var1_id's parent. */
OMobj_id  var1_id;
int status;
OMobj_id var1_parent;
...
status = OMget_obj_parent(var1_id, &var1_parent);
if (OMequal_objs(var1_parent, OMnull_obj)
printf("Object has no parent\n");
1.54 OMget_obj_prop and OMset_obj_prop
Synopsis
OMobj_id  OMget_obj_prop (object_id,  property,  0  );

int  OMget_obj_iprop (object_id,  property,  int  *ival);
int  OMget_obj_rprop (object_id,  property,  double  *rval);
int  OMget_obj_sprop (object_id,  property,  char  **sval, maxlen);

int  OMset_obj_iprop (object_id,  property,  int  ival);
int  OMset_obj_rprop (object_id,  property,  double  rval);
int  OMset_obj_sprop (object_id,  property,  char  *sval);

OMobj_id  object_id;
OMobj_name  property;
Description

These routines get and set an object's property.

OMget_obj_prop gets the id of a property. You can then call OMget_data_type to determine the property's data type, then OMget_obj_val and OMset_obj_val to get and set the property's value.

Alternatively, you can call one of the other routines, which combine these operations for particular data types.

These routines...
get and set the value of...
OMget_obj_iprop
OMset_obj_iprop
An integer property
OMget_obj_rprop
OMset_obj_rprop
A floating-point property
OMget_obj_sprop
OMset_obj_sprop
A character-string property

Arguments
object_id

The id of an object.

property

The name of a property.

AVS/Express-supplied properties, such as NEx and struct_name, have predefined names. The Network Editor names are defined in <avs/ne_om.h>. The OM names are defined in <avs/om_att.h> and <avs/om_type.h>.

Here are some commonly referenced property names and their data types. AVS/Express performs numeric data-type conversion, so, for example, you could refer to NE_name_NEheight in a call to OMget_obj_iprop even though it is defined to have a real value.

Property name
Data type
OM_prop_val_state
int
NE_name_NEdisplayMode
string
NE_name_NEx
real
NE_name_NEy
real
NE_name_NEwidth
real
NE_name_NEheight
real

ival
rval

In one of the get routines, an output argument containing the property's value.

In one of the set routines, an input argument specifying the property's new value.

sval

This value is passed to either OMget_str_val or OMset_str_val.

If you are using OMget_obj_prob, sval is an output argument containing the string. AVS/Express either allocates space for the string or places the array in an address you specify:

If sval is...
then AVS/Express...
NULL
Allocates space for the string using malloc and returns the string's address in value. AVS/Express ignores the maxlen argument.
After processing the string, you must free the space with the C library routine free (not ARRfree).
An address
Writes the string to the address pointed to by sval. The maxlen argument indicates the maximum number of characters to write.

If you are using OMset_obj_prob, sval is an input argument specifying the address of the new value.

maxlen

This parameter applies to OMget_obj_prob only. It is integer that is passed to OMget_str_val, and it indicates the maximum number of bytes to get. This argument is ignored if sval is a NULL pointer.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Get object var1_id's coordinates. */
OMobj_id  var1_id;
int status;
int var1_x, var1_y;
...
status = OMget_obj_iprop(var1_id, NE_name_NEx, &var1_x);
status = OMget_obj_iprop(var1_id, NE_name_NEy, &var1_y);
See also
Section 1.45, OMget_data_type and OMset_data_type  [page 1-95]
Section 1.57, OMget_obj_val, OMget_obj_pval, and OMset_obj_val  [page 1-116]
1.55 OMget_obj_ref_mode and OMset_obj_ref_mode
Synopsis
int  OMget_obj_ref_mode (
OMobj_id  object_id,
int  *reference_mode  );

int  OMset_obj_ref_mode (
OMobj_id  object_id,
int  reference_mode  );
Description

These routines get and set an object's reference mode.

Arguments
object_id

The id of an object.

reference_mode

In OMget_obj_ref_mode, an output argument containing the object's reference mode.

In OMset_obj_ref_mode, an input argument specifying the new mode.

reference_mode specifies the integer code for the mode. AVS/Express provides the following symbolic constants, defined in <avs/om.h>:

Mode
Meaning
OM_OBJ_VAL
By value mode (^)
OM_OBJ_REF
By reference mode (&)
OM_OBJ_PTR
By pointer mode (*)

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Get object var1_id's reference mode. */
OMobj_id  var1_id;
int status;
int var1_ref_mode;
...
status = OMget_obj_ref_mode(var1_id, &var1_ref_mode);
1.56 OMget_obj_seq
Synopsis
int  OMget_obj_seq (
OMobj_id  object_id,
OMobj_id  template_id,
int  mode  );
Description

OMget_obj_seq returns the sequence number of an object.

Arguments
object_id

The id of an object.

template_id

The optional id of a template object.

template_id is useful when object_id refers to an object with subobjects and the mode is OM_SEQ_SUBOBJS. See mode, below.

Typically, you set template_id to OMnull_obj to indicate no template.

mode

Indicates how the sequence number is obtained:

Mode
Meaning
0
Returns the sequence number of object_id. This does not include the sequence number of any subobjects or any connections that this object might have.
OM_SEQ_SUBOBJS
Useful when object_id has subobjects, returns the largest sequence number of object_id and any of its subobjects, both immediate and lower level.
If template_id is specified, the subobjects to be checked are limited to those whose names match the subobjects of template_id. See Example 2 below.
OM_SEQ_PTRS
Useful when object_id is a pointer (by-pointer or by-reference mode), returns the largest sequence number of object_id and any of the objects in the chain of references.
OM_SEQ_VAL
Combination of OM_SEQ_SUBOBJS and OM_SEQ_PTRS. AVS/Express returns the largest sequence number of object_id and its subobjects. If object_id or any subobject is a pointer, AVS/Express determines that object's largest sequence number in the chain of references. This is the common mode value for most uses of OMget_obj_seq.

Returned value

The sequence number, or an error status code (see Section 1.7, Return status  [page 1-22]).

Example 1

The V code below defines a group object:

group grp1 {
int a;
int &b => grp0.b;
};

You can determine the highest sequence number among grp1, any of its subobjects, and any objects along subobject b's chain of references:

OMobj_id grp1_id;
int seq;

...
seq = OMget_obj_seq(grp1_id, OMnull_obj, OM_SEQ_VAL);
Example 2

This example illustrates the use of template_id.

The V code below defines two groups:

group g1 {
int a, b;
};

g1 g2 {
int c, d;
};

Group g2 has four subobjects: c, d, and the two objects it inherited from g1, a, and b.

The following code segment determines the largest sequence number among group g2and its subobjects, but only considers subobjects a and b:

OMobj_id g1_id, g2_id;
int seq;
...
seq = OMget_obj_seq(g2_id, g1_id, OM_SEQ_VAL);
1.57 OMget_obj_val, OMget_obj_pval, and OMset_obj_val
Synopsis
int  OMget_obj_val (OMobj_id  object_id,  OMobj_id  *value_id);
int  OMget_obj_pval (OMobj_id  object_id,  OMobj_id  *value_id, int mode);
int  OMget_obj_ref (OMobj_id  object_id,  OMobj_id  *value_id, int mode);

int  OMset_obj_val (OMobj_id  object_id,  OMobj_id  value_id, int mode);
Description

These routines get or set a pointer or reference object's value. You use these routines when an object's mode is by-reference or by-pointer, to determine the pointed-to object.

The OMget_obj_xxx routines differ in the id they return. The examples in the table below refer to the following sample V code:

group a;
group *p1 = a; // p1 points to object a.
group *p2 = p1; // p2 points to object p1.
Routine
returns the id of...
OMget_obj_val
The object at the end of the chain of references.
For example, OMget_obj_val on object p2 returns the id of object a.
OMget_obj_pval
The first object in the chain, including internal objects.
AVS/Express maintains internal objects that link objects in a chain of references. So an internal object exists between objects p2 and p1, and another internal object exists between p1 and a.
OMget_obj_pval on object p2 returns the id of the internal object between p2 and p1. OMget_obj_pval on that internal object returns the id of p1.
OMget_obj_ref
The first object in the chain, skipping over internal objects.
OMget_obj_ref on object p2 returns the id of object p1.

OMset_obj_val sets the value of object_id to the value defined by value_id. This is equivalent to the '=' operator in V. This is a one-time assignment, not a connection. If you have defined two objects in V:

-> int a = 3;
-> int b;

and you make the call

-> OMset_obj_val(b_id, a_id, 0);

the results are the same as declaring (in V):

-> b = a;

For group objects that are not references or pointers, the OMset_obj_val call will be performed on subobjects with corresponding names in the two groups.

You can also use OMset_obj_val to unset an object's value by setting the value_id argument to OMnull_obj. For example, if you have an object defined in V:

-> int a = 3;

and you make the call:

-> OMset_obj_val(a_id, OMnull_obj, 0);

the resulting object will be:

-> int a;

Arguments
object_id

The id of an object.

value_id

For OMget_obj_val, OMget_obj_pval, and OMget_obj_ref, the id of the returned value. For OMset_obj_val, the id of the value that you want object_id to take.

mode

Reserved for future use. Set to 0 in all cases.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example
/* Get the value pointed to by var1_id. AVS/Express
returns the id
  of the object at the end of the chain. */
OMobj_id  var1_id;
int status;
OMobj_id  var1_value_id;
...
status = OMget_obj_val(var1_id, &var1_value_id);
See also
Section 1.40, OMget_array_ref  [page 1-83]
Section 1.101, OMset_obj_ref  [page 1-192]
1.58 OMget_path
Synopsis
char *OMget_path(
int  which);

char *OMget_path_index(
int  which,
int  path_index,
char *buffer);

int OMget_num_paths(
int  which);
Description

These routines provide access to the path variables of the current AVS/Express session. The different paths defined by the system are:

Path name
Description
OM_PATH
The value of the XP_PATH variable,
OM_VPATH
The path to search for loading of V files. Usually this includes the v subdirectories of XP_PATH and the current directory.
OM_BINPATH
The path to search for executables. This includes both the bin directory and the machine specific directory.
OM_RUNTIMEPATH
The path of the runtime directories. Usually this includes the runtime subdirectories of XP_PATH.

Arguments
which

The path this operation works on as defined by one of the constants above (e.g., OM_PATH).

path_index

The path returned. This number should be a value between 0 and the value returned by OMget_num_paths.

buffer

This specifies a piece of memory that the routine OMget_path_index uses to store the returned path. This buffer should be defined to be large enough to contain the maximum length path name for the machine. The AVS_PATH_MAX constant can be used for this purpose.

Returned value

OMget_path returns a read-only character string that contains the list of directories in the specified path. The paths are separated by a space character. You should not free or modify the memory returned.

OMget_num_paths returns the number of directories in the specified path.

OMget_path_index copies the specified directory name into the buffer you specified and returns a pointer to that buffer.

1.59 OMget_port_list
Synopsis
int OMget_port_list(
OMobj_id  object_id,
int  *num_ports,
OMobj_id  **port_list,
int  mode)
Description

This routine returns the list of ports for object_id. A subobject is placed in the list of ports returned if it has the NEportLevels or exported property set to a value greater than or equal to the number of levels down in the hierarchy it is removed from object_id.

Arguments
object_id

The object whose ports are returned.

num_ports

The number of ports in object_id.

port_list

An array of the object ids of the ports in object_id. If the num_ports value is greater than 0, you should free this array when you are finished with it using the C library routine free.

mode

A value of 0 allows this object to be included in its own list of ports if it has the NEportLevels or exported property set to 1 or greater. A value OM_PORTS_NO_TOP_LEVEL prevents this object from being included in its own list of ports.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

1.60 OMget_ptr_val and OMset_ptr_val
Synopsis
int  OMget_ptr_val (
OMobj_id  object_id,
void  **value,
0  );

int  OMset_ptr_val (
OMobj_id  object_id,
void  *value
0 );

int  OMget_name_ptr_val (
OMobj_id  parent_id,
OMobj_name  object_name,
void  **value,
0  );

int  OMset_name_ptr_val (
OMobj_id  parent_id,
OMobj_name  object_name,
void  *value
0 );
Description

These routines get and set a pointer object's value. AVS/Express does not perform any manipulation on the pointer provided. It will not free the pointer when the object is destroyed. If your pointer was allocated with malloc, you will have to free it yourself when the object is destroyed with a method that is executed when the deinstanced event occurs.

The caller must be in the same process as the object for this routine to work. A -1 status is returned if the OMget_ptr_val or OMset_ptr_val routines are used with an object that is not in the same process.

Arguments
object_id

The id of an object.

value

In OMget_ptr_val, an output argument containing the object's value.

In OMset_int_val, an input argument specifying the new value.

0

The mode argument for the OMget_ptr_val and OMset_ptr_val routines is always passed as 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

Given the V code

ptr my_id;

this C code can be used to store the pointer to a structure in the object my_id:

OMobj_id  my_id;
int status;
my_id = ...
my_struct *ptr = (my_struct *)malloc(sizeof(my_struct));
...
status = OMset_ptr_val(my_id, (void *)ptr, 0);

This code can be used to retrieve the value later:

status = OMget_ptr_val(my_id, (void **) &ptr, 0);
1.61 OMget_real_val and OMset_real_val
Synopsis
int  OMget_real_val (
OMobj_id  object_id,
double  *value  );

int  OMset_real_val (
OMobj_id  object_id,
double  value  );

int  OMget_name_real_val (
OMobj_id  object_id,
OMobj_name  subobject_name,
double  *value  );

int  OMset_name_real_val (
OMobj_id  object_id,
OMobj_name  subobject_name,
double  value  );

int  OMXobj::get_real_val(
double *value  );

int OMXobj::set_real_val(
double value  );
Description

These routines get and set a floating-point object's value.

The routines access the target object in different ways.

The routines...
access...
OMget_real_val
OMset_real_val
An object identified by id
OMget_name_real_val
OMset_name_real_val
A named subobject of an object
OMXobj::get_real_val
OMXobj::set_real_val
The OMXobj whose method is being called

In a get routine, if the object's value parameter is a connection or expression, AVS/Express resolves it and returns the result.

Arguments
object_id

The id of an object.

subobject_name

The name of one of object_id's immediate subobjects.

value

In OMget_real_val and OMget_name_real_val, an output argument containing the object's value.

In OMset_real_val and OMset_name_real_val, an input argument specifying the new value.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example 1
/* Get and set object var1_id's value. */
OMobj_id  var1_id;
int status;
double var1_value;
...
status = OMget_real_val(var1_id, &var1_value);
if (status == 1) {
var1_value *= 2;
status = OMset_real_val(var1_id, var1_value);
}
Example 2
/* Get the value of object x, a floating-point subobject of
  grp1_id. */
OMobj_id  grp1_id;
int status;
double x_value;
...
status = OMget_name_real_val(var1_id, OMstr_to_name("x"),
&x_value);
1.62 OMget_ref_to_list
Synopsis
int OMget_ref_to_list(
OMobj_id  object_id,
int  *num_refs,
OMobj_id  **ref_id_list,
int  mode);
Description

This routine returns the list of objects that are connected to the object specified by object_id. This goes in the opposite direction from the OMget_num_refs and OMget_array_refs routines.

Arguments
object_id

The id of the object whose connections are returned.

num_refs

The number of connections to this object.

ref_id_list

A pointer to an array of object ids that are connected to this object. This list is allocated with the C malloc call and must be freed by you when you are done with the list.

mode

The mode in which this routine performs this operation:

Mode value
Behavior
0
Returns the ids of all objects that have names (i.e., are not intermediate link objects in the referencing chain to this object).
OM_REF_TO_VALUE
Returns the ids of intermediate name-link objects instead of returning just the objects that have names in the object hierarchy. You typically do not want to use this mode since these objects are usually safe to ignore.
OM_REF_TO_SOURCE
Skips to the end of a chain of connections. You often want to use this mode since it skips intermediate link objects.

Returned value

A status code. See Section 1.7, Return status  [page 1-22].

1.63 OMget_str_array_val and OMset_str_array_val
Synopsis
int OMget_str_array_val (
OMobj_id  object_id,
int  value_index,
char  **value,
int  maximum_size  );

int OMset_str_array_val (
OMobj_id  object_id,
int  value_index,
char  *value  );
Description

These routines get and set values in an object that is a one-dimensional array of strings. To get a string array's value, you may find it easier to use the routine OMret_str_array_val.

For example, the V code below defines an object called labels as a one-dimensional array of strings:

string labels[] = {"Open", "Close"};
Arguments
object_id

The id of an object. The object must be a one-dimensional array of strings.

value_index

An array value. AVS/Express uses 0-based indexing; i.e., the index of the first value in an array is 0.

In OMset_str_array_val, index can be OM_ARRAY_APPEND, meaning that the object should be added to the end of the array.

value

In OMget_str_array_val, an output argument containing the string. AVS/Express either allocates space for the string or places the array in an address you specify:

If value is...
then AVS/Express...
NULL
Allocates space for the string using malloc and returns the string's address in value. AVS/Express ignores the maximum_size argument.
After processing the string, you must free the space with the C library routine free (not ARRfree).
An address
Writes the string to the address pointed to by value. The maximum_size argument indicates the maximum number of characters to write.

In OMset_str_array_val, value is an input argument specifying the address of the new string.

maximum_size

In OMget_str_array_str_val, the maximum number of characters to get. This argument is ignored if value is a NULL pointer.

Returned value

A status code. See Section 1.7, Return status  [page 1-22].

Example 1

The following V code defines an array of strings:

string labels[] = {"Open", "Close"};

The code segment below gets the first object of the string. OMget_str_val allocates space for the array:

/* Get a string. OMget_str_array_val allocates space. */
OMobj_id  str1_id;
int status;
char *str1_val = NULL;
...
status = OMget_str_array_val(str1_id, 0, &str1_val, 0);
... /* Process the string. */
if (str1_val != NULL) free(str1_val);
Example 2

This example is like the first, but this time the program itself allocates space for the string:

/* Get a string. Return the string into the specified address. */
OMobj_id  str1_id;
char str1_buf[128];
char *str1_ptr = str1_buf;
...
status = OMget_str_array_val(str1_id, 0, &str1_ptr,
sizeof(str1_buf));

/* Process the string. */
See also
Section 1.96, OMret_str_array_val  [page 1-181]
1.64 OMget_str_val and OMset_str_val
Synopsis
int  OMget_str_val (
OMobj_id  object_id,
char  **value,
int  maximum_size  );
int  OMget_str_val_mode (
OMobj_id  object_id,
char  **value,
int  maximum_size,
int  mode );

int  OMset_str_val (
OMobj_id  object_id,
char  *value  );

int  OMget_name_str_val (
OMobj_id  parent_id,
OMobj_name subobject_name,
char  **value,
int  maximum_size  );

int  OMset_name_str_val (
OMobj_id  parent_id,
OMobj_name subobject_name,
char  *value  );
Description

These routines get and set a string object's value.

In OMset_str_val, the value that is changed depends on the target object's reference mode:

This call goes through connections if they exist. For example, given the following V code
string x = "Input";
string px1 => x;
string px2 => px1;

a call to OMset_str_val on object px2 changes x's value.

By default when you call OMget_str_val, it attempts to translate the string using any installed dictionaries. You prevent this translation from occuring by calling the routine OMget_str_val_mode with the mode argument set to the flag OM_STR_NO_I18N.

Arguments
object_id

The id of an object.

value

In OMget_str_val, an output argument containing the string. AVS/Express either allocates space for the string or places the array in an address you specify:

If value is...
then AVS/Express...
NULL
Allocates space for the string using malloc and returns the string's address in value. AVS/Express ignores the maximum_size argument.
After processing the string, you must free the space with the C library routine free (not ARRfree).
An address
Writes the string to the address pointed to by value. The maximum_size argument indicates the maximum number of characters to write.

In OMset_str_val, value is an input argument specifying the address of the new value.

maximum_size

In OMget_str_val, the maximum number of bytes to get. This argument is ignored if value is a NULL pointer.

mode

For OMget_str_val_mode only, specifies the translation mode. A 0 argument indicates that translation should take place, a value of OM_STR_NO_I18N indicates that no translation should take place.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example 1
/* Get a string. OMget_str_val allocates space. */
OMobj_id  str1_id;
int status;
char *str1_val = NULL;
...
status = OMget_str_val(str1_id, &str1_val, 0);
... /* Process the string. */
if (str1_val != NULL) free(str1_val);
Example 2
/* Get a string. Return the string into the specified address. */
OMobj_id  str1_id;
char str1_buf[128];
char *str1_ptr = str1_buf;
...
status = OMget_str_val(str1_id, &str1_ptr,
sizeof(str1_buf));

/* Process the string. No need to free the string. */
1.65 OMget_sub_barray and OMset_sub_barray
Synopsis
int  OMget_sub_barray (object_id,  ndim,  size,  min,  max,  bvalue);
int  OMget_sub_sarray (object_id,  ndim,  size,  min,  max,  svalue);
int  OMget_sub_iarray (object_id,  ndim,  size,  min,  max,  ivalue);
int  OMget_sub_farray (object_id,  ndim,  size,  min,  max,  fvalue);
int  OMget_sub_rarray (object_id,  ndim,  size,  min,  max,  rvalue);

int  OMset_sub_barray (object_id,  ndim,  size,  min,  max,  bvalue);
int  OMset_sub_sarray (object_id,  ndim,  size,  min,  max,  svalue);
int  OMset_sub_iarray (object_id,  ndim,  size,  min,  max,  ivalue);
int  OMset_sub_farray (object_id,  ndim,  size,  min,  max,  fvalue);
int  OMset_sub_rarray (object_id,  ndim,  size,  min,  max,  rvalue);

OMobj_id  object_id;
int  ndim,  *size,  *min,  *max;
unsigned char  *bvalue;
short  *svalue;
int  *ivalue;
float  *fvalue;
double  *rvalue;
Description

These routines get and set a subarray of an array object. With the ndim and size parameters, you specify the number of dimensions in the array and the size of each dimension. With the min and max parameters, you specify the range to retrieve or set in each dimension.

The routines get different types of arrays.

This routines...
operates on...
OMget_sub_barray
OMset_sub_barray
A byte array
OMget_sub_sarray
OMset_sub_sarray
A short integer array
OMget_sub_iarray
OMset_sub_iarray
An integer array
OMget_sub_farray
OMset_sub_farray
A single-precision floating-point array
OMget_sub_rarray
OMset_sub_rarray
A double-precision floating-point array

Arguments
object_id

The id of an array object.

ndim

The number of dimensions in the array object.

size

An array specifying the size of each dimension of the array object. The first value in this array is the fastest varying dimension in the array. This is the value that is the rightmost in the V specification for the dimensions.

min
max

Arrays specifying, respectively, the minimum and maximum indices to retrieve/set in each dimension of the array. The first value in each of these arrays is the rightmost index in the V specification. AVS/Express uses zero-based indexing; i.e., the index of the first value in a dimension is 0. Note that the value specified by the maximum dimension is not included in the values retrieved or set in the array. This is not the same as the ":" range operator in the V language which does include the maximum value. For example, to get the first value in a dimension, you would set the min to 0 and the max to 1.

barray
sarray
iarray
farray
rarray

An output argument for get routines, an input argument for set routines containing the specified subarray. The number of values returned or set is the product of the range (max - min) in each dimension.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

Example

In the V, array data is defined as follows:

group grp1 {
int h=400;
int w=300;
int ncomps=3;
byte data[h][w][ncomps] => read.data_out;
};

A program can access a subarray of data, as follows:

OMobj_id  grp1_id, data_id;
int h, w, ncomps;
unsigned char*subarray;
int ndim=3, size[3], min[3], max[3];
int status;
...
stat = OMget_name_int_val(grp1_id, OMstr_to_name("h"), &h);
stat += OMget_name_int_val(grp1_id, OMstr_to_name("w"), &w);
stat += OMget_name_int_val(grp1_id, OMstr_to_name("ncomps"),
&ncomps);
if (stat != 3) return(0);
size[0] = ncomps;
size[1] = w;
size[2] = h;
subarray = (unsigned char *) malloc (150 * 150 * ncomps);
min[0] = 0; /* Range for the ncomps dimension: 0-3. */
max[0] = ncomps;
min[1] = 0; /* Range for the w dimension: 0-150. */
max[1] = 150;
min[2] = 0; /* Range for the h dimension: 0-150. */
max[2] = 150;
data_id = OMfind_subobj(grp1_id, OMstr_to_name("data"),
OM_OBJ_RD);
status = OMget_sub_barray(data_id, 3, size, min, max,
subarray);
if (status == 0) {
return(0); /* value is not set */
}

1.66 OMget_uniq_name
Synopsis
OMobj_name  OMget_uniq_name (
OMobj_id  parent,
OMobj_name suggested_name,
NULL  );
Description

OMget_uniq_name returns an object name that is unique among parent's immediate subobjects. You supply a suggested name. The returned name is either the suggested name or, if the name already exists in parent, the suggested name with #n appended.

Arguments
parent

The id of an object.

suggested_name

The suggested object name.

NULL

The third argument must be NULL.

Returned value

The unique object name.

1.67 OMinsert_obj_ref
Synopsis
int  OMinsert_obj_ref (
OMobj_id  referencing_object,
int  index,
OMobj_id  referenced_object,
int mode  );

int OMXobj::insert_obj_ref(
int  index,
OMobj_id  referenced_object,
int mode = 0 );
Description

OMinsert_obj_ref inserts a connection referencing_object's list of connections to referenced_object at the location specified by index. This routine is similar to OMadd_obj_ref but provides control over the order of execution.

OMinsert_obj_ref is useful when operating on an object that has an array of connections where the order of the connection list is important.

For making special types of connections, call OMinsert_link_objs.

Arguments
referencing_object
referenced_object

Object ids.

index

The index into the array of connections.

mode

The mode argument can specify the value OM_OBJ_REF_QUERY to obtain a status code that indicates whether or not the connection will be valid without actually making the connection. For normal operation, specify 0 for the mode.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See Also
Section 1.20, OMadd_obj_ref  [page 1-45]
Section 1.70, OMlink_objs  [page 1-143]
1.68 OMinsert_subobj
Synopsis
int  OMinsert_subobj (
OMobj_id  parent,
int  index
OMobj_id  object,
0    );
Description

OMadd_subobj makes object an immediate subobject of parent.

Positionally, object becomes object number index in parent, where an index value of zero refers to the first object. If you don't care about object's placement in parent, use OMadd_subobj instead.

Arguments
parent

The id of the new parent object. parent must be an object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro object.

index

The location of the new object in parent. 0 means the first subobject; 1 means the second subobject, and so forth.

You can specify OM_ARRAY_APPEND to add the object to the end of the subobject list.

object

The id of the object being given a parent. object must not currently have a parent.

0

The fourth parameter must be 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.21, OMadd_subobj  [page 1-46]
1.69 OMis_null_obj
Synopsis
int  OMis_null_obj(
OMobj_id  object_id  );
Description

OMis_null_obj is a C macro which tests whether an object id is NULL.

Arguments
object_id

The id of an object.

Returned value

The returned value indicates whether the object id is NULL:

Returned value
Meaning
1
The object id is NULL.
0
The object id is not NULL.
OM_STAT_ERROR
OM_null_obj has failed. See Section 1.7, Return status  [page 1-22]

Example
/* Test whether val1_id is null. */
OMobj_id val1_id;
...
if (OMis_null_obj(val1_id))
printf("Object id is NULL\n");
1.70 OMlink_objs
Synopsis
int OMlink_objs(
OMobj_id  input_object,
OMobj_id  output_object);

int OMinsert_link_objs(
OMobj_id  input_object,
int index,
OMobj_id  output_object)
Description

These routines are alternatives to the routines OMadd_obj_ref and OMinsert_obj_ref for making a connection between two objects. OMlink_objs is the routine used by the Network Editor to make connections. It makes the connection symbolically by creating a name-link object to maintain the connection. The intermediate name-link object has slightly more overhead but is useful in two situations.

If you are making the connection to a subobject of a group with reference mode by-reference (i.e., &), the name-link object makes the destination of the connection the subobject of the reference's value and automatically relinks the connection as the group reference's value changes. For example, if you have the V code

group &ref {
int a;
} => val;
group val {
int a;
};

and you use the OMlink_objs function with the output_object set to ref.a, the connection's value becomes val.a. As the ref object's value changes, so does the value of the connection.

If you are making a connection to a subobject of an array of group objects, the name-link object allows that connection to form an array of connections to the appropriate subobjects of the array of groups. For example, if you have the V code

group arr[3] {
int a;
};
int input[3];

and you use the OMlink_objs function with input_object set to input and output_object set to arr, this forms an array of connections so that effectively input[0] is set to arr[0].a, input[1] is set to arr[1].a, and so on.

OMinsert_link_objs is the same as OMlink_objs but allows you to insert connections rather than just appending them onto the end of the list. This is useful when the order of the connections is important.

Arguments
input_object

The source end of the connection.

output_object

The destination end of the connection.

index

The index of the new value in the list of connections. The existing connections are moved ahead in the list.

Returned value

The status code (see Section 1.7, Return status  [page 1-22])

See also
Section 1.20, OMadd_obj_ref  [page 1-45]
Section 1.67, OMinsert_obj_ref  [page 1-140]
1.71 OMmain_init
Synopsis
For UNIX systems:
int OMmain_init (
int  argc,
char *  argv  );

For PC systems:
int OMmain_init(
HINSTANCE hInst,
HINSTANCE hPrevInst,
LPSTR CmdStr,
int CmdShow  );
Description

OMmain_init initializes the Object Manager. As part of the initialization, object libraries are loaded according to the templ.v file.

You call OMmain_init whenever you write your own C or C++ main function.

The arguments argc and argv specify command-line arguments. OMmain_init scans for and processes AVS/Express-specific arguments, such as -vcp. This routine notifies you about arguments that it does not understand. You should remove any arguments from argc and argv (or CmdStr for PC's) that are not recognized by AVS/Express before calling this routine.

PREinit and BASEinit

As part of using OMmain_init, you must create two functions, PREinit and BASEinit. OMmain_init calls PREinit before loading libraries and BASEinit after loading libraries.

You typically either create routines that are empty, or use functions generated for you in processname.c for a particular process.

The routines have the following prototypes:

void PREinit (int * argc,  char * argv);
void BASEinit (int * argc,  char * argv);

Notice that with PREinit and BASEinit the argc parameter is a pointer to an integer.

Arguments
argc

The number of arguments in argv.

argv

The argument vector.

Returned value

A VCP mode that can be submitted to a subsequent call to OMmain_loop. For example, if argv contains the -vcp argument, then OMmain_init returns OM_VCP_PRESENT.

1.72 OMis_main_process
Synopsis
int  OMis_main_process ();
Description

OMis_main_process determines whether the calling process is the scheduler.

Returned value

1 if the process is the scheduler; 0 if not.

1.73 OMmain_loop
Synopsis
void OMmain_loop (
int  vcp_mode  );
Description

OMmain_loop starts the main loop for dispatching events, such as user interactions with your application.

You typically call OMmain_loop when executing in server mode. First you initialize the application, including calling OMmain_init to initialize the Object Manager. Then you call OMmain_loop. OMmain_loop never returns.

The routine also optionally starts up the V Command Processor.

Arguments
vcp_mode

A mode indicating whether to start the V Command Processor:

1.74 OMname_to_func
Synopsis
OMpfi OMname_to_func (
OMobj_name  vcode_name  );
Description

OMname_to_func queries AVS/Express' internal table that maps functions to function names, and returns the function corresponding to a specified name.

Arguments
vcode_name

The function's name as it appears in a method object's value expression.

Example
/* Return the function corresponding to id "add numbers". */
OMpfi function;
...
function = OMname_to_func("add numbers");
See also
Section 1.18, OMadd_named_funcs  [page 1-39]
Section 1.37, OMfunc_to_name  [page 1-73]
Section 1.74, OMname_to_func  [page 1-149]
1.75 OMname_to_str and OMstr_to_name
Synopsis
char  *OMname_to_str (
OMobj_name  object_name  );

OMobj_name  OMstr_to_name (
char  *object_string  );
Description

OMname_to_str returns the character string corresponding to an object name. Do not modify and do not free the string returned by this routine.

OMstr_to_name returns the object name corresponding to a character string.

The Object Manager does not store and manipulate an object's name directly, but rather allocates a unique integer value that maps directly to a particular character string. OMobj_name holds that integer value.

The routines described here convert between the two representations of the string.

Arguments
object_name

An object's name, as a OMobj_name.

object_string

An object's name, as a character string.

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));
1.76 OMobj_is_type_of
Synopsis
int  OMobj_is_type_of(
OMobj_id  object,
OMtype_id  type   );
Description

OMobj_is_type_of determines whether object's primitive type is type.

Arguments
object

The id of an object.

type

The id of a type.

The include file <avs/om_type.h> defines the type variables you can specify for type, including the following common ones:

Alternatively, you can use the routine OMstr_to_type to return the type id corresponding to the type's string name.

Returned value

1 if the object's primitive type is type; 0 if not; or -1 on an error.

See also
Section 1.105, OMstr_to_type  [page 1-199]
1.77 OMobj_proc
Synopsis
OMproc_id  OMobj_proc (
OMobj_id  object  );
Description

OMobj_proc is a macro which returns the process id of an object.

Arguments
object

The id of an object.

Returned value

The process id.

1.78 OMopen_file
Synopsis
int  OMopen_file(
OMobj_id  object_id,
char  *user_file,
 0)
Description

OMopen_file loads either an ascii or binary V file specified from user_file into object_id

Arguments
object_id

Specifies the object that is used as the parent of objects defined in user_file.

user_file

Specifies the name of an ascii or binary V file. If user_file does not have a suffix, this routine first tries to append a .v suffix onto the filename and open an ascii V file of this name. If that file does not exist, it appends a .vo suffix and tries to open a binary V file with that name.

If either the file was originally specified with a suffix or if neither .v or .vo files exist, this routine identifies the file as either binary V or ascii V by looking at the contents and loads the file.

The file specified can be an absolute pathname or relative to v subdirectory of any project in your XP_PATH or relative to the current directory in which your process was started.

0

The third argument specifies the mode in which to load the file. The only supported value is 0.

Return value

The status code (see Section C.7, "Return status" [page C-26])

See also
Section 1.88, OMread_desc  [page 1-170]
1.79 OMparse_buffer
Synopsis
int  OMparse_buffer (
OMobj_id  object,
char *buffer,
0   );
Description

OMparse_buffer reads and parses an input string consisting of V statements, V commands, and V comments. OMparse_buffer returns when it encounters a NULL termination character in the buffer.

The Object Manager interprets the statements and commands in the context of the object identified by object. Any new objects defined in the buffer are created as subobjects of the object argument.

Error messages are sent to stderr.

Arguments
object

The id of an object.

buffer

A pointer to a NULL-terminated string consisting of V commands.

0

The third parameter must be 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]). a 0 return status indicates that syntax errors were encountered parsing the buffer.

Example

Given the id of a group object defined in V as

group myobj;

you can add a subobject to this object with

status = OMparse_buffer(myobj_id, "int subobj[3][2];", 0);

The resulting definition of myobj is

group myobj {
int subobj[3][2];
};
1.80 OMparse_obj_val
Synopsis
int  OMparse_obj_val (
OMobj_id  object,
char *buffer);

int  OMparse_obj_ref (
OMobj_id  object,
char *buffer);
Description

OMparse_obj_val reads and parses an input string consisting of a valid definition for the value of a V object. The buffer argument contains any characters that can be placed after the "=" operator in a V statement and before the ";" statement terminator. Calling this routine has the same effect as entering this string in the VCP.

OMparse_obj_ref is the same as OMparse_obj_val except that it uses the "=>" operator instead of "=".

Error messages are sent to stderr.

Arguments
object

The id of an object.

buffer

A pointer to a NULL-terminated string consisting of V commands.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]). A 0 return value indicates that syntax errors were encountered in the statement definition.

1.81 OMparse_stream
Synopsis
int  OMparse_stream (
OMobj_id  object,
FILE *  fp,
0   );
Description

OMparse_stream reads and parses an input stream consisting of V statements, V commands, and V comments. OMparse_stream returns on an EOF condition.

The Object Manager interprets the statements and commands in the context of the object identified by object.

Error messages are sent to stderr.

Arguments
object

The id of an object.

fp

A file pointer.

0

The third argument must be 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]). A 0 return status indicates that syntax errors were encountered in the stream.

1.82 OMprint_obj
Synopsis
void  OMprint_obj (
OMobj_id  object_id  );

void  OMprint_obj_ptr(
int elem_id,
int proc_id );
)
Description

OMprint_obj prints the definition of the specified object to standard out.

Since you frequently want to call this routine from the debugger, you can use the alternate routine OMprint_obj_ptr when your debugger does not allow you to call functions that take structures as arguments. This routine takes the two members in the OMobj_id structure as separate arguments.

Arguments
object_id

The id of an object.

elem_id

The elem_id field of the object_id. This routine is designed to be used when debuggers are unable to call functions with structures as arguments.

proc_id

The proc_id field of the object_id.

1.83 OMprint_notifies
Synopsis
void  OMprint_notifies (
OMobj_id  object_id  );
Description

OMprint_notifies prints the notifications on an object to standard out.

Arguments
object_id

The id of an object.

1.84 OMprint_path
Synopsis
void  OMprint_path (
OMobj_id  object_id  );

void OMprint_path_ptr(
int  elem_id,
int  proc_id);
Description

OMprint_path prints the full pathname of an object to standard out.

You can use the alternate for OMprint_path_ptr when calling this routine from a debugger that does not allow passing structures as arguments. It takes as its arguments the two members of the OMobj_id structure: elem_id, and proc_id.

Arguments
object_id

The id of an object.

elem_id

The elem_id field of the object_id. This routine is designed to be used when debuggers are unable to call functions with structures as arguments.

proc_id

The proc_id field of the object_id.

1.85 OMprocess_exit
Synopsis
void  OMprocess_exit (
OMproc_id  process_id, int exit_status );
Description

This routine causes the process specified to exit when it has finished the operation that it is currently executing. If it is called with the constant OMlocal_proc_id, it causes the current process to exit but waits until the main event loop is reached. In other words, this routine returns if it is asked to exit the local process but will cause this process to exit when the event handler that triggered this operation returns.

Arguments
process_id

The process id of the process that should be asked to exit. The main process always has a process_id of 0. You can get the process id of any object using the OMobj_proc macro. The process id of the current process is stored in the global variable OMlocal_proc_id.

exit_status

Specifies the exit status code for the process to exit.

See also
Section 1.77, OMobj_proc  [page 1-153]
1.86 OMpush_ctx and OMpop_ctx
Synopsis
unsigned int  OMpush_ctx (
OMobj_id  context_id,
int  state_mode,
int  notify_mode,
int  child_notify_mode  );

int  OMpop_ctx (
OMobj_id  context_id  );

unsigned int OMXobj::push_ctx(
int  state_mode = 0,
int  notify_mode = 0,
int  child_notify_mode = 0);

int OMXobj::pop_ctx(void);
Description

These routines suspend and resume AVS/Express' execution in the context of a specified object.

OMpush_ctx suspends execution, meaning that, in general:

OMpush_ctx also sets the state_mode with the state_mode argument. The state mode determines how object's values are saved during the save operation. If you only want to set the state mode without affecting how events are queued, use the routine OMset_state_mode.

OMpop_ctx can be made to execute the notifications queued by the most recent OMpush_ctx command. It also restores the state mode to its previous value.

You can modify the treatment of notifications with the event_mode and child_notify_mode arguments.

Calls to OMpush_ctx and OMpop_ctx can be nested. A nested push/pop context is known as the child context of the enclosing push/pop context. The enclosing context is known as the parent context.

Calls to OMpush_ctx and OMpop_ctx bracket the invocation of any method's callback routine. Since calls to OMpush_ctx can be nested, you can still call these routines to control events generated from within the module's compute function.

Even if the OMpop_ctx executes the update functions of all outstanding methods, in some cases a widget's display will not have been updated after the OMpop_ctx call. This is because the widget sends itself a window system expose event which is not delivered with OMpop_ctx. To guarantee that all widgets are also updated, you should call the routine EVflush_events after calling OMpop_ctx.

Arguments
context_id

The id of an object.

In OMpop_ctx, context_id must be the same id as the one specified in the most recent call to OMpush_ctx.

The context_id is used as a filter to prevent a method from sending notification events to itself. Any events that are delivered to the object specified by context_id are not delivered unless the notify_mode argument is specified as OM_CTX_ALL_NOTIFIES.

state_mode

An integer indicating whether changes to the application's network should be saved when the user performs a save operation. Specify one of the symbolic constants (defined in <avs/om.h>):

State mode
Meaning
0
Inherit the state mode from the parent context.
OM_STATE_PROG
Save the changes unconditionally when the user performs a save operation.
OM_STATE_USR
Give the user the choice to either save or discard the changes.
OM_STATE_TRANSIENT
Never save the changes.

notify_mode

An integer indicating how AVS/Express should treat notifications that occur during the push/pop context.

AVS/Express always suppresses notifications that have the same function id or argument id as context_id.

All other notifications are either queued until the pop, or queued until the parent's pop, or suppressed. Specify one of the following symbolic constants (defined in <avs/om.h>):

Notify mode
Meaning
0
Queue notifications until the next call to OMpop_ctx.
OM_CTX_PARENT_NOTIFIES
Queue notifications until the parent context's call to OMpop_ctx. If there is no parent context defined, events are queued and executed in this context's call to OMpop_ctx. Use this flag if you do not require that all queued events are executed when your OMpop_ctx call returns.
OM_CTX_BEGIN_OP
Specify the start of an operation that is not part of the operation defined by the parent context. This has the effect of requiring that "delayed operations" (such as the mapping of a user interface window) are executed in this context and the child_notify_mode is not propagated to this context.
OM_CTX_TOSS_NOTIFIES
Suppress all notifications. This mode should be used with extreme caution since it can prevent objects from being notified about events that they need to be notified of (like instance and destroy events).
OM_CTX_ALL_NOTIFIES
Allow notifications to be delivered to functions whose object is context_id. In other words, allow this method to notify itself.

child_notify_mode

An integer specifying the notify mode of all child contexts. Specify one of the following symbolic constants listed under the notify_mode argument.

When push/pop contexts are nested, a child's notification mode is the OR'd combination of:

Example 1

Here is a simple push/pop context that executes all events setting the state mode so that all changes made in the context will be saved:

OMpush_ctx(obj_id, OM_STATE_PROG, 0,0);
// any notifications that are triggered here....
OMpop_ctx(obj_id); // are executed during this call
Example 2

Here is a simple push/pop context that sets the state mode so that no changes made in the context will be saved and delays executing notifications until the parent context is popped:

OMpush_ctx(obj_id, OM_STATE_TRANSIENT,
OM_CTX_PARENT_NOTIFIES, 0);
// any notifications that are triggered here...
OMpop_ctx(obj_id); // are not executed here (unless there is
// no parent context)
See also
Section 1.13, EVflush_events  [page 1-31]
1.87 OMpush_status_range and OMpop_status_range
Synopsis
int OMpush_status_range(
int  min_percent,
int  max_percent);

int OMpop_status_range();
Description

These routines allow you to encapsulate a subroutine that uses the OMstatus_check routine to set the percent_done value. The subroutine sets percent done from 0 to 100. These routines determine how much contribution the subroutine has on the percent done of the calling routine.

Arguments
min_percent

After calling OMpush_status_range, a percent_done argument of 0 in OMstatus_check is mapped to this value.

max_percent

After calling OMpush_status_range, a percent_done argument of 100 in OMstatus_check is mapped to this value.

Example

You might have a function that computes an array of numbers called get_random_values. This function is coded so that it calls OMstatus_check at intervals from 0 to 100 as it walks through elements in the array. You then write a module which calls this function multiple times with different sized arrays. The higher level function can set a status range before calling the lower level function:

int
get_random_values(int arr[], int size)
{
int i, stop;
for (i = 0; i < size; i++) {
if (!(i & 0xf)) { /* do only every so often... */
(void) OMstatus_check(i * 100 / size, NULL, &stop);
if (stop) return(0); /* user interrupted us */
}
arr[i] = random();
}
return(1);
}
int
update_me(OMobj_id obj_id, OMevent_mask mask, int seq_num)
{
int arr1[1000], arr2[500];
int stat;

OMpush_status_range(0,75);
stat = get_random_values(arr1,1000);
OMpop_status_range();
if (stat != 1) return(0); /* interrupted */

OMpush_status_range(75,100);
stat = get_random_values(arr2,500);
OMpop_status_range();
if (stat != 1) return(0);

... set the values in arr1 and arr2 into objects...
See also
Section 1.104, OMstatus_check  [page 1-197]
1.88 OMread_desc
Synopsis
int  OMread_desc (
OMobj_id  parent,
char *  filename,
0   );
Description

OMread_desc reads an ascii V file into AVS/Express. New objects defined in the V file become subobjects of parent.

Arguments
parent

The id of an object. parent can be any object that can have subobjects, such as SingleWindowApp, Applications, or a library, group, or macro.

You cannot specify OMnull_obj for parent.

filename

The name of a V file. You can specify an absolute pathname or a path relative to the current directory of the calling process.

0

The third argument must be 0.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]). A 0 return status indicates that errors were encountered while parsing the file.

See also
Section 1.78, OMopen_file  [page 1-154]
1.89 OMret_array_ptr
Synopsis
void *OMret_array_ptr(
OMobj_id  object_id,
int  mode,
int  *size,
int  *type);

void *OMret_name_array_ptr(
OMobj_id  parent_id,
OMobj_name subobject_name,
int  mode,
int  *size,
int  *type);

void *OMXobj::ret_array_ptr(
int  mode,
int  *size = NULL,
int  *type = NULL);
Description

Returns the array value for the object specified. This routine works only when the array dimensions of the AVS/Express object are defined before this routine is called and only works for primitive objects that are not of type ptr or string. It can be used to both read and write the value of the array object.

This routine cannot be used to define the data type or array size of an array that does not have these values already defined in the AVS/Express object. If your AVS/Express object is defined like one of these and you are using this routine for write access (i.e., you are creating the array definition), you will have to use another routine to get its value:

prim foo[3]; // use OMret_typed_array_ptr
int bar[]; // use OMset_array or OMget_array

You can always use this routine for read-only array access since, in this case, the array must already have a defined type and size in this case.

You must call the routine ARRfree on the return value of this routine (unless NULL is returned) when you are finished with the array.

This routine is a wrapper that calls OMget_array. You can use that routine if you need to define or have returned to you the dimensions of the object (instead of just the array size).

Arguments
object_id

The id of the array object.

mode

The mode in which to retrieve the value for the array:

Mode
Meaning
OM_GET_ARRAY_RD
The program intends to read the array, but not write to it.
OM_GET_ARRAY_RD_COPY
The program requires a copy of the array for its own, private use (reading or writing).
OM_GET_ARRAY_RW
The program intends to both read and write to the array.
OM_GET_ARRAY_WR
The program intends to write to the array, completely replacing it, but not read it.

size

This argument returns the number of values in the array. You can pass this argument in as NULL if you know the size of the array implicitly because of the definition of the AVS/Express object. If the array is multi-dimensional, this value is the product of all of the dimensions.

type

This argument returns the data type of the returned array. You can pass this argument as NULL if you know the data type of your array from the definition of your AVS/Express object.

Returned value

The return value for this routine is a pointer to the array. You must always call the routine ARRfree on the array pointer when you are finished with it. If the array's value is not set, a NULL pointer is returned.

See also
Section 1.9, ARRfree  [page 1-25]
Section 1.38, OMget_array  [page 1-74]
1.90 OMret_typed_array_ptr
Synopsis
void *OMret_typed_array_ptr(
OMobj_id  object_id,
int  mode,
int  type,
int  *size);

void *OMXobj::ret_typed_array_ptr(
int  mode,
int  type,
int  *size);
Description

Returns the array value for the object specified. This routine works only when the array dimensions of the AVS/Express object are defined before the routine is called and only works for primitive objects that are not of type ptr or string. It can be used to both read and write the value of the array object. It is useful, in particular, when you need to define the data type for an object that does not have a defined data type or whose data type is different than the type of data you want to operate on.

If you have an object defined in V like

prim foo[3];

this routine defines the data type of the array to be the type specified by the type argument.

You must call the routine ARRfree on the return value of this routine (unless NULL is returned) when you are finished with the array.

This routine is a wrapper that calls OMget_array. You can use that routine if you need to define, or have returned to you, the dimensions of the object (instead of just the array size).

Arguments
object_id

The id of the array object.

mode

The mode in which to retrieve the value for the array:

Mode
Meaning
OM_GET_ARRAY_RD
The program intends to read the array, but not write to it.
OM_GET_ARRAY_RD_COPY
The program requires a copy of the array for its own, private use (reading or writing).
OM_GET_ARRAY_RW
The program intends to both read and write to the array.
OM_GET_ARRAY_WR
The program intends to write to the array, completely replacing it, but not read it.

type

This argument specifies the type of the array to return. If the array is not yet defined, it is created of this type. If the array is defined, it is converted into the type specified using normal C casting rules. The type value can be one of the data types described for OMget_data_type except for OM_TYPE_STRING and OM_TYPE_PTR.

size

This argument returns the number of values in the array. You can pass this argument in as NULL if you know the size of the array implicitly because of the definition of the AVS/Express object. If the array is multi-dimensional, this value is the product of all of the dimensions.

Returned value

The return value for this routine is a pointer to the array. You must always call the routine ARRfree on the array pointer when you are finished with it. If the array's value is not set, a NULL pointer is returned.

See also
Section 1.9, ARRfree  [page 1-25]
Section 1.38, OMget_array  [page 1-74]
Section 1.45, OMget_data_type and OMset_data_type  [page 1-95]
1.91 OMret_obj_name
Synopsis
char  *OMret_obj_name  (
OMobj_id  object_id  );
Description

OMret_obj_name returns an object's name as a character string.

Arguments
object_id

The id of an object.

Returned value

A character string containing the object's name. You are not allowed to modify the returned value under any circumstances, and you must not free it .

On failure, OMret_obj_name returns the string "<invalid>" or "<null"> if given OMnull_obj as an argument.

Example
/* Print val1_id's object name. */
OMobj_id val1_id;
...
printf("%s\n", OMret_obj_name(val1_id));
1.92 OMret_obj_parent
Synopsis
OMobj_id OMret_obj_parent(
OMobj_id object_id );
Description

OMret_obj_parent returns the parent object for the object specified.

Argument

object_id

The id of the object whose parent is returned.

Returned value

The id of the parent object. If the object_id parameter is invalid or of the object has no currently defined parent, OMnull_obj is returned.

1.93 OMret_obj_path
Synopsis
char  *OMret_obj_path  (
OMobj_id  object_id,
char  *object_name_buffer,
int  buffer_size );
Description

OMret_obj_path returns the full pathname of an object.

Arguments
object_id

The object id.

object_name_buffer

The address of a character buffer in which to store the pathname. If you pass a NULL buffer, OMret_obj_path ignores the buffer_size argument and returns a malloced string. You should free the string when you're done with it by using free().

buffer_size

The size of the buffer, in bytes. OMret_obj_path returns at maximum this many bytes.

Returned value

On success, the address of object_name_buffer.

On failure, OMret_obj_path returns the string "<invalid>" or "<null>.".

Example
/* Print val1_id's full pathname. */
OMobj_id val1_id;
char val1_name[100];
int bufsize = 100;
...
printf("%s\n", OMret_obj_path (val1_id, val1_name, bufsize));

1.94 OMret_obj_path_to
Synopsis
char  *OMret_obj_path_to  (
OMobj_id  object_id,
OMobj_id  upto_object_id,
char  *object_name_buffer,
int  buffer_size );
Description

OMret_obj_path_to returns the pathname of an object, qualified up to a specified object.

Arguments
object_id

The object id.

upto_object_id

The id of the object up to which the pathname of object_id should be qualified. If upto_object_id is not in object_id's path, the routine returns object_id's full pathname.

object_name_buffer

The address of a character buffer in which to store the pathname. If you pass a NULL buffer, OMret_obj_path_to ignores the buffer_size argument and returns a malloced string. You should free the string when you're done with it by using free().

buffer_size

The size of the buffer, in bytes. OMret_obj_path_to returns at maximum this many bytes. Names are truncated from the start of the pathname and ellipses are inserted when this limit is reached.

Returned value

A character string containing the object's unqualified name.

On failure, OMret_obj_path_to returns the string "<invalid>" or "<null>."

Example
/* Print val1_id's pathname up to my_app_id. */
OMobj_id val1_id, my_app_id
char val1_name[100];
int bufsize = 100;
...
printf("%s\n", OMret_obj_path_to (val1_id, my_app_id,
val1_name, bufsize));
1.95 OMret_omx_ptr
Synopsis
void *OMret_omx_ptr(
OMobj_id  object_id,
0);
Description

OMret_omx_ptr returns a pointer to the C++ object associated with the AVS/Express object object_id. You use this routine when you have an existing AVS/Express object that you want to manipulate with the C++ API.

This C++ object returned is a pointer to an OMXgroup.

In order for this routine to be used, the system must have a compiled definition of a C++ class corresponding to the object and the object must be in the same process as the code calling this routine.

C++ classes are generated for objects that have the export_cxx property set or for modules that have a cxxmethod.

Arguments
object_id

The object whose C++ class is returned.

0

The second argument must be 0.

Returned value

This routine returns a pointer to a C++ object of type OMXgroup. The OMXgroup class supports a method called OMXgroup::ret_omx_ptr that you must use to convert this pointer to a pointer of a more specific class.

If there is not an existing C++ object associated with the object specified, but AVS/Express does have a class associated with this object (or a template object that this object was created from), a new C++ object is created and a pointer to this newly created object is returned. If there is no defined class associated with this object, an error message is printed and a NULL pointer is returned.

You should not delete the object returned to you by this routine. It is deleted by AVS/Express when the object is destroyed.

1.96 OMret_str_array_val
Synopsis
char *OMret_str_array_val(
OMobj_id  object_id,
int  index,
char  *buffer,
int  buffer_size );
Description

OMret_str_array_val returns a string from an object that defines an array of strings. It is an easier alternative to using the OMget_str_array_val routine but provides access to the same value. AVS/Express currently only supports one-dimensional arrays of strings.

This routine is used in one of two modes:

Arguments
object_id

The object id of an object that has a string value.

index

The index into the array of the desired string. This value should be between 0 and one less than the value provided by the routine OMget_array_size.

buffer

If the value is NULL (or if the buffer_size parameter is 0) space is allocated for the string. If this parameter is not NULL (and the buffer_size argument is greater than 0), this argument specifies a pointer to memory in which to store the string. This pointer is returned by the function in this case.

buffer_size

Specifies the size of the buffer argument. If this argument is 0, the buffer argument is ignored.

Returned value

A pointer to a NULL terminated string containing the specified string in the array of strings is returned. This value should be freed using the C routine free if the buffer argument is NULL or if buffer_size is 0.

See also
Section 1.41, OMget_array_size and OMset_array_size  [page 1-85]
Section 1.63, OMget_str_array_val and OMset_str_array_val  [page 1-129]
1.97 OMret_str_val
Synopsis
char *OMret_str_val(
OMobj_id  object_id,
char  *buffer,
int  buffer_size );

char *OMret_name_str_val(
OMobj_id  parent_id,
OMobj_name  subobject_name,
char  *buffer,
int  buffer_size );
Description

This routine returns the string value for the object specified. It is an easier alternative to using the OMget_str_val routine but provides the same value.

It is used in one of two modes:

Arguments
object_id

This specifies the object id of an object that has a string value.

buffer

If the value is NULL (or if the buffer_size parameter is 0) space is allocated for the string. If this argument is not NULL (and the buffer_size argument is greater than 0), this parameter specifies a pointer to memory in which to store the string. This pointer is returned by the function in this case.

buffer_size

Specifies the size of the buffer argument. If this argument is 0, the buffer argument is ignored.

Returned value

A pointer to a NULL terminated string containing the string value of the object specified. This value should be freed using the C routine free if the buffer argument is NULL or if buffer_size is 0.

See also
Section 1.64, OMget_str_val and OMset_str_val  [page 1-132]
1.98 OMset_xxxx

Most OMset_xxxx routines are described with the OMget_xxxx routines.

For details on...
See...
OMset_array_size
OMset_array_val
OMset_obj_att
OMset_obj_iprop
OMset_obj_name
OMset_obj_parent
OMset_obj_prop
OMset_obj_ref_mode
OMset_obj_rprop
OMset_obj_sprop
OMset_obj_val
OMset_func_val
OMset_int_val
OMset_name_int_val
OMset_name_real_val
OMset_ptr_val
OMset_real_val
OMset_str_array_val

1.99 OMset_array
Synopsis
int OMset_array (
OMobj_id object_id,
int  type,
char  *array_pointer,
int  size,
int   mode  );

int OMXobj::set_array (
int  type,
char  *array_pointer,
int  size,
int   mode = OM_SET_ARRAY_COPY )
Description

OMset_array sets the value of an array object; i.e., all elements in the array.

This routine cannot be used for objects of type string or ptr.

You use OMset_array when the calling process has already created an array and needs to set the array object to that array. If the dimensions of the array are defined before you need to access the array, you may find it easier to use the routines: OMret_array_ptr, OMret_typed_array_ptr or OMget_array. These routines can be used to get a pointer to the array which you can then read, write or read and write. The OMset_array routine can only be used for write-only operations.

Arguments
object_id

The id of an array object.

type

The integer code for the array's data type. type must be compatible with the object's type. For example, if the object is integer, then the array could be any numeric type; AVS/Express performs any necessary conversion.

AVS/Express provides the following symbolic constants, defined in <avs/om.h>:

Type
Meaning
OM_TYPE_CHAR
Character
OM_TYPE_BYTE
Byte
OM_TYPE_SHORT
Short integer
OM_TYPE_INT
Integer
OM_TYPE_FLOAT
Single-precision floating-point
OM_TYPE_DOUBLE
Double-precision floating-point

array_pointer

The address of the array being written.

size

The total number of values in the array.

The array's length should equal the size of the array object. In the following example, object myarray's size is 300, the product of each dimension, so the array that is written should contain 300 values and length should equal 300:

int myarray[20][5][3];

The target object can have at most one dimension that does not specify a size. For example, if myarray is defined as follows:

int myarray[];

then the array can be any size.

If the target object is multidimensional and one of the dimensions does not specify a size, then the array's total size must be a multiple of the sizes specified. For example, if myarray is defined as follows:

int myarray[3][2][];

then the array's size must be a multiple of 6.

mode

How AVS/Express should set the array. Specify one of the following symbolic constants:

Mode
Meaning
OM_SET_ARRAY_COPY
Copy the specified array into the Object Manager. The array defined by the array_pointer argument is not touched by AVS/Express and continues to be valid after the call.
OM_SET_ARRAY_STATIC
If possible, do not copy the array. Instead, set the object's array pointer to array_pointer. AVS/Express copies the array anyway if the function is running in an external process or if data-type conversion is required.
AVS/Express does not manage the array. You must ensure that the array is valid for the life of the object or until the object replaces the array with another call to OMset_array. AVS/Express will not free the array in this case.
OM_SET_ARRAY_FREE
If possible, do not copy the array. Instead, set the object's array pointer to array_pointer. AVS/Express copies the array anyway if the function is running in an external process or if data-type conversion is required.
AVS/Express manages the array, and will determine when the array can be freed. You should not free the array yourself. The array will not be valid after this call unless you allocate it with ARRalloc and use the routine ARRincr_refcnt on the result before calling OMset_array.
You must allocate the array either with the C library routine malloc or the AVS/Express routine ARRalloc.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.8, ARRalloc  [page 1-23]
Section 1.38, OMget_array  [page 1-74]
Section 1.89, OMret_array_ptr  [page 1-171]
Section 1.89, OMret_array_ptr  [page 1-171]
1.100 OMset_obj_iarray_prop
Synopsis
int OMset_obj_iarray_prop(
OMobj_id  object_id,
OMobj_name  property_name,
int  nvalues,
int  values[]);
Description

This routines sets the value of a property on an object which is defined by an integer array of values. It is most useful to set the value of the NEportLevels property when you are setting the number of input port levels to be different than the number of output port levels. If you are setting both to the same value, you can use OMset_obj_iprop instead.

Arguments
object_id

The object whose property you want to set.

property_name

The property name of the property you want to set. This can either be one of the global variables defined in <avs/om_att.h> or <avs/ne_om.h> or the return value from the function OMstr_to_name.

nvalues

The number of values in the array.

values

The values in the array. These values are copied out of the location specified by the values argument.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]

Example

Here is an example that sets the NEportLevels property on the object in the variable obj:

int values[2];
values[0] = 2;
values[1] = 3;
OMset_obj_iarray_prop(obj, OMstr_to_name("NEportLevels"),
2, values);
1.101 OMset_obj_ref
Synopsis
int  OMset_obj_ref (
OMobj_id  referencing_object,
OMobj_id  referenced_object,
int mode  );

int  OMXobj::set_obj_ref (
OMobj_id  referenced_object,
int mode  = 0);
Description

OMset_obj_ref makes a connection in referencing_object to referenced_object.

OMset_obj_ref is useful for making a single connection. If the referencing object is already connected to an object, that connection is replaced by the new connection.

If the referencing object is a scalar, the referenced object must also be a scalar. If the referencing object is an array, the referenced object must also be an array.

To connect an object to an array of objects, call OMadd_obj_ref instead.

Section 1.20, OMadd_obj_ref  [page 1-45]
Arguments
referencing_object

The id of the referencing object.

referenced_object

The id of the referenced object.

You can specify OMnull_obj. The Object Manager simply breaks the current connection so that referencing_object is no longer connected to anything.

mode

The mode argument is typically specified as 0. If you specify a mode argument of OM_OBJ_REF_RDONLY, you create a read-only connection. For primitive values, a read-only connection is broken whenever a set operation applied to the referencing object.

Returned value

The status code (see Section 1.7, Return status  [page 1-22]).

See also
Section 1.20, OMadd_obj_ref  [page 1-45]
1.102 OMset_state_mode
Synopsis
void OMset_state_mode(
int  mode );
Description

OMset_state_mode is a C macro that sets the state mode to the mode supplied. The state mode is a part of the current context that determines how changes made are saved using the save operation. It is also set through OMpush_ctx and is restored when an OMpop_ctx call is made. As long as you make the OMset_state_mode call in between OMpush_ctx and OMpop_ctx calls, you do not need to restore the state mode after changing it. All methods are executed inside of OMpush_ctx and OMpop_ctx calls.

Argument
mode

This argument specifies the state mode. It can be set to one of the values OM_STATE_PROG, OM_STATE_USR or OM_STATE_TRANSIENT. See OMpush_ctx and OMpop_ctx for details.

See also
Section 1.86, OMpush_ctx and OMpop_ctx  [page 1-163]
1.103 OMset_verbose
Synopsis
void  OMset_verbose (
unsigned int mask,
int  state,
FILE  *fp  );
Description

OMset_verbose sets the verbose mode for the events specified by mask.

Arguments
mask

One or more events whose verbose mode is to be set. Modes that are omitted are unaffected.

You can specify any of the following symbolic constants, which are defined in <avs/om.h>:

Verbose mode
Meaning
OM_VERBOSE_FUNC
Prints a message before executing any function objects. The message indicates the function object's name, the argument's name, and the event that caused the function to execute.
OM_VERBOSE_EVENT
Prints a message when an event is queued. If an object is modified while a context has been pushed, the event is queued. The message indicates the name of the function (and/or argument) of the function that is being queued, the name of the object that caused the event, and the type of the object that caused this function to be queued (e.g., a value-changed event).
OM_VERBOSE_SORT
Prints a message when a function has been bypassed for another function on which it has a dependency. This is useful for detemining why functions are perhaps executing in the wrong order.
OM_VERBOSE_CTX
Prints a message when a context is pushed or popped. This is useful for determining which events are being generated by asynchronous events such as the user interface.
OM_VERBOSE_FILES
Prints a message before and after loading each V file.

state

Whether to turn the specified modes on or off:

State
Meaning
0
Turn the specified modes off.
1
Turn the specified modes on.

fp

A file pointer indicating where the output should be directed. The default if fp is NULL is standard out.

Example
/* Turn on verbose mode for OM_VERBOSE_FUNC and
   OM_VERBOSE_EVENT. The output is sent to std out. */
OMset_verbose(OM_VERBOSE_FUNC | OM_VERBOSE_EVENT, 1, NULL);
1.104 OMstatus_check
Synopsis
int OMstatus_check(
int  percent_done,
char  *mod_name,
int  *interrupt);
Description

OMstatus_check performs two functions:

This function should only be called from within the callback function of a method. In order for this function to work, you should have enabled status display for your method by setting the status property to 1. In V, you can do this with:

module my_module {
omethod update<status=1> = "my_module_update";
};

There is some overhead for calling this routine. You should try to avoid calling it more than is necessary, roughly a few times per second of execution.

If your module is not contained in a single function, you may sometimes want to bracket lower level operations that are used by several different higher level operations and thus cannot accurately predict what range of execution time they will occupy. You can use the routines OMpush_status_range and OMpop_status_range to perform this function.

Arguments
percent_done

This integer sets the percent done flag in the scheduler. This is a number between 0 and 100 that indicates roughly what percentage of the current method's work has been completed so far. This value is displayed to the user through a status bar. Setting this to a 0 value prevents flag from being updated.

mod_name

This string specifies the module name or other information that is displayed with the status information. You can use it to display a short one-line message about what operation is currently proceeding. If this value is passed as NULL, this field is not updated.

interrupt

When this value is returned as 1, it indicates that the user has attempted to interrupt the current operation. Your method should then take whatever steps are necessary to abort the current operation and return as soon as possible. If you are not going to honor this flag, you should pass a NULL value for this parameter as there is some overhead for calling this routine.

Example

This example shows how you might place the OMstatus_check call into a loop inside of a module's update method:

for (i = 0; i < size; i++) {
if (!(i & 0xff)) { /* do only every so often... */
(void) OMstatus_check(i * 100 / size, NULL, &stop);
if (stop) return(0); /* user interrupted us */
}
// insert the body of the loop here
}

Returned value

A status code. See Section 1.7, Return status  [page 1-22].

See also
Section 1.87, OMpush_status_range and OMpop_status_range  [page 1-168]
1.105 OMstr_to_type
Synopsis
OMtype_id OMstr_to_type (
char *  type_name  );
Description

OMstr_to_type returns the type id corresponding to type_name.

Argument
type_name

The name of a primitive type, such as group, macro, or int, specified as a string.

Returned value

The type id corresponding to type_name; NULL on an error.

1.106 OMupd_name_refs
Synopsis
int OMupd_name_refs(
OMobj_id  object_id);
Description

OMupd_name_refsshould be used after you have moved an object in the object hierarchy (with OMdel_subobj, OMinsert_subobj) or changed an object's name. You need only call this routine if the may have connections to it that need to be updated by this change.

This routine updates the values of any name-link objects that are connected to this object so that they will use the new pathname in the future.

Arguments
object_id

The object whose name has been changed or has been moved in the object hierarchy.