| synopsis || arguments || prev || next |
void set( const char * name, int record_idx, int field_idx, int value)
Java: void Set( String name, int record_idx, int field_idx, int value)
[Declared in "../coresys/common/kdu_params.h"]
Sets the value of a single parameter (field) in the named attribute, having the I (integer) type (or an integer-compatible) type. It is legal to overwrite existing values.
The parameter values managed by any given attribute are organized as an array of records, each of which has an identical structure, defined by fields. Fields are typed and each field in the record may have a different type; however, the type of each field is immutable after configuration by the relevant parameter class's constructor. Simple field types are as follows: I (integer); B (boolean); and F (float). The attribute definition language used by parameter class constructors also supports enumerated and flag field types, both of which have integer values for the purpose of direct function queries. The enumerated type can take on only one of a number of pre-defined values, each of which has a textual identifier for use in parsing and textualization. The flag type represents a logical OR of any or all of a set of bit flags, each of which has a pre-defined value and associated textual identifier.
The present function may be used to set any field value which may be represented as an integer. This includes the I (integer) type, as well as the enumerated and flag types. In the latter cases, however, a check is made to verify that the supplied integer is compatible with legal enumerated values or flag bits. The function may also be used to set B (boolean) field types, although this is not recommended (you should really use the boolean form of the overloaded set function). If the function is used to set booleans, a check will be made to verify that the integer is either 0 (false) or 1 (true).
The function generates an error (through kdu_error) if the request is incompatible with the record structure defined for this attribute. For example, the attribute might not support multiple records, it might not define sufficient fields, or the identified field might not be compatible with the supplied integer value, as described above.
It is not strictly necessary to set all fields in a record before moving on to another record; nor is it strictly necessary to set records in sequence. However, most reasonable applications will expect to see a consecutive set of completed records eventually and other methods for internalizing attribute values such as string parsing and marker segment translation will also fill out completed records in sequence.
Name of the attribute, in which the identified field is to be set. Attribute names are unique across all clusters. If necessary, a full string match is performed on the attribute name, but you would do well to use one of the pre-defined macros for the relevant derived parameter class. These are documented with the derived classes themselves.
0 for the first record.
0 for the first field in the record.
The integer value to which the field should be set. Note that some types of fields have limited legal numeric ranges, in which case the function will check them, generating any appropriate error messages through kdu_error.