1.6. Modifying Current Attributes

A few options within an UM object's current attributes can be set after the object is created. UM API functions supporting such actions operate on the object itself, rather than on an attributes object. In addition to modifying the current attributes, the value of options from the current attributes can be fetched.

The UM objects which support these actions are lbm_src_t, lbm_rcv_t, lbm_context_t, and lbm_event_queue_t. For each such object, there are corresponding API functions to set an option from a binary value, set an option from a string value, get an option as a binary value, and get an option as a string value. These function names are based on the object name, suffixed with _setopt(), _str_setopt(), _getopt(), and _str_getopt(). As an illustration of this convention, the API functions for working with lbm_event_queue_t objects are shown in the following table.

Table 1-3. UM API Functions For Working With lbm_event_queue_t Objects

Action UM API function
Set Option from a Binary Value lbm_event_queue_setopt()
Set Option from a String Value lbm_event_queue_str_setopt()

The following sections describe in detail the use of these UM API functions. The functions related to lbm_event_queue_t objects are used for the purpose of illustration, but the instructions (if not the specifics) apply to all such UM objects.

1.6.1. Setting An Option from a Binary Value

Setting an option from a binary value requires knowledge of not only the option name, but its type and allowable values as well. The final two parameters in the call to lbm_event_queue_setopt() are a pointer to a variable which contains the option value to be set, and a pointer to a variable of type size_t which contains the length of the option value variable. This length must be be correct for the specified option.

In the example code below, we set the queue size warning to 5000 events.

unsigned long int optval;
size_t optlen;
lbm_event_queue_t evq; /* must be previously created */
int rc;

/* Set the queue size warning */
optlen = sizeof(optval);
optval = 5000;
rc = lbm_event_queue_setopt(&evq, "queue_size_warning", &optval, &optlen);
if (rc != 0)
{
   /* Handle error */
}

1.6.2. Setting An Option from a String Value

Setting an option from a string value effectively does the same thing that setting an option from a binary value does. However, the option value is passed as a null-terminated string, rather than as value and length pointers. This is similar to the mechanism used by UM to process options in a configuration file. Thus, the format used for option values must match the format you would use in a configuration file.

As before, we set the queue size warning to 5000 events.

lbm_event_queue_t evq; /* must be previously created */
int rc;

/* Set the queue size warning */
rc = lbm_event_queue_setopt(&evq, "queue_size_warning", "5000");
if (rc != 0)
{
   /* Handle error */
}

1.6.3. Restrictions

Modifying the current attributes of a object allows only a very limited subset of options to be set or retrieved. Consult subsequent sections of this document to determine if a particular option can be specified.

Copyright (c) 2004 - 2014 Informatica Corporation. All rights reserved.