next up previous contents
Next: Links Up: Function calls and their Previous: Records   Contents

Keywords

int status = drms_setkey_char(DRMS_Record_t *record, char *keyname, char value)
int status = drms_setkey_int(DRMS_Record_t *record, char *keyname, int value)
int status = drms_setkey_short(DRMS_Record_t *record, char *keyname, short value)
int status = drms_setkey_longlong(DRMS_Record_t *record, char *keyname, long long value)
int status = drms_setkey_float(DRMS_Record_t *record, char *keyname, float value)
int status = drms_setkey_double(DRMS_Record_t *record, char *keyname, double value)
int status = drms_setkey_string(DRMS_Record_t *record, char *keyname, char *value)
 
These functions are used to assign a value (given by the argument value) to a keyword of the data record pointed to by record. The name of the keyword is given by the string argument keyname.

When the type of value and the named keyword agrees the assignment always succeeds and status=0 is returned. List of possible return value for status:

Notice that the string to floating point conversions never return status=0, but instead return status=1 for a successful conversion, indicating that accuracy may have been lost. Certain strings like "0.25" can in principle be converted to floating point without loss of information, whereas strings like "0.1" do not have a finite binary representation. The C library functions strtof and strtod used internally in JSOC do not provide information to distinguish the two cases, so we take the more cautious approach of always returning status=1 to remind the user that rounding may have occured. The same argument holds for conversion from floating point to string.

char drms_getkey_char(DRMS_Record_t *record, char *keyname, int *status)
short drms_getkey_short(DRMS_Record_t *record, char *keyname, int *status)
int drms_getkey_int(DRMS_Record_t *record, char *keyname, int *status)
long long drms_getkey_longlong(DRMS_Record_t *record, char *keyname, int *status)
float drms_getkey_float(DRMS_Record_t *record, char *keyname, int *status)
double drms_getkey_double(DRMS_Record_t *record, char *keyname, int *status)
char * drms_getkey_string(DRMS_Record_t *record, char *keyname, int *status)
 
These functions return the value of keyword from the data record pointed to by record. The name of the keyword is given by the string argument keyname. If status is not NULL, one of the exit codes listed in Table 1 will be returned. If status is NULL two things can happen: If the status value would have been non-negative the call returns successfully. If the status value would have been negative the drms_abort is called and the program is terminated and information about where the error occured is written to stderr.


next up previous contents
Next: Links Up: Function calls and their Previous: Records   Contents
Philip Scherrer 2006-06-17