1. drmaa2_list_create(3)
  2. DRMAA2
  3. drmaa2_list_create(3)

NAME

drmaa2_list_create - drmaa2_list_create, Creates a DRMAA2 list

SYNOPSIS

#include "drmaa2.h"

typedef enum drmaa2_listtype { DRMAA2_STRINGLIST, DRMAA2_JOBLIST, DRMAA2_QUEUEINFOLIST, DRMAA2_MACHINEINFOLIST, DRMAA2_SLOTINFOLIST, DRMAA2_RESERVATIONLIST } drmaa2_listtype;

typedef void (*drmaa2_list_entryfree)(void **value);

drmaa2_list drmaa2_list_create(const drmaa2_listtype type, const drmaa2_list_entryfree callback);

DESCRIPTION

Allocates a new drmaa2_list(3) of a specific type initialized with a specific callback function (or NULL). The callback acts as destroy function and is called when an element is deleted with drmaa2_list_del(3). When the list is freed with drmaa2_list_free(3) and a callback function was given then for each element in the list this function is called. When lists are returned as copies by DRMAA2 functions then appropriate destroy functions are set.

The drmaa2_listtype can be any of:

DRMAA2_STRINGLIST

A list containing drmaa2_string(3) values (which are in C defined as char *). The appropiate destroy function is drmaa2_string_free(3).

DRMAA2_JOBLIST

A list containing drmaa2_j(3) (job) objects. The appropriate destroy function is drmaa2_j_free(3).

DRMAA2_QUEUEINFOLIST

A list containing drmaa2_queueinfo(3) objects. The appropriate destroy function is drmaa2_queueinfo_free(3).

DRMAA2_MACHINEINFOLIST

A list containing drmaa2_machineinfo(3) objects. The appropriate destroy function is drmaa2_machineinfo_free(3).

DRMAA2_SLOTINFOLIST

A list containing drmaa2_slotinfo(3) objects. The appropriate destroy function is drmaa2_slotinfo_free(3). The list is used only in a reservation session and currently not supported by Univa(R) Grid Engine(TM).

DRMAA2_RESERVATIONLIST

A list containing drmaa2_reservation(3) objects. The appropriate destroy function is drmaa2_reservation_free(3). Currently not supported by Univa(R) Grid Engine(TM).

RETURN VALUES

Upon successful completion drmaa2_list_create(3) returns a newly allocated drmaa2_list. The depending on the given type the returned list can be either a drmaa2_string_list, drmaa2_j_list, drmaa2_queueinfo_list, drmaa2_machineinfo_list, drmaa2_slotinfo_list, or a drmaa2_r_list.

EXAMPLE

drmaa2_string_list strings = drmaa2_create_list(DRMAA2_STRINGLIST, (drmaa2_list_entryfree) drmaa2_string_free);

drmaa2_list_add(strings, strdup("string one"));
drmaa2_list_add(strings, strdup("string two"));
drmaa2_list_del(strings, "string one"));

printf("Size of list %ld", drmaa2_list_size(strings));

drmaa2_list_free(&strings); 

SEE ALSO

drmaa2_list_free(3), drmaa2_list_add(3), drmaa2_list_del(3), drmaa2_list_size(3), drmaa2_list_get(3), drmaa2_list_has(3)

AUTHOR

Copyright Univa Corporation 2013

  1. Univa Corporation
  2. October 2013
  3. drmaa2_list_create(3)