lDiffListStr() -- Remove elements with the same string
int lDiffListStr(int nm, lList **lpp1, lList **lpp2)
Remove elements in both lists with the same string key in field 'nm'.
int nm - field name id lList **lpp1 - first list lList **lpp2 - second list
int - error status 0 - OK -1 - Error
lJoin() -- Joins two lists together
lList* lJoin(const char *name, int nm0, const lList *lp0, const lCondition *cp0, const lEnumeration *enp0, int nm1, const lList *lp1, const lCondition *cp1, const lEnumeration *enp1)
Returns a new list joining together the lists 'lp0' and 'lp1' For the join only these 'lines' described in condition 'cp0' and 'cp1' are used. The new list gets only these members described in 'enp0' and 'enp1'. NULL means every member of this list. The list gets 'name' as listname.
const char *name - name of new list int nm0 - const lList *lp0 - first list const lCondition *cp0 - selects rows of first list const lEnumeration *enp0 - selects column of first list int nm1 - const lList *lp1 - second list const lCondition *cp1 - selects rows of second list const lEnumeration *enp1 - selects column of second list
lList* - Joined list
lJoinCopyElem() -- Combine two elements
static lListElem* lJoinCopyElem(const lDescr *dp, const lListElem *src0, const lEnumeration *enp0, const lListElem *src1, const lEnumeration *enp1)
Returns a combined element with descriptor 'dp'. Uses 'src0' with mask 'enp0' and 'src1' with mask 'enp1' as source.
const lDescr *dp - descriptor const lListElem *src0 - element1 const lEnumeration *enp0 - mask1 const lListElem *src1 - element2 const lEnumeration *enp1 - mask2
static lListElem* - combined element
lJoinDescr() -- Builds new descriptor using two others
lDescr* lJoinDescr(const lDescr *sdp0, const lDescr *sdp1, const lEnumeration *ep0, const lEnumeration *ep1)
Builds from two given descriptors 'sdp0' and 'sdp1' a new descriptor masked by the enumerations 'ep0' and 'ep1'.
const lDescr *sdp0 - first descriptor const lDescr *sdp1 - second descriptor const lEnumeration *ep0 - first mask const lEnumeration *ep1 - second mask
lDescr* - new descriptor
lJoinSublist() -- Join a list with one of its sublists
lList* lJoinSublist(const char *name, int nm0, const lList *lp, const lCondition *cp0, const lEnumeration *enp0, const lDescr *sldp, const lCondition *cp1, const lEnumeration *enp1)
Joins a list and one of its sublists together. The other parameters are equal to them from lJoin(). In the enumeration 'enp0' the sublist field neither may be selected nor 'enp0' may be NULL.
const char *name - new list name int nm0 - const lList *lp - list const lCondition *cp0 - selects rows within 'lp' const lEnumeration *enp0 - selects columns within 'lp' const lDescr *sldp - sublist descriptor pointer const lCondition *cp1 - selects rows within 'sldp' const lEnumeration *enp1 - selects columns within 'enp1'
lList* - Joined list
lPartialDescr() -- Extracts some fields of a descriptor
int lPartialDescr(const lEnumeration *ep, const lDescr *sdp, lDescr *ddp, int *indexp)
Extracts some fields of the source descriptor 'sdp' masked by an enumeration 'ep' of needed fields
const lEnumeration *ep - mask const lDescr *sdp - source lDescr *ddp - destination int *indexp -
int - error state 0 - OK -1 - Error
lSelect() -- Extracts some elements fulfilling a condition
lList* lSelect(const char *name, const lList *slp, const lCondition *cp, const lEnumeration *enp)
Creates a new list from the list 'slp' extracting the elements fulfilling the condition 'cp'.
const char *name - name for the new list const lList *slp - source list pointer const lCondition *cp - selects rows const lEnumeration *enp - selects columns (fields)
lList* - list containing the extracted elements, or NULL if none match
The condition and enumeration are constructed by lWhere and lWhat respectively.
lSelectDPack() -- Extracts some elements fulfilling a condition
lList* lSelectDPack(const char *name, const lList *slp, const lCondition *cp, const lDescr *dp, bool isHash, sge_pack_buffer *pb)
Creates a new list from the list 'slp' extracting the elements fulfilling the condition 'cp' or packs the elements into the packbuffer 'pb' if it is not NULL.
const char *name - name for the new list const lList *slp - source list pointer const lCondition *cp - selects rows const lDescr *dp - descriptor for the new list const lEnumeration *enp - selects columns bool isHash - enables/disables the hash table creation sge_pack_buffer *pb - packbuffer u_long32 *elements - number of packed elements (only used if pb != NULL)
lList* - list containing the extracted elements
lSelectDestroy() -- Removes list elements not fulfilling a condition
lList* lSelectDestroy(lList *slp, const lCondition *cp)
Removes elements from the list 'slp' NOT fulfilling the condition 'cp'.
lList *slp - source list pointer const lCondition *cp - selects rows (returned by lWhere)
lList* - List with the remaining elements, or NULL if none remain
The operation is destructive, so use lCopyList before lSelectDestroy if you want to use the list subsequently.
lSelectElemDPack() -- Extracts some elements fulfilling a condition
lListElem* lSelectElemDPack(const lListelem *slp, const lCondition *cp, const lEnumeration *enp, bool isHash, sge_pack_buffer *pb)
Creates a new list from the list 'slp' extracting the elements fulfilling the condition 'cp' or it packs those elements into 'pb' if it is not NULL.
const lListElem *slp - source list pointer const lCondition *cp - selects rows const lDescr *dp - target descriptor for the element bool isHash - creates hash or not sge_pack_buffer *pb - packbuffer u_long32 *elements - increases the number of elems, if one is added to the pb. Only, when elements is not NULL (only used if pb != NULL)
lListElem* - list containing the extracted elements
lSelectElemPack() -- Extracts some elements fulfilling a condition
lListElem* lSelectElemPack(const lListElem *slp, const lCondition *cp, const lEnumeration *enp, bool isHash, sge_pack_buffer *pb)
Creates a new list from the list 'slp' extracting the elements fulfilling the condition 'cp' or extracts the elements and stores the contend in 'pb'.
const lListElem *slp - source list pointer const lCondition *cp - selects rows const lEnumeration *enp - selects columns bool isHash - create hash or not sge_pack_buffer *pb - packbuffer
lListElem* - list containing the extracted elements
lSelectHashPack() -- Extracts some elements fulfilling a condition
lList* lSelectHashPack(const char *name, const lList *slp, const lCondition *cp, const lEnumeration *enp, bool isHash, sge_pack_buffer *pb)
Creates a new list from the list 'slp' extracting the elements fulfilling the condition 'cp' or fills the packbuffer if pb is not NULL.
const char *name - name for the new list const lList *slp - source list pointer const lCondition *cp - selects rows const lEnumeration *enp - selects columns bool isHash - enables/disables the hash generation sge_pack_buffer *pb - packbuffer
lList* - list containing the extracted elements
lSplit() -- Splits a list into two list
int lSplit(lList **slp, lList **ulp, const char *ulp_name, const lCondition *cp)
Unchains the list elements from the list 'slp' NOT fulfilling the condition 'cp' and returns a list containing the unchained elements in 'ulp'
lList **slp - source list pointer lList **ulp - unchained list pointer const char *ulp_name - 'ulp' list name const lCondition *cp - selects rows within 'slp'
int - error status 0 - OK -1 - Error
lString2List() -- Convert char* string into CULL list
int lString2List(const char *s, lList **lpp, const lDescr *dp, int nm, const char *delimiter);
Parses separated strings and adds them into the cull list *lpp The string is a unique key for the list and resides at field 'nm' If 'delimiter' is NULL than isspace() is used.
const char *s - String to parse lList **lpp - reference to lList* const lDescr *dp - list Type int nm - list field const char *delimiter - string delimiter
int - error state 1 - OK 0 - On error
lString2ListNone() --
int lString2ListNone(const char *s, lList **lpp, const lDescr *dp, int nm, const char *dlmt)
const char *s - ??? lList **lpp - ??? const lDescr *dp - ??? int nm - ??? const char *dlmt - ???
int - error state 0 - OK
lDumpDescr() -- Write a descriptor (for debugging purpose)
int lDumpDescr(FILE *fp, const lDescr *dp, int indent)
Write a descriptor (for debugging purpose)
FILE *fp - file pointer const lDescr *dp - descriptor int indent -
int - error state 0 - OK -1 - Error
lDumpElem() -- Dump a given element into a file
int lDumpElem(const char *fname, const lListElem *ep, int indent)
Dump a given element into a file in text format
const char *fname - filename const lListElem *ep - element int indent - number of spaces to indent
int - error state -1 - Error 0 - OK
MT-NOTE: lDumpElem() is not MT safe
lDumpElemFp() -- Dump a given element into FILE stream
int lDumpElemFp(FILE *fp, const lListElem *ep, int indent)
Dump a given element into FILE stream
FILE *fp - file stream const lListElem *ep - element int indent -
int - error state 0 - OK -1 - Error
MT-NOTE: lDumpElemFp() is not MT safe
lDumpList() -- Writes a list to a FILE stream
int lDumpList(FILE *fp, const lList *lp, int indent)
Writes a list to a FILE stream.
FILE *fp - file stream const lList *lp - list int indent -
int - error state 0 - OK -1 - Error
MT-NOTE: lDumpList() is not MT safe
lDumpObject() -- Writes an object to a FILE stream
int lDumpObject(FILE *fp, const lListElem *ep, int indent)
Writes an object to a FILE stream.
FILE *fp - file stream const lListElem *ep - object int indent -
int - error state 0 - OK -1 - Error
lUndumpDescr() -- Read a descriptor from file (debug)
lDescr* lUndumpDescr(FILE *fp)
Read a descriptor from file (for debugging purposes)
FILE *fp - file stream
lDescr* - descriptor
lUndumpElem() -- Read element from dump file
lListElem* lUndumpElem(FILE *fp, const lDescr *dp)
Read element from FILE stream
FILE *fp - file stream const lDescr *dp - descriptor
lListElem* - Read element, or NULL if either arg is NULL
lUndumpElemFp() -- Read element from FILE stream
lListElem* lUndumpElemFp(FILE *fp, const lDescr *dp)
Read element from FILE stream
FILE *fp - file stream const lDescr *dp - descriptor
lListElem* - Read element
lUndumpList() -- Reads a by lDumpList dumped dump
lList* lUndumpList(FILE *fp, const char *name, const lDescr *dp)
Reads a by lDumpList dumped dump into the memory.
FILE *fp - file pointer const char *name - new name of list or NULL if the old name in the dumpfile should be used as listname const lDescr *dp - new list descriptor or NULL if the old list descriptor should be used as list descriptor
lList* - Read list
Actually a type/name matching is only performed for the list itself and not for its sublists. If an implementation of changed sublist descriptors is desired we can probably use the following syntax for lUndumpList. lList* lUndumpList(fp, name, formatstring, ...) with formatstring like "%T(%I -> %T(%I->%T))" and the varargs list: ".....", lDescr1, fieldname1, lDescr2, fieldname2, lDescr3 or write a wrapper around lUndumpList which parses this format and hands over the varargs list to lUndumpList
lUndumpObject() -- Reads a by lDumpList dumped dump
lListElem* lUndumpObject(FILE *fp)
Reads a by lDumpList dumped dump into the memory.
FILE *fp - file pointer
lListElem* - Read list element
lReadElemFromDisk() -- Reads a cull element from file
lListElem* lReadElemFromDisk(const char *prefix, const char *name, const lDescr *type, const char *obj_name)
Reads a lListElem of the specified 'type' from the file 'prefix'/'name'. Either 'prefix' or 'name' can be null. Returns a pointer to the read element or NULL in case of an error
const char *prefix - Path const char *name - Filename const lDescr *type - Type const char *obj_name -
lListElem* - Read CULL element
lWriteElemToDisk() -- Writes a element to file
int lWriteElemToDisk(const lListElem *ep, const char *prefix, const char *name, const char *obj_name)
Writes the Element 'ep' to the file named 'prefix'/'name'. Either 'prefix' or 'name can be null.
const lListElem *ep - CULL element const char *prefix - Path const char *name - Filename const char *obj_name -
int - error state 0 - OK 1 - Error
htable -- Hashtable extensions for cull lists
cull_htable cull_hash_create(const lDescr *descr, int size); void cull_hash_new(lList *lp, int name, bool unique); void cull_hash_insert(const lListElem *ep, const int pos, ); void cull_hash_remove(const lListElem *ep, const int pos); void cull_hash_elem(const lListElem *ep); lListElem *cull_hash_first(const lList *lp, const int pos, const void *key, const void **iterator); lListElem *cull_hash_next(const lList *lp, const int pos, const void *key, const void **iterator); void cull_hash_free_descr(lDescr *descr);
This module provides an abstraction layer between cull and the hash table implementation in libuti. It provides the necessary functions to use hash tables from libuti for cull lists. The functions defined in this module implement hash tables with non unique keys, provide wrapper functions for hash insert, remove and search that are aware of the non unique hash implementation, functions that deal with the necessary extensions to the cull list descriptor objects etc.
Defines -- Constants for the cull hash implementation
#define MIN_CULL_HASH_SIZE 4
Provides constants to be used in the hash table implementation for cull lists. MIN_CULL_HASH_SIZE - minimum size of a hash table. When a new hash table is created, it will have the size 2^MIN_CULL_HASH_SIZE
Typedefs -- Typedefs for cull hash implementation
typedef struct _non_unique_hash non_unique_hash; struct _non_unique_hash { non_unique_hash *next; const void *data; };
Internal data structure to handle hash tables with non unique keys. The hash table (from libuti) in this case will not store a pointer to the cull object itself, but a pointer to a list of cull objects. This list is implemented using the non_unique_hash structures.
cull_hash_create() -- create a new hash table
cull_htable cull_hash_create(const lDescr *descr, int size)
Creates a new hash table for a certain descriptor and returns the hash description (lHash) for it. The initial size of the hashtable can be specified. This allows for optimization of the hashtable, as resize operations can be minimized when the final hashtable size is known at creation time, e.g. when copying complete lists.
const lDescr *descr - descriptor for the data field in a cull object. int size - initial size of hashtable will be 2^size
cull_htable - initialized hash description
cull_hash_create_hashtables() -- create all hashtables on a list
void cull_hash_create_hashtables(lList *lp)
Creates all hashtables for an empty list.
lList *lp - initialized list structure
If the list already contains elements, these elements are not inserted into the hash lists.
cull_hash_delete_non_unique_chain() -- del list of non unique obj.
void cull_hash_delete_non_unique_chain(cull_htable table, const void *key, const void **data)
For objects that are stored in a hash table with non unique keys, for each key a linked list of objects is created. This function deletes this linked list for each key in the hash table. It is designed to be called by the function sge_htable_for_each from the libuti hash implementation.
cull_htable table - hash table in which to delete/free a sublist const void *key - key of the list to be freed const void **data - pointer to the sublist
cull_hash_elem() -- insert cull object into associated hash tables
void cull_hash_elem(const lListElem *ep)
Insert the cull element ep into all hash tables that are defined for the cull list ep is member of.
const lListElem *ep - the cull object to be hashed
cull_hash_first() -- find first object for a certain key
lListElem* cull_hash_first(const lList *lp, const int pos, const void *key, const void **iterator)
Searches for key in the hash table for data field described by pos in the cull list lp. If an element is found, it is returned. If the hash table uses non unique hash keys, iterator returns the necessary data for consecutive calls of cull_hash_next() returning objects with the same hash key.
const lList *lp - the cull list to search const int pos - position of the data field for key const void *key - the key to use for the search const void **iterator - iterator for calls of cull_hash_next
lListElem* - first object found matching key, if no object found: NULL
cull_hash_free_descr() -- free the hash contents of a cull descr
void cull_hash_free_descr(lDescr *descr)
Frees the memory used by the hashing information in a cull descriptor (lDescr). If a hash table is still associated to the descriptor, it is also deleted.
lDescr *descr - descriptor to free
cull_hash_insert() -- insert a new element in a hash table
void cull_hash_insert(const lListElem *ep, const int pos)
Inserts ep into the hash list for data field at position pos. A hash key will be computed. The element will be inserted in the corresponding hash table considering unique/non unique hash storage.
const lListElem *ep - the cull object to be stored in a hash list const int pos - describes the data field of the objects that is to be hashed
cull_hash_new() -- create new hash table
int cull_hash_new(lList *lp, int nm, int unique)
Usually hash tables are defined in the object type definition for each object type in libs/gdi. There are cases where for a certain application additional hash tables shall be defined to speed up certain access methods. cull_hash_new can be used to create a hash table for a list on the contents of a certain field. The caller can choose whether the field contents have to be unique within the list or not.
lList *lp - the list to hold the new hash table int nm - the field on which to create the hash table bool unique - unique contents or not
int - 1 on success, else 0
create a non unique hash index on the job owner for a job list cull_hash_new(job_list, JB_owner, 0);
cull_hash_new() -- create new hash table, if it does not yet exist
int cull_hash_new_check(lList *lp, int nm, bool unique)
Usually hash tables are defined in the object type definition for each object type in libs/gdi. There are cases where for a certain application additional hash tables shall be defined to speed up certain access methods. cull_hash_new_check can be used to create a hash table for a list on the contents of a certain field. If it already exist, nothing is done. The caller can choose whether the field contents have to be unique within the list or not.
lList *lp - the list to hold the new hash table int nm - the field on which to create the hash table bool unique - unique contents or not
int - 1 on success, else 0
create a non unique hash index on the job owner for a job list cull_hash_new_check(job_list, JB_owner, false);
cull_hash_next() -- find next object matching a key
lListElem* cull_hash_next(const lList *lp, const int pos, const void *key, const void **iterator)
Returns the next object matching the same key as a previous call to cull_hash_first or cull_hash_next.
const lList *lp - the cull list to search const int pos - position of the data field for key const void *key - the key to use for the search const void **iterator - iterator to use for the search.
lListElem* - object if found, else NULL
The order in which objects with the same key are returned is not defined.
cull_hash_remove() -- remove a cull object from a hash list
void cull_hash_remove(const lListElem *ep, const int pos)
Removes ep from a hash table for data field specified by pos.
const lListElem *ep - the cull object to be removed const int pos - position of the data field
get_lerror_string() -- Error number to message translation
const char* get_lerror_string(int nr)
Error number to message translation
int nr - Error number
const char* - Error message
Cull-List-defines -- macros and constant definitions
#define FREE_ELEM (1<<0) #define BOUND_ELEM (1<<1) #define TRANS_BOUND_ELEM (1<<2) #define OBJECT_ELEM (1<<3)
The following definitions describe possible values for the status a list element (lListElem): FREE_ELEM - a list element not being part of a list or being a sub object BOUND_ELEM - a list element contained in a list. TRANS_BOUND_ELEM - temporary status while unpacking elements. After unpacking, bound elements or sub objects have this status to prevent errors from functions like lAppendElem, that reject bound objects. OBJECT_ELEM - a list element being subobject of another element
Field_Attributes -- Attributes of cull type fields
When a field of a cull object type is defined, any number of attributes can be given to the field. The syntax of the field definition is <typedef>(<field_name>, <attrib1> [|<attrib2> ...] e.g. SGE_STRING(QU_qname, CULL_HASH | CULL_UNIQUE) The following attributes can be given to a field: CULL_DEFAULT no special settings - default behaviour CULL_PRIMARY_KEY the field is part of the primary key does *not* imply uniqueness or hashing CULL_HASH a hash table will be created on the field for lists of the object type (non unique, unless explicitly specified by CULL_UNIQUE) CULL_UNIQUE the field value has to be unique for all objects in a list currently only used for the definition of hash tables, but it could be used for general consistency checks. CULL_JGDI_HIDDEN CULL_CONFIGURE the field can be changed by configuration functions not yet implemented CULL_SPOOL the field is spooled CULL_SUBLIST the field is spooled when the type is used as subtype in another type, but less fields shall be spooled, e.g. in the CE_TYPE: all fields are spooled if the complex variable definition is spooled, but only CE_name and CE_stringval are spooled when used as subtype, like in the complex_values of exec host or queue CULL_SPOOL_PROJECT deprecated? CULL_SPOOL_USER deprecated? CULL_JGDI_RO CULL_JGDI_CONF
Further attributes can be introduced as necessary, e.g. CULL_ARRAY - the field is an array of the specified data type
cull_state_set_????() - write access to cull state.
Provides access to thread local storage.
lAddList() -- Concatenate two lists
int lAddList(lList *lp0, lList **lp1)
Concatenate two lists of the same type, destroying the second list
lList *lp0 - first list lList **lp1 - second list
int - error state 0 - OK -1 - Error
MT-NOTE: lAddList() is MT safe
lAddSubList() -- Append a list to the sublist of an element
int lAddSubList(lListElem *ep, int nm, const lList *to_add)
Appends the list 'to_add' to the sublist 'nm' of the element 'ep'. The list pointer becomes invalid and the returned pointer should be used instead to access the complete sublist.
lListElem *ep - The CULL list element int nm - The CULL field name of a sublist const lList *to_add - The list to be added
lList * - Returns
MT-NOTE: lAddSubList() is MT safe
lAppendElem() -- Append element to a list
int lAppendElem(lList *lp, lListElem *ep)
Append element 'ep' to list 'lp'
lList *lp - list lListElem *ep - element
int - error state 0 - OK -1 - Error
MT-NOTE: lAppendElem() is MT safe
lAppendList() -- Concatenate two lists
int lAppendList(lList *lp0, lList *lp1)
Concatenate two lists of equal type without throwing away the second list
lList *lp0 - first list lList *lp1 - second list
int - error state 0 - OK -1 - Error
MT-NOTE: lAppendList() is MT safe
lCompListDescr() -- Compare two descriptors
int lCompListDescr(const lDescr *dp0, const lDescr *dp1)
Compare two descriptors
const lDescr *dp0 - descriptor one const lDescr *dp1 - descriptor two
int - Result of compare operation 0 - equivalent -1 - not equivalent
MT-NOTE: lCompListDescr() is MT safe
lCopyElem() -- Copies a whole list element
lListElem* lCopyElem(const lListElem *ep)
Copies a list element with all its sub-lists and strings.
const lListElem *ep - element
lListElem* - pointer to copy of 'ep', or NULL on error
lCopyElemHash() -- Copies a whole list element
lListElem* lCopyElemHash(const lListElem *ep, bool isHash)
Copies a whole list element
const lListElem *ep - element bool - generate hash or not
lListElem* - copy of 'ep'
lCopyElemPartialPack() -- Copies parts of an element
int lCopyElemPartialPack(lListElem *dst, int *jp, const lListElem *src, const lEnumeration *enp, bool isHash, sge_pack_buffer *pb)
Copies elements from list element 'src' to 'dst' using the enumeration 'enp' as a mask or copies all elements if 'enp' is NULL. Copying starts at index *jp. If pb is not NULL then the elements will be stored in the packbuffer 'pb' instead of being copied.
lListElem *dst - destination element int *jp - Where should the copy operation start const lListElem *src - src element const lEnumeration *enp - enumeration bool - generate hash or not sge_pack_buffer *pb - packbuffer
int - error state 0 - OK -1 - Error
lCopyList() -- Copy a list including strings and sublists
lList* lCopyList(const char *name, const lList *src)
Copy a list including strings and sublists. The new list will get 'name' as user defined name
const char *name - list name const lList *src - source list
lList* - Copy of 'src' or NULL
lCopyListHash() -- Copy a list including strings and sublists
lList* lCopyListHash(const char *name, const lList *src, bool isHash)
Copy a list including strings and sublists. The new list will get 'name' as user defined name
const char *name - list name const lList *src - source list bool hash - if set to true, a hash table is generated
lList* - Copy of 'src' or NULL
lCopySwitchPacPackk() -- Copy parts of elements indedendent from type
int lCopySwitchPack(const lListElem *sep, lListElem *dep, int src_idx, int dst_idx, bool isHash, sge_pack_buffer *pb)
Copies from the element 'sep' (using index 'src_idx') to the element 'dep' (using index 'dst_idx') in dependence of the type or it copies the it directly into pb.
const lListElem *sep - source element lListElem *dep - destination element int src_idx - source index int dst_idx - destination index bool isHash - create Hash or not lEnumeration *ep - enumeration oiter to be used for sublists sge_pack_buffer *pb - pack buffer
int - error state 0 - OK -1 - Error
lCreateElem() -- Create an element for a specific list
lListElem* lCreateElem(const lDescr *dp)
Create a new list element specified by the descriptor. All list element fields are set to zero.
const lDescr *dp - descriptor
lListElem* - element pointer or NULL
lCreateElemList() -- Create a list with n elements
lList* lCreateElemList(const char *listname, const lDescr *descr, int nr_elem)
Create a list with a given descriptor and insert 'nr_elem' only initialized elements
const char *listname - list name const lDescr *descr - descriptor int nr_elem - number of elements
lList* - list or NULL
lCreateList() -- Create an empty list
lList* lCreateList(const char *listname, const lDescr *descr)
Create an empty list with a given descriptor and a user defined listname.
const char *listname - list name const lDescr *descr - descriptor
lList* - list pointer, or NULL if one of the arguments is NULL, or if the descriptor contains no fields, or if an error occurs
lCreateList() -- Create an empty list
lList* lCreateList(const char *listname, const lDescr *descr, bool hash)
Create an empty list with a given descriptor and a user defined listname. The caller can choose whether hashtables shall be created or not.
const char *listname - list name const lDescr *descr - descriptor bool hash - shall hashtables be created?
lList* - list pointer or NULL
lDechainElem() -- Remove an element from a list
lListElem* lDechainElem(lList *lp, lListElem *ep)
Remove element 'ep' from list 'lp'. 'ep' is not deleted.
lList *lp - list lListElem *ep - element
lListElem* - dechained element or NULL
MT-NOTE: lDechainElem() is MT safe
lDechainList() -- splits a list into two at the given elem.
lListElem* lDechainList(lList *lp, lListElem *ep)
splits a list into two at the given elem. If no target list is given, new one is created, otherwise the splited list is appended to the second one.
lList *source - list lList **target - list lListElem *ep - element
MT-NOTE: lDechainList() is MT safe
lDechainObject() -- Remove a element from a list
lListElem* lDechainObject(lList *lp, int name)
Remove element 'ep' from list 'lp'. 'ep' gets not deleted.
lList *lp - list int name - attribute name
lListElem* - dechained element or NULL
lFindFirst() -- Returns first element of a list fulfilling a condition
lListElem* lFindFirst(const lList *slp, const lCondition *cp)
Returns the first element fulfilling the condition 'cp' or NULL if nothing is found. If the condition is NULL the first element is delivered.
const lList *slp - list const lCondition *cp - condition
lListElem* - element or NULL
lFindLast() -- Returns last element fulfilling a condition
lListElem* lFindLast(const lList *slp, const lCondition *cp)
Returns the last element fulfilling the condition 'cp' or NULL if nothing is found. If the condition is NULL then the last element is delivered.
const lList *slp - list const lCondition *cp - condition
lListElem* - element or NULL
lFindNext() -- Returns the next element fulfilling condition
lListElem* lFindNext(const lListElem *ep, const lCondition *cp)
Returns the next element fulfilling the condition 'cp' or NULL if nothing is found. If condition is NULL than the following element is delivered.
const lListElem *ep - element const lCondition *cp - condition
lListElem* - element or NULL
lFindPrev() -- Returns previous element fulfilling condition
lListElem* lFindPrev(const lListElem *ep, const lCondition *cp)
Returns the previous element fulfilling the condition 'cp' or NULL if nothing is found. If condition is NULL than the following element is delivered.
const lListElem *ep - element const lCondition *cp - condition
lListElem* - element or NULL
lFirst() -- Return the first element of a list
lListElem* lFirst(const lList *slp)
Return the first element of a list.
const lList *slp - list
lListElem* - first element or NULL
lFreeElem() -- Free a element including strings and sublists
void lFreeElem(lListElem **ep)
Free an element ep allocated by lCreateElem, including strings and sublists. Do nothing if ep is NULL.
lListElem **ep - element, will be set to NULL
MT-NOTE: lRemoveElem() is MT safe
lFreeList() -- Frees a list including all elements
void lFreeList(lList **lp)
Frees a list including all elements
lList **lp - list
void
MT-NOTE: lFreeList() is MT safe
lGetElemDescr() -- returns the descriptor of a list element
const lDescr* lGetElemDescr(const lListElem* ep)
returns the descriptor of a list element
lListElem* ep - CULL element
Pointer to descriptor
lGetElemIndex() -- returns the index of element in list lp
int lGetElemIndex(const lListElem* ep, const lList* lp)
returns the index of element in list lp
lListElem* ep - element lList* lp - list
index number
lGetListDescr() -- Returns the descriptor of a list
const lDescr* lGetListDescr(const lList *lp)
Returns the descriptor of a list
const lList *lp - list pointer
const lDescr* - destriptor
MT-NOTE: lGetListDescr() is MT safe
lGetListName() -- returns the user defined name of a list
const char* lGetListName(const lList *lp)
Returns the user defined name of a list.
const lList *lp - list pointer
const char* - list name
lGetNumberOfElem() -- Returns the number of elements in a list
int lGetNumberOfElem(const lList *lp)
Returns the number of elements in a list
const lList *lp - list pointer
int - number of elements
MT-NOTE: lGetNumberOfElem() is MT safe
lGetNumberOfRemainingElem() -- Number of following elements
int lGetNumberOfRemainingElem(const lListElem *ep)
Returns the number of elements behind an element
const lListElem *ep - element
int - number of elements
lInsertElem() -- Insert element after another in a list
int lInsertElem(lList *lp, lListElem *ep, lListElem *new)
Insert a 'new' element after element 'ep' into list 'lp'. If 'ep' is NULL then 'new' will be the first element in 'lp'.
lList *lp - list lListElem *ep - element lListElem *new - new element
int - error state 0 - OK -1 - Error
lLast() -- Returns the last element of a list
lListElem* lLast(const lList *slp)
Returns the last element of a list.
const lList *slp - list
lListElem* - last element or NULL
lListElem_clear_changed_info() -- clear changed info of an object
bool lListElem_clear_changed_info(lListElem *ep)
clears in an object the information, which fields have been changed. Recursively walks down sublists.
lListElem *ep - the list element to update
bool - true on success, else false
lList_clear_changed_info() -- clear changed info of a list
bool lList_clear_changed_info(lList *lp)
Clears in a list the information, if the list itself has been changed (objects added/removed) and which fields have changed in the lists objects.
lList *lp - the list to update
bool - true on success, else false
lModifyWhat() -- Copy parts of an element
int lModifyWhat(lListElem *dst, const lListElem *src, const lEnumeration *enp)
Copies elements from 'src' to 'dst' using the enumeration 'enp' as a mask or copies all elements if 'enp' is NULL
lListElem *dst - destination element const lListElem *src - source element const lEnumeration *enp - mask
int - error state 0 - OK -1 - Error
lNext() -- Returns the next element or NULL
lListElem* lNext(const lListElem *sep)
Returns the next element of 'sep' or NULL
const lListElem *sep - element
lListElem* - next element or NULL
lOverrideStrList() -- Merge two lists
int lOverrideStrList(lList *lp0, lList *lp1, int nm, const char *str)
Merge two lists of equal type, and replace values in the first list with values from the second list. This only applies to values equal str.
lList *lp0 - first list lList *lp1 - second list int nm - field name used for merging const char *str - override criteria, e.g. "-q" for "override all -q switches, all others are simply merged"
int - error state 0 - OK -1 - Error
MT-NOTE: lOverrideStrList() is MT safe
lPSortList() -- Sort a given list
int lPSortList(lList * lp, const char *fmt, ...)
Sort a given list. The sorting order is given by the format string and additional arguments.
lList * lp - list const char *fmt - format string (see lParseSortOrder()) ... - additional arguments (see lParseSortOrder())
int - error state 0 - OK -1 - Error
lPrev() -- Returns the previous element or NULL
lListElem* lPrev(const lListElem *sep)
Returns the previous element or NULL.
const lListElem *sep - element
lListElem* - previous element
lRemoveElem() -- Delete a element from a list
int lRemoveElem(lList *lp, lListElem *ep)
Remove element 'ep' from list 'lp'. 'ep' gets deleted.
lList *lp - list lListElem **ep - element, will be set to NULL
int - error state 0 - OK -1 - Error
MT-NOTE: lRemoveElem() is MT safe
lSortList() -- Sort list according to sort order object
int lSortList(lList *lp, const lSortOrder *sp)
Sort list according to sort order object.
lList *lp - list const lSortOrder *sp - sort order object
int - error state 0 - OK -1 - Error
lUniqHost() -- Uniq a host key list
int lUniqHost(lList *lp, int keyfield)
Uniq a hostname key list.
lList *lp - list int keyfield - host field
int - error state 0 - OK -1 - Error
lUniqStr() -- Uniq a string key list
int lUniqStr(lList *lp, int keyfield)
Uniq a string key list
lList *lp - list int keyfield - string field name id
int - error state 0 - OK -1 - Error
lWriteElem() -- Write a element to stderr
void lWriteElem(const lListElem *ep)
Write a list element to stderr with all its sub-lists
const lListElem *ep - element
lWriteElemTo() -- Write a element to file stream
void lWriteElemTo(const lListElem *ep, FILE *fp)
Write an element to a file with all its sub-lists
const lListElem *ep - element FILE *fp - file stream
lWriteList() -- Write a list to stderr
void lWriteList(const lList *lp)
Write a list to stderr
const lList *lp - list
lWriteListTo() -- Write a list to a file stream
void lWriteListTo(const lList *lp, FILE *fp)
Write a list to a file stream
const lList *lp - list FILE *fp - file stream
mt_do_hashing() -- is there hash access for a field
int mt_do_hashing(int mt)
Returns the information if hashing is active for a cull object field given the multitype attribute of a cull descriptor.
int mt - mt (multitype) struct element of a field descriptor
int - 1, if hashing is requested, else 0
mt_get_type() -- get data type for cull object field
int mt_get_type(int mt)
Returns the data type of a cull object field given the multitype attribute of a cull descriptor.
int mt - mt (multitype) struct element of a field descriptor
int - cull data type enum value (from _enum_lMultiType)
switch(mt_get_type(descr[i].mt)) { case lFloatT: ... }
MT-NOTE: mt_get_type() is MT safe
mt_is_unique() -- is the cull object field unique
int mt_is_unique(int mt)
Returns the information if a certain cull object field is unique within a cull list given the multitype attribute of a cull descriptor.
int mt - mt (multitype) struct element of a field descriptor
int - 1 = unique, 0 = not unique
if(mt_is_unique(descr[i].mt)) { // check for uniqueness before inserting new elemente into a list if(lGetElemUlong(....) != NULL) { WARNING((SGE_EVENT, MSG_DUPLICATERECORD....)); DRETURN(NULL); } }
_lGetPosInDescr() -- Returns position of a name in a descriptor
int _lGetPosInDescr(const lDescr *dp, int name)
Returns position of a name in a descriptor array. Does a full search in the descriptor even if the element is not a reduced element.
const lDescr *dp - descriptor int name - name
int - position or -1 if not found
lAddDouble() -- Adds a double offset to the double field
lAddDouble(lListElem *ep, int name, lDouble offset)
The 'offset' is added to the double field 'name' of the CULL element 'ep'.
lListElem *ep - element int name - field name id lDouble offset - the offset
int - error state 0 - OK -1 - Error
lAddElemHost() -- Adds a hostname to a hostname list
lListElem* lAddElemHost(lList **lpp, int nm, const char *str, const lDescr *dp)
Adds a hostname to a hostname list
lList **lpp - list reference int nm - hostname field id const char *str - new hostname const lDescr *dp - descriptor of new element
lListElem* - new element or NULL
lAddElemStr() -- adds a string to the string list
lListElem* lAddElemStr(lList **lpp, int nm, const char *str, const lDescr *dp)
This function adds a new element of type dp to the list referenced by lpp. The field nm will get the initial value str.
lList** lpp - list reference int nm - field id char* str - initial value lDescr* dp - Type of the object which will be added
lListElem* -
lAddElemUlong() -- adds a ulong to the ulong list
lListElem* lAddElemUlong(lList** lpp, int nm, lUlong val, const lDescr* dp)
Adds an new element to a list lpp where one field nm within the new element gets an initial value val
lList** lpp - list int nm - field in the new element which will get value val lUlong val - initial value for nm const lDescr* dp - type of the list (e.g. JB_Type)
NULL on error or pointer to the added element
lAddElemUlong64() -- adds a ulong64 to the ulong64 list
lListElem* lAddElemUlong64(lList** lpp, int nm, lUlong64 val, const lDescr* dp)
Adds an new element to a list lpp where one field nm within the new element gets an initial value val
lList** lpp - list int nm - field in the new element which will get value val lUlong64 val - initial value for nm const lDescr* dp - type of the list (e.g. JB_Type)
NULL on error or pointer to the added element
lAddSubHost() -- adds a string to the string sublist
lListElem* lAddSubHost(lListElem* ep, int nm, char* str, int snm, lDescr* dp)
This function add a new element into a sublist snm of an element ep. The field nm of this added element will get the initial value specified with str.
lListElem* ep - list element int nm - field id contained in the element which will be created char* str - initial value if nm int snm - field id of the sublist within ep lDescr* dp - Type of the new element
NULL in case of error otherwise pointer to the added element
lAddSubStr() -- adds a string to the string sublist
lListElem* lAddSubStr(lListElem* ep, int nm, char* str, int snm, lDescr* dp)
This function add a new element into a sublist snm of an element ep. The field nm of this added element will get the initial value specified with str.
lListElem* ep - list element int nm - field id contained in the element which will be created char* str - initial value if nm int snm - field id of the sublist within ep lDescr* dp - Type of the new element
NULL in case of error otherwise pointer to the added element
lAddSubUlong() -- adds ulong to the ulong sublist of element ep
lListElem* lAddSubUlong(lListElem* ep, int nm, lUlong val, int snm, const lDescr* dp)
This function adds a new element into the sublist snm of the element ep. The field nm of the added element will get the initial value val.
lListElem* ep - element int nm - field which will get value val lUlong val - initial value for nm int snm - sublist within ep where the element will be added const lDescr* dp - Type of the new element (e.g. JB_Type)
NULL in case of error or the pointer to the new element
lAddSubUlong64() -- adds ulong64 to the ulong64 sublist of element ep
lListElem* lAddSubUlong64(lListElem* ep, int nm, lUlong64 val, int snm, const lDescr* dp)
This function adds a new element into the sublist snm of the element ep. The field nm of the added element will get the initial value val.
lListElem* ep - element int nm - field which will get value val lUlong64 val - initial value for nm int snm - sublist within ep where the element will be added const lDescr* dp - Type of the new element (e.g. JB_Type)
NULL in case of error or the pointer to the new element
lAddUlong() -- Adds a lUlong offset to the lUlong field
int lAddUlong(lListElem *ep, int name, lUlong offset)
The 'offset' is added to the lUlong field 'name' of the CULL element 'ep'.
lListElem *ep - element int name - field name id lUlong offset - the offset
int -
int - error state 0 - OK -1 - Error
lAddUlong64() -- Adds a lUlong64 offset to the lUlong64 field
int lAddUlong64(lListElem *ep, int name, lUlong64 offset)
The 'offset' is added to the lUlong64 field 'name' of the CULL element 'ep'.
lListElem *ep - element int name - field name id lUlong64 offset - the offset
int -
int - error state 0 - OK -1 - Error
lCopyDescr() -- Copies a descriptor
lDescr* lCopyDescr(const lDescr *dp)
Returns a pointer to a copied descriptor, has to be freed by the user.
const lDescr *dp - descriptor
lDescr* - descriptor pointer or NULL in case of error
lCountDescr() -- Returns the size of a descriptor
int lCountDescr(const lDescr *dp)
Returns the size of a descriptor excluding lEndT Descr.
const lDescr *dp - pointer to descriptor
int - size or -1 on error
MT-NOTE: lCountDescr() is MT safe
lDelElemCaseStr() -- removes elem specified by a string field nm
int lDelElemCaseStr(lList** lpp, int nm, const char* str)
This function removes an element specified by nm and str from the list lpp. If the list does not contain elements after this operation, it will be deleted too.
lList** lpp - list int nm - field id of the element which should be removed const char* str - value of the attribute identified by nm
1 if the element was found and removed 0 in case of error
lDelElemHost() -- removes elem specified by a lHostT field nm
int lDelElemHost(lList** lpp, int nm, const char* str)
removes an element specified by a string field nm and the hostname str from the list referenced by lpp. If it is the last element within lpp the list itself will be deleted.
lList** lpp - list int nm - field id const char* str - string
1 if the host element was found and removed 0 in case of an error
lDelElemStr() -- removes element specified by a string field nm
int lDelElemStr(lList** lpp, int nm, const char* str)
This function removes an element from the list referenced by lpp, which is identified by the field nm and the string str
lList** lpp - list reference int nm - field id const char* str - string
1 if the element was found and removed 0 in case of an error
lDelElemUlong() -- removes elem specified by a ulong field nm
int lDelElemUlong(lList** lpp, int nm, lUlong val)
This function removes an element specified by a ulong field nm with the value val from the list referenced by lpp.
lList** lpp - reference to a list int nm - field id lUlong val - value if nm
1 element was found and removed 0 an error occurred
lDelElemUlong64() -- removes elem specified by a ulong64 field nm
int lDelElemUlong64(lList** lpp, int nm, lUlong64 val)
This function removes an element specified by a ulong64 field nm with the value val from the list referenced by lpp.
lList** lpp - reference to a list int nm - field id lUlong64 val - value if nm
1 element was found and removed 0 an error occurred
lDelSubCaseStr() -- removes elem specified by a string field nm
int lDelSubCaseStr(lListElem* ep, int nm, const char* str, int snm)
removes an element specified by a string field nm an a string str which is contained in the sublist snm of ep
lListElem* ep - element int nm - field id const char* str - string int snm - filed id of the element within element
1 if the element was found an removed 0 in case of error
lDelSubStr() -- removes an element from a sublist
int lDelSubStr(lListElem* ep, int nm, const char* str, int snm)
This function removes an element specified by a string field nm and the string str supposed to be in the sublist snm of the element ep.
lListElem* ep - element int nm - field id const char* str - string int snm - field id of a sublist of ep
1 element was found and removed 0 in case of an error
lDelSubUlong() -- removes an element from a sublist
int lDelSubUlong(lListElem* ep, int nm, lUlong val, int snm)
This function removes an element specified by a ulong field nm and the ulong val supposed to be in the sublist snm of the element ep
lListElem* ep - element int nm - field id lUlong val - value int snm - field id of the sublist in ep
1 element was found and removed 0 in case of an error
lDelSubUlong64() -- removes an element from a sublist
int lDelSubUlong64(lListElem* ep, int nm, lUlong64 val, int snm)
This function removes an element specified by a ulong field nm and the ulong64 val supposed to be in the sublist snm of the element ep
lListElem* ep - element int nm - field id lUlong64 val - value int snm - field id of the sublist in ep
1 element was found and removed 0 in case of an error
lGetBool() -- Returns the boolean value for a field name
lBool lGetBool(const lListElem *ep, int name)
Returns the boolean value for a field name
const lListElem *ep - element int name - field name
lBool - boolean
lGetChar() -- Returns the char value for a field name
lChar lGetChar(const lListElem *ep, int name)
Returns the char value for a field name
const lListElem *ep - element int name - field name
lChar - character
lGetDouble() -- Returns the double value for field name
lDouble lGetDouble(const lListElem *ep, int name)
Returns the double value for field name
const lListElem *ep - element int name - field name value
lDouble - double value
lGetElemCaseStr() -- returns element specified by a string field
lListElem* lGetElemCaseStr(const lList* lp, int nm, const char* str)
This functions returns an element specified by a string field nm and str from the list lp.
const lList* lp - Pointer to a list int nm - Constant specifying an attribute within an element of lp const char* str - string
NULL when element is not found or an error occurred otherwise the pointer to an element
lGetElemHost() -- returns an element specified by a hostname
lListElem* lGetElemHost(const lList* lp, int nm, const char* str)
returns an element specified by a string field nm and a hostname from the list lp
const lList* lp - Pointer to an element which contains a hostname int nm - host field containing the hostname const char* str - hostname
NULL when the list does not contain the element or in case of error otherwise pointer to an element
lGetElemHostFirst() -- lGetElemHostFirst for hostnames
lListElem* lGetElemHostFirst(const lList *lp, int nm, const char *str, const void **iterator)
lGetElemHostFirst for hostnames
const lList *lp - list int nm - hostname field id const char *str - hostname const void **iterator - iterator
lListElem* - element or NULL
lGetElemHostNext() -- lGetElemHostNext() for hostnames
lListElem* lGetElemHostNext(const lList *lp, int nm, const char *str, const void **iterator)
lGetElemHostNext() for hostnames
const lList *lp - list int nm - hostname field id const char *str - hostname const void **iterator - iterator
lListElem* - element or NULL
lGetElemStr() -- returns element specified by a string field nm
lListElem* lGetElemStr(const lList* lp, int nm, const char* str)
returns an element specified by a string field nm from list lp
const lList* lp - list int nm - field id const char* str - value
NULL when element was not found or if an error occurred otherwise pointer to element
lGetElemStrFirst() -- Find first element with a certain string
lListElem* lGetElemStrFirst(const lList *lp, int nm, const char *str, const void **iterator)
Returns the first element within 'lp' where the attribute with field name id 'nm' is equivalent with 'str'. 'iterator' will be filled with context information which will make it possible to use 'iterator' with lGetElemStrNext() to get the next element.
const lList *lp - list int nm - field name id const char *str - string to be compared const void **iterator - iterator
lListElem* - first element or NULL
lGetElemStrLike() -- returns element specified by a wildcard
lListElem* lGetElemStrLike(const lList* lp, int nm, const char* str)
returns an element specified by a string field nm from the list lp and uses a trailing '*' as a wildcard, e.g. 'OAport' matches 'OA*'
const lList* lp - list pointer int nm - field id const char* str - wildcard string
NULL if element was not found or in case of error otherwise pointer to element
lGetElemStrNext() -- Get next element with a certain string
lListElem* lGetElemStrNext(const lList *lp, int nm, const char *str, const void **iterator)
Returns a element within list 'lp' where the attribute with field name id 'nm' is equivalent with 'str'. The function uses 'iterator' as input. 'iterator' contains context information which where fillen in in a previous call of lGetElemStrFirst().
const lList *lp - list int nm - string field name id const char *str - string const void **iterator - iterator
lListElem* - next element or NULL
lGetElemUlong() -- returns element specified by a ulong field nm
lListElem* lGetElemUlong(const lList* lp, int nm, lUlong val)
returns an element specified by a ulong field nm an an ulong value val from list lp
const lList* lp - list pointer int nm - field id lUlong val - unsigned long value
NULL if element was not found or an error occurred otherwise pointer to element
lGetElemUlong64() -- returns element specified by a ulong64 field nm
lListElem* lGetElemUlong64(const lList* lp, int nm, lUlong64 val)
returns an element specified by a ulong64 field nm an an ulong64 value val from list lp
const lList* lp - list pointer int nm - field id lUlong64 val - unsigned long value
NULL if element was not found or an error occurred otherwise pointer to element
lGetElemUlong64First() -- Find first ulong64 within a list
lListElem* lGetElemUlong64First(const lList *lp, int nm, lUlong64 val, const void **iterator)
Return the first element of list 'lp' where the attribute with field name id 'nm' is equivalent with 'val'. Context information will be stored in 'iterator'. 'iterator' might be used in lGetElemUlong64Next() to get the next element.
const lList *lp - list int nm - ulong64 field name id lUlong64 val - ulong64 value const void **iterator - iterator
lListElem* - element or NULL
lGetElemUlong64Next() -- Find next ulong64 element within a list
lListElem* lGetElemUlong64Next(const lList *lp, int nm, lUlong64 val, const void **iterator)
This function might be used after a call to lGetElemUlong64First(). It expects 'iterator' to contain context information which makes it possible to find the next element within list 'lp' where the attribute with field name id 'nm' is equivalent with 'val'.
const lList *lp - list int nm - ulong64 field name id lUlong64 val - value const void **iterator - iterator
lListElem* - next element or NULL
lGetElemUlongFirst() -- Find first ulong within a list
lListElem* lGetElemUlongFirst(const lList *lp, int nm, lUlong val, const void **iterator)
Return the first element of list 'lp' where the attribute with field name id 'nm' is equivalent with 'val'. Context information will be stored in 'iterator'. 'iterator' might be used in lGetElemUlongNext() to get the next element.
const lList *lp - list int nm - ulong field anme id lUlong val - ulong value const void **iterator - iterator
lListElem* - element or NULL
lGetElemUlongNext() -- Find next ulong element within a list
lListElem* lGetElemUlongNext(const lList *lp, int nm, lUlong val, const void **iterator)
This function might be used after a call to lGetElemUlongFirst(). It expects 'iterator' to contain context information which makes it possible to find the next element within list 'lp' where the attribute with field name id 'nm' is equivalent with 'val'.
const lList *lp - list int nm - ulong field name id lUlong val - value const void **iterator - iterator
lListElem* - next element or NULL
lGetFloat() -- Returns float value for field name
lFloat lGetFloat(const lListElem *ep, int name)
Returns float value for field name
const lListElem *ep - element int name - field name
lFloat - float
lGetHost() -- Return hostname string for specified field
const char* lGetHost(const lListElem *ep, int name)
This procedure returns the hostname string for the field name, but doesn't copy the string (runtime type checking)
const lListElem *ep - list element pointer int name - name of list element
const char* - value of list entry
lGetInt() -- Returns the int value for field name
lInt lGetInt(const lListElem *ep, int name)
Returns the int value for field name
const lListElem *ep - element int name - field name id
lInt - int
lGetList() -- Returns the CULL list for a field name
lList* lGetList(const lListElem *ep, int name)
Returns the CULL list for a field name
const lListElem *ep - element int name - field name value
lList* - CULL list pointer
lGetLong() -- Returns the long value for a field name
lLong lGetLong(const lListElem *ep, int name)
Returns the long value for a field name
const lListElem *ep - element int name - name
lLong - long
lGetObject() -- Returns the CULL object for a field name
lListElem* lGetObject(const lListElem *ep, int name)
Returns the CULL object for a field name
const lListElem *ep - element int name - field name value
lListElem* - CULL list element pointer
lGetOrCreateList() -- Returns the CULL list for a field name
lList* lGetOrCreateList(lListElem *ep, int name, const char *list_name, const lDescr *descr)
Returns the CULL list for a field name. If the list does not yet exist, create it.
lListElem *ep - element int name - field name value const char *list_name - list name for list creation const lDescr *descr - descriptor for list creation
lList* - CULL list pointer
MT-NOTE: lGetOrCreateList() is MT safe
lGetPosBool() -- Returns the boolean value at position pos
lChar lGetPosBool(const lListElem *ep, int pos)
Returns the boolean value at position pos
const lListElem *ep - element int pos - position
lBool - boolean
lGetPosChar() -- Returns the char value at position pos
lChar lGetPosChar(const lListElem *ep, int pos)
Returns the char value at position pos
const lListElem *ep - element int pos - position
lChar - character
lGetPosDouble() -- Returns a double value at pos
lDouble lGetPosDouble(const lListElem *ep, int pos)
Returns a double value at pos
const lListElem *ep - element int pos - pos
lDouble - double value
lGetPosFloat() -- Returns the float value at position pos
lFloat lGetPosFloat(const lListElem *ep, int pos)
Returns the float value at position pos
const lListElem *ep - element int pos - position
lFloat - float
lGetPosHost() -- Returns the hostname value at position pos
const char* lGetPosHost(const lListElem *ep, int pos)
Returns the hostname value at position pos
const lListElem *ep - element int pos - position
const char* - Hostname
lGetPosInDescr() -- Returns position of a name in a descriptor
int lGetPosInDescr(const lDescr *dp, int name)
Returns position of a name in a descriptor array
const lDescr *dp - descriptor int name - name
int - position or -1 if not found
lGetPosInt() -- Returns the int value at position
lInt lGetPosInt(const lListElem *ep, int pos)
Returns the int value at position 'pos'
const lListElem *ep - element pointer int pos - position id
lInt - int
lGetPosList() -- Returns the CULL list at position pos (no copy)
lList* lGetPosList(const lListElem *ep, int pos)
Returns the CULL list at position pos (no copy)
const lListElem *ep - element int pos - pos value
lList* - CULL list pointer
lGetPosLong() -- Returns the long value at position pos
lLong lGetPosLong(const lListElem *ep, int pos)
Returns the long value at position pos
const lListElem *ep - element int pos - position
lLong - long
lGetPosName() -- Returns name at position
int lGetPosName(const lDescr *dp, int pos)
Returns the name at specified position in a descriptor array. The Position must be inside the valid range of the descriptor. Returns NoName if descriptor is NULL or pos < 0.
const lDescr *dp - Descriptor int pos - Position
int - Name
lGetPosObject() -- Returns the CULL object at position pos (no copy)
lList* lGetPosObject(const lListElem *ep, int pos)
Returns the CULL object (list element) at position pos (no copy)
const lListElem *ep - element int pos - pos value
lListElem* - CULL list element pointer
lGetPosRef() -- Returns the reference at position pos
lRef lGetPosRef(const lListElem *ep, int pos)
Returns the reference at position pos
const lListElem *ep - element int pos - position
lRef - reference (pointer)
lGetPosString() -- Returns the string ptr value at position pos
const char* lGetPosString(const lListElem *ep, int pos)
Returns the char* value at position pos (runtime type checking)
const lListElem *ep - element int pos - pos value
const char* - string pointer
lGetPosType() -- Returns type at position
int lGetPosType(const lDescr *dp, int pos)
Returns the type at specified position in a descriptor array. The Position must be inside the valid range of the descriptor. Returns NoName if descriptor is NULL or pos < 0.
const lDescr *dp - Descriptor int pos - Position
int - Type
lGetPosUlong() -- Returns the ulong value at position pos
lUlong lGetPosUlong(const lListElem *ep, int pos)
Returns the ulong value at position pos
const lListElem *ep - element int pos - pos value
lUlong - ulong
lGetPosUlong64() -- Returns the ulong64 value at position pos
lUlong64 lGetPosUlong64(const lListElem *ep, int pos)
Returns the ulong64 value at position pos
const lListElem *ep - element int pos - pos value
lUlong64 - ulong64
lGetPosViaElem() -- Get Position of name within element
int lGetPosViaElem(const lListElem *element, int name, int do_abort)
Get Position of field 'name' within 'element'
const lListElem *element - element int name - field name id int do_abort - call do_abort if do_abort=1
int - position or -1 in case of an error
lGetRef() -- Returns the character for a field name
lRef lGetRef(const lListElem *ep, int name)
Returns the character for a field name
const lListElem *ep - element int name - field name value
lRef - reference
lGetString() -- Return string for specified fieldname
const char *lGetString(const lListElem *ep, int name)
Return the content of the field specified by fieldname 'name' of list element 'ep'. The type of the field 'name' has to be of type string.
const lListElem *ep - Pointer to list element int name - field name
const char* - string pointer (no copy)
lGetSubCaseStr() -- returns elem specified by a string field nm
lListElem* lGetSubCaseStr(const lListElem* ep, int nm, const char* str, int snm)
returns an element specified by a string field nm and a string str from a sublist snm of the element ep
const lListElem* ep - element pointer int nm - field within an element of the sublist const char* str - string int snm - field within ep which identifies the sublist
NULL if element was not found or in case of an error otherwise pointer to element
lGetSubHost() -- returns elem specified by a string field nm
lListElem* lGetSubHost(const lListElem* ep, int nm, const char* str, int snm)
returns an element specified by a string field nm and the hostname str from the sublist snm of the element ep
const lListElem* ep - element pointer int nm - field id within an sublist element of ep const char* str - hostname int snm - field id of a sublist in ep
NULL if element was not found or in case of error otherwise pointer to element
lGetSubStr() -- returns element specified by a string field nm
lListElem* lGetSubStr(const lListElem* ep, int nm, const char* str, int snm)
returns an element specified by a string field nm and the string str from the sublist snm of the element ep
const lListElem* ep - element pointer int nm - field id contained in an sublist element of ep const char* str - string int snm - field id contained in ep
NULL if element was not found or in case of an error otherwise pointer to an element
lGetSubUlong() -- Element specified by a ulong field nm
lListElem* lGetSubUlong(const lListElem* ep, int nm, lUlong val, int snm)
returns an element specified by a ulong field nm an the ulong value val from the sublist snm of the element ep
const lListElem* ep - element pointer int nm - field id which is part of a sublist element of ep lUlong val - unsigned long value int snm - field id of a list which is part of ep
NULL if element was not found or in case of an error otherwise pointer to the element
lGetSubUlong64() -- Element specified by a ulong64 field nm
lListElem* lGetSubUlong64(const lListElem* ep, int nm, lUlong64 val, int snm)
returns an element specified by a ulong64 field nm an the ulong64 value val from the sublist snm of the element ep
const lListElem* ep - element pointer int nm - field id which is part of a sublist element of ep lUlong64 val - unsigned long value int snm - field id of a list which is part of ep
NULL if element was not found or in case of an error otherwise pointer to the element
lGetType() -- Return type of field within descriptor
int lGetType(const lDescr *dp, int nm)
Return type of field within descriptor.
const lDescr *dp - descriptor int nm - field name id
int - Type id or lEndT
lGetUlong() -- Return 'u_long32' value for specified fieldname
lUlong lGetUlong(const lListElem *ep, int name)
Return the content of the field specified by fieldname 'name' of list element 'ep'. The type of the field 'name' has to be of type 'u_long32'.
const lListElem *ep - Pointer to list element int name - field name
lUlong - u_long32 value
lGetUlong64() -- Return 'u_long64' value for specified fieldname
lUlong64 lGetUlong64(const lListElem *ep, int name)
Return the content of the field specified by fieldname 'name' of list element 'ep'. The type of the field 'name' has to be of type 'u_long64'.
const lListElem *ep - Pointer to list element int name - field name
lUlong64 - u_long64 value
lInit() -- Initialize the mechanism for lNm2Str()
void lInit(const lNameSpace *namev)
Initialize the mechanism for lNm2Str()
const lNameSpace *namev - Namespace
lMt2Str() -- returns the string representation of a type id
char* lMt2Str(int mt)
returns the string representation of a type id
int mt - multitype id (e.g. lStringT)
char* - string representation of mt
lNm2Str() -- returns the string representation of a name id
char* lNm2Str(int nm)
Return the string representation of a name id
int nm - name id (e.g. CONF_name)
char* - string representation of id if the NameSpace has been initialized with lInit(). Otherwise "Nameindex = n" is returned, where n is replaced by the field number.
JG: TODO: Implementation is not really efficient. Could be improved by using a hash table that will be dynamically built as names are looked up.
lSetBool() -- Sets character with the given field name id
int lSetBool(lListElem * ep, int name, lBool value)
Sets character with the given field name id
lListElem * ep - element int name - field name id lBool value - new character
int - error state 0 - OK -1 - Error
lSetChar() -- Sets character with the given field name id
int lSetChar(lListElem * ep, int name, lChar value)
Sets character with the given field name id
lListElem * ep - element int name - field name id lChar value - new character
int - error state 0 - OK -1 - Error
lSetDouble() -- Set double value with given field name id
int lSetDouble(lListElem *ep, int name, lDouble value)
Set double value with given field name id
lListElem *ep - element int name - field name id lDouble value - new double value
int - error state 0 - OK -1 - Error
lSetFloat() -- Set float value with given field name id
int lSetFloat(lListElem * ep, int name, lFloat value)
Set float value with given field name id.
lListElem * ep - element int name - field name id lFloat value - new float value
int - error state 0 - OK -1 - Error
lSetHost() -- Set hostname for field name in element
int lSetHost(lListElem *ep, int name, const char *value)
Sets in the element ep for field name the char * value. Also duplicates the pointed to char array (runtime type checking)
lListElem *ep - list element pointer int name - name of list element (e.g. EH_name) const char *value - new value for list element
int - error state -1 - Error 0 - OK
lSetInt() -- Sets an int within an element
int lSetInt(lListElem *ep, int name, int value)
Sets an int within an element
lListElem *ep - element int name - field name id int value - new value
int - error state 0 - OK -1 - Error
lSetList() -- Sets a list at the given field name id
int lSetList(lListElem *ep, int name, lList *value)
Sets a list at the given field name id. List will not be copied.
lListElem *ep - element int name - field name id lList *value - new list pointer
int - error state 0 - OK -1 - Error
MT-NOTE: lAddSubList() is MT safe
lSetLong() -- Set long value with given field name id
int lSetLong(lListElem *ep, int name, lLong value)
Set long value with given field name id.
lListElem *ep - element int name - field name id lLong value - value
int - error state 0 - OK -1 - Error
lSetObject() -- Sets a list at the given field name id
int lSetObject(lListElem *ep, int name, lList *value)
Sets a list at the given field name id. List will not be copied.
lListElem *ep - element int name - field name id lList *value - new list pointer
int - error state 0 - OK -1 - Error
lSetPosBool() -- Sets the character a the given position
int lSetPosBool(lListElem *ep, int pos, lBool value)
Sets the character a the given position.
lListElem *ep - element int pos - position lBool value - value
int - error state 0 - OK -1 - Error
lSetPosChar() -- Sets the character a the given position
int lSetPosChar(lListElem *ep, int pos, lChar value)
Sets the character a the given position.
lListElem *ep - element int pos - position lChar value - value
int - error state 0 - OK -1 - Error
lSetPosDouble() -- Set double value at given position
int lSetPosDouble(lListElem *ep, int pos, lDouble value)
Set double value at given position.
lListElem *ep - element int pos - position lDouble value - new double value
int - error state 0 - OK -1 - Error
lSetPosFloat() -- Set float value at given position
int lSetPosFloat(lListElem * ep, int pos, lFloat value)
Set float value at given position.
lListElem * ep - element int pos - position lFloat value - new float value
int - error state 0 - OK -1 - Error
lSetPosHost() -- Sets the hostname at a certain position
int lSetPosHost(lListElem *ep, int pos, const char *value)
Sets the hostname at a certain position
lListElem *ep - element int pos - position const char *value - new hostname
int - error state 0 - OK -1 - Error
lSetPosInt() -- Sets the int value
int lSetPosInt(lListElem *ep, int pos, int value)
Sets in the element 'ep' at position 'pos' the int 'value'
lListElem *ep - element int pos - position int value - value
int - error state 0 - OK -1 - Error
lSetPosList() -- Set list at position pos
int lSetPosList(lListElem *ep, int pos, lList *value)
Sets in the element 'ep' at position 'pos' the lists 'value'. Doesn't copy the list. Does runtime type checking.
lListElem *ep - element int pos - position lList *value - value
int - error state 0 - OK -1 - Error
lSetPosLong() -- Set long value at given position
int lSetPosLong(lListElem *ep, int pos, lLong value)
Set long value at given position.
lListElem *ep - element int pos - position lLong value - new long value
int - error state 0 - OK -1 - Error
lSetPosObject() -- Set list element at position pos
int lSetPosObject(lListElem *ep, int pos, lListElem *value)
Sets in the element 'ep' at position 'pos' the list element 'value'. Doesn't copy the object. Does runtime type checking.
lListElem *ep - element int pos - position lListElem *value - value
int - error state 0 - OK -1 - Error
lSetPosRef() -- Set pointer at given position
int lSetPosRef(lListElem * ep, int pos, lRef value)
Set pointer at given position
lListElem * ep - element int pos - position lRef value - pointer
int - error state 0 - OK -1 - Error
lSetPosString() -- Sets the string at a certain position
int lSetPosString(lListElem *ep, int pos, const char *value)
Sets the string at a certain position.
lListElem *ep - element int pos - position const char *value - string value
int - error state 0 - OK -1 - Error
lSetPosUlong() -- Get ulong at a certain position
int lSetPosUlong(lListElem *ep, int pos, lUlong value)
Get ulong at a certain position
lListElem *ep - element int pos - position lUlong value - new value
int - error state 0 - OK -1 - Error
lSetPosUlong64() -- Get ulong64 at a certain position
int lSetPosUlong64(lListElem *ep, int pos, lUlong64 value)
Get ulong64 at a certain position
lListElem *ep - element int pos - position lUlong64 value - new value
int - error state 0 - OK -1 - Error
lSetRef() -- Set pointer with the given field name id
int lSetRef(lListElem * ep, int name, lRef value)
Set pointer with the given field name id
lListElem * ep - element int name - field name id lRef value - new pointer
int - error state 0 - OK -1 - Error
lSetString() -- Sets the string at the given field name id
int lSetString(lListElem *ep, int name, const char *value)
Sets the string at the given field name id
lListElem *ep - element int name - field name id const char *value - new string
int - error state 0 - OK -1 - Error
lSetUlong() -- Set ulong value at the given field name id
int lSetUlong(lListElem *ep, int name, lUlong value)
Set ulong value at the given field name id
lListElem *ep - element int name - field name id lUlong value - new value
int - error state 0 - OK -1 - Error
lSetUlong64() -- Set ulong value at the given field name id
int lSetUlong64(lListElem *ep, int name, lUlong64 value)
Set ulong64 value at the given field name id
lListElem *ep - element int name - field name id lUlong64 value - new value
int - error state 0 - OK -1 - Error
lStr2Nm() -- Returns the int representation of a name
int lStr2Nm(const char *str)
Returns the int representation of a name
const char *str - String
int - value
JG: TODO: Highly inefficient implementation, does tons of strcmp. Should have a hash table that will be extended whenever a new name has to be resolved.
lSwapList() -- Exchange two lists within two elements
int lSwapList(lListElem *to, int nm_to, lListElem *from, int nm_from)
Exchange two lists within two elements.
lListElem *to - element one int nm_to - field name id of a list attribute of 'to' lListElem *from - element two int nm_from - field name id of a list attribute of 'from'
int - error state 0 - OK -1 - Error
lWriteDescrTo() -- Writes a descriptor (for debugging purpose)
void lWriteDescrTo(const lDescr *dp, FILE *fp)
Writes a descriptor (for debugging purpose)
const lDescr *dp - descriptor FILE *fp - output stream
lXchgList() -- Exchange field name value list pointer
int lXchgList(lListElem *ep, int name, lList **lpp)
Exchange the list pointer which has the given field name value.
lListElem *ep - element int name - field name value lList **lpp - pointer to CULL list
int - error state 0 - OK -1 - Error
lXchgList() -- Exchange field name value string pointer
int lXchgString(lListElem *ep, int name, char **str)
Exchange the string pointer, which has the given field name value.
lListElem *ep - element int name - field name value char **str - pointer to a string
int - error state 0 - OK -1 - Error
CULL_Packing -- platform independent exchange format
The cull packing functions provide a framework for a platform independent data representation. Data is written into a packbuffer. Individual data words are written in network byte order. Data in the packbuffer can be compressed.
Other platform independent formats, like XML, should be implemented.
Versioncontrol -- handling of different cull versions
#define CULL_VERSION 0x10010000
Enhancements of the product may make it necessary to change the way how (in which format) data is represented for spooling and communication. To ensure that components of different cull versions, that cannot communicate, cleanly reject data of a different format, a cull version check has been implemented. A cull version id has been introduced that will be checked when cull packbuffers are read. Currently the 2 highest bytes of the 4 byte integer used to encode version information are used for a version number. The 2 lower bytes could be used to encode for example a subversion / subprotocol like cull binary format (the current implementation) and XML format.
Older Grid Engine versions that had no version controll cannot properly handle messages with version information. Therefore the version information is preceeded by a 0 value 4 byte integer, which will result in some sort of error handling for all known/used message formats. Current CULL_VERSION: 0x10020000 Fixed a bug with packing of lObject type: Descriptor was sent twice. Former CULL_VERSIONs: 0x10010000 Added information about attribute changes. 0x10000000 Introduction of version control.
getByteArray() -- transforms a string into a byte array.
int getByteArray(char **byte, const lListElem *elem, int name)
extracts a string from an element and changes it into a byte array. The target has to be a pointer to NULL. The array will be created in the function and no memory is freed. The calling functions have to take care of that.
char **byte - target byte array, has to be a pointer to NULL const lListElem *elem - the list element, which contains the string int name - name of the attribute containing the string
int - >= 0 the size of the byte array < 0 the position of the first none hex character
init_packbuffer() -- initialize packing buffer
int init_packbuffer(sge_pack_buffer *pb, int initial_size, int just_count)
Initialize a packing buffer. Allocates the necessary memory. If more memory is needed during the use of the packbuffer, it will be reallocated increasing the size by chunk_size (see function pack_set_chunk). Since version 6.0, version information is provided in the packbuffer and is included in sent messages. For best possible backward interoperability with former versions, an integer with value 0 is padded before the version information as first word in the packbuffer. This triggeres error handling in former versions. Functions using packing buffers in GDI or related code should use the function sge_gdi_packet_get_pb_size() to find the correct "initial_size".
sge_pack_buffer *pb - the packbuffer to initialize int initial_size - the amount of memory to be allocated at initialization. If a value of 0 is given as initial_size, a size of chunk_size (global variable, see function pack_set_chunk) will be used. int just_count - if true, no memory will be allocated and the "just_count" property of the packbuffer will be set.
int - PACK_SUCCESS on success PACK_ENOMEM if memory allocation fails PACK_FORMAT if no valid packbuffer is passed
MT-NOTE: init_packbuffer() is MT safe (assumptions)
packbitfield() -- pack a bitfield
int packbitfield(sge_pack_buffer *pb, const bitfield *bitfield)
Writes the bitfield into the given packbuffer. The following information will be written: - the size of the bitfield in bits - the bitfield itself as binary buffer
sge_pack_buffer *pb - the target packbuffer const bitfield *bitfield - the bitfield to pack
int - PACK_SUCCESS on success, else PACK_* error codes
pb_are_equivalent() -- check if both buffers are equivalent
bool pb_are_equivalent(sge_pack_buffer *pb1, sge_pack_buffer *pb2)
Check if size and content of both packbuffers is equivalent
sge_pack_buffer *pb1 - packbuffer sge_pack_buffer *pb2 - packbuffer
bool - equivalent? true - yes false - no
pb_print_to() -- Print content of packbuffer
void pb_print_to(sge_pack_buffer *pb, FILE* file)
Print content of packbuffer into file
sge_pack_buffer *pb - packbuffer pointer bool only_header - show only summary information FILE* file - file stream (e.g. stderr)
void - NONE
setByteArray() -- takes a byte array, transformes it into ASCII and sets it as a string into an element
void setByteArray(const char *byteArray, int size, lListElem *elem, int name)
makes a string out of a byte array and sets that string into an element
const char *byteArray - byte array int size - size of the byte array lListElem *elem - target element int name - target attribute
void - nothing
unpackbitfield() -- unpack a bitfield
int unpackbitfield(sge_pack_buffer *pb, bitfield *bitfield)
Unpacks a bitfield from a packbuffer. If the size of the descriptor doesn't match the size of the unpacked bitfield, create a new bitfield.
sge_pack_buffer *pb - the source packbuffer bitfield *bitfield - used to return the unpacked bitfield int descr_size - size of the corresponding descriptor
int - PACK_SUCCESS on success, else PACK_* error codes
lParseSortOrder() -- Creates a sort order array
lSortOrder* lParseSortOrder(const lDescr *dp, const char *fmt, va_list ap)
Create a sort oder array due to the given va_list.
const lDescr *dp - descriptor const char *fmt - format string with syntax %I{+|-} [%I{+|-}...] where %I stands for the field and +/- stands for ascending/descending sorting order va_list ap - Attributes within descriptor
lSortOrder* - sort order array
lParseSortOrder(dp,"%I+ %I-", H_hostname, H_memsize ) Returns a sort order array which can be used for sorting an list with ascending H_hostname and descending H_memsize.
cull_once_init() -- One-time CULL initialization.
static cull_once_init(void)
Create access key for thread local storage. Register cleanup function. This function must be called exactly once.
void - none
void - none
MT-NOTE: cull_once_init() is MT safe.
cull_state_destroy() -- Free thread local storage
static void cull_state_destroy(void* theState)
Free thread local storage.
void* theState - Pointer to memory which should be freed.
static void - none
MT-NOTE: cull_state_destroy() is MT safe.
cull_state_get_????() - read access to cull state.
Provides access to thread local storage.
cull_state_getspecific() -- Get thread local cull state
static cull_state_t* cull_state_getspecific(pthread_key_t aKey)
Return thread local cull state. If a given thread does call this function for the first time, no thread local cull state is available for this particular thread. In this case the thread local cull state is allocated and set.
pthread_key_t aKey - Key for thread local cull state
static cull_state_t* - Pointer to thread local cull state
MT-NOTE: cull_state_getspecific() is MT safe
cull_state_init() -- Initialize CULL state.
static void cull_state_init(cull_state_t *theState)
Initialize CULL state.
struct cull_state_t* theState - Pointer to CULL state structure.
static void - none
MT-NOTE: cull_state_init() is MT safe.
lGetNumberOfLeafs() -- Returns the number of leaves
int lGetNumberOfLeafs(const lListElem *ep, const lList *lp, int nm)
Returns the number of leaves
const lListElem *ep - element const lList *lp - list int nm - field name if within ep
int - number of leaves
lGetNumberOfNodes() -- Number of elements and subelements
int lGetNumberOfNodes(const lListElem *ep, const lList *lp, int nm)
Returns the number of elements and subelements in the sublist 'nm' of the element 'ep' (lp = NULL) or returns the sum of all elements and subelements within the list 'lp' (ep = NULL)
const lListElem *ep - element const lList *lp - list int nm - field name id within element
int - number of elements
lCopyWhat() -- Copy a enumeration array
lEnumeration* lCopyWhat(const lEnumeration *ep)
Copy a enumeration array
const lEnumeration *ep - enumeration
lEnumeration* - new copy of enumeration
lCountWhat() -- Returns size of enumeration
int lCountWhat(const lEnumeration *enp, const lDescr *dp)
Returns size (number of fields) of enumeration
const lEnumeration *enp - enumeration const lDescr *dp - descriptor
int - number of fields in enumeration, or -1 if one of the arguments is NULL
lFreeWhat() -- Frees a enumeration array
void lFreeWhat(lEnumeration **ep)
Frees an enumeration array ep. Does nothing if it is null.
lEnumeration **ep - enumeration, will be set to NULL
lIntVector2What() -- Create a enumeration from int array
lEnumeration* lIntVector2What(const lDescr *dp, const int intv[])
Create a enumeration from int array
const lDescr *dp - descriptor const int intv[] - int array
lEnumeration* - enumeration
lReduceDescr() -- Reduce a descriptor
int lReduceDescr(lDescr **dst_dpp, lDescr *src_dp, lEnumeration *enp)
Makes a new descriptor in 'dst_dpp' that contains only those fields from 'src_dp' that are in 'enp'.
lDescr **dst_dpp - destination for reduced descriptor lDescr *src_dp - source descriptor lEnumeration *enp - condition
int - error state 0 - OK -1 - Error
lWhat() -- Create a new field enumeration structure
lEnumeration *lWhat(const char *fmt, ...)
Create a new enumeration described by 'fmt'
const char *fmt - format string: Syntax: element := type "(" attribute_list ")" . type := "%T" . attribute_list := "ALL" | "NONE" | attributes ")" . attributes = { "%I" | "%I" "->" element } . where: %T specifies the descriptor type attribute_list, ALL fields, no fields, or the fields described by attributes; "->" selects a sub-element ... - variable list of arguments corresponding to the % placeholders
fmt: 1) "%T(NONE)" 2) "%T(ALL)" 3) "%T(%I%I)" 4) "%T(%I%I->%T(%I%I))" varargs corresponding to examples above: 1) JB_Type 2) JB_Type 3) JB_Type, JB_job_number, JB_ja_tasks 4) JB_Type, JB_job_number, JB_ja_tasks, JAT_Type, JAT_task_number, JAT_status
lEnumeration* - new enumeration
"%I" is equivalent to "%I->%T(ALL)" "" is NOT equivalent to "%I->%T(NONE)"
lWhatAll() -- Creates a enumeration array requesting all elements.
lEnumeration* lWhatAll()
Creates a enumeration array that requests complete elements of whatever typed list. This is a shortcut for lWhat("%T(ALL)", <List_type>)), cause for all the descriptor is not needed anyway, it is available from the list itself.
lEnumeration* - enumeration
lWriteWhatTo() -- Writes a enumeration array to a file stream
void lWriteWhatTo(const lEnumeration *ep, FILE *fp)
Writes a enumeration array to a file stream
const lEnumeration *ep - enumeration FILE *fp - file stream
lWriteWhatToDString() -- Write enumeration to dynamic string
void lWriteWhatToDString(const lEnumeration *ep, dstring *buffer)
Write enumeration to dynamic string
const lEnumeration *ep - enumeration dstring *buffer - dynmaic string
void - NONE
nm_set() -- Build an int vector
void nm_set(int job_field[], int nm)
Build an int vector as used by lIntVector2What()
int job_field[] - int vector int nm - field name id
lAndWhere() -- Combines two conditions with an AND
lCondition* lAndWhere(const lCondition *cp0, const lCondition *cp1)
Combines the conditions 'cp0' and 'cp1' with an logical AND.
const lCondition *cp0 - first condition const lCondition *cp1 - second condition
lCondition* - 'cp0' AND 'cp1'
lCompare() -- Decide if a element suffices a condition
int lCompare(const lListElem *ep, const lCondition *cp)
Decide if a element suffices a condition.
const lListElem *ep - element const lCondition *cp - condition
int - result 0 - false 1 - true
lCopyWhere() -- Copy a condition
lCondition* lCopyWhere(const lCondition *cp)
Copy a condition.
const lCondition *cp - condition
lCondition* - Copy of 'cp'
lFreeWhere() -- Free a condition
lFreeWhere(lCondition **cp)
Free a condition.
lCondition **cp - condition, will be set to NULL
lOrWhere() -- Combines two conditions with an OR
lCondition* lOrWhere(const lCondition *cp0, const lCondition *cp1)
Combines the conditions 'cp0' and 'cp1' logically with an OR
const lCondition *cp0 - first condition const lCondition *cp1 - second condition
lCondition* - cp0 OR cp1
lWhere() -- Creates a condition tree
lCondition* lWhere(const char *fmt, ...)
Creates a condition tree. The condition is stated as a format string and an associated list of additional parameters.
const char *fmt - format string Syntax: cond: type "(" negsimple [logop {negsimple | "%I" "->" cond } ] ")" type: "%T" negsimple: {simple | "!" "(" simple ")" } simple: "%I" relop valuetype [logop simple ...] logop: {"&&" | "||"} relop: { "<" | ">" | "==" | "!=" | "<=" | ">=" | "m=" | "c=" | "p=" | "h=" } valuetype: { "%d" | "%s" | "%u" | "%f" | "%g" | "%o" | "%c" } The logop operators mean: && logical and || logical or ! logical not The relop specifiers have the following meaning: < comparison of numeric types as in the C language > <= >= == != == case sensitive comparison of strings c= case insensitive comparison of strings m= bitmask evaluation operator p= pattern matching string comparison h= host matching string comparison For valuetype the specifiers represent in the order above: { int | string | unsigned long | float | double | long | char } ... - additional arguments corresponding to fmt placeholders
where1 = lWhere("%T(%I==%s && %I->%T(%I<%d || %I>%u || %I m= %u ))", type1, field1, "Hello", field2, subtype, subfield1, 12, subfield2, 34, bitmasksubfield, IDLE | RUNNING); where2 = lWhere( "%T(!(%I==%s))", type1, field1, "Hello"); The condition 'where1' says: field1 of list element with descriptor type1 must contain "Hello" AND the sub-list stored in field2 with descriptor subtype has a field subfield1 and subfield2 shall fulfil subfield1 < 12 OR subfield2 > 34 OR in the bitmasksubfield the bits for RUNNING and IDLE are set. Bitmasks are stored in an unsigned long (ulong_32). The condition 'where2' says: NOT ( field1 == "Hello" ) for field1 of a list with descriptor type1. _lWhere is equivalent to lWhere concerning the format string describing the condition. The variable argument list of lWhere is replaced by an array of arguments delivering the required information. The WhereArg struct is built as follows: struct _WhereArg { lDescr *descriptor; int field; lMultitype *value; }; The translation of the varargs lWhere functionality to the WhereArgList mechanism is shown below: where = lWhere("%T( %I == %s && %I -> %T ( %I < %d ) )", QueueT, Q_hostname, "durin.q", Q_ownerlist, OwnerT, O_ownerage, 22); The corresponding WhereArgList is: WhereArg whereargs[20]; whereargs[0].descriptor = QueueT; whereargs[1].field = Q_hostname; whereargs[1].value.str = "durin.q"; whereargs[2].field = Q_ownerlist; whereargs[2].descriptor = OwnerT; whereargs[3].field = O_ownerage; whereargs[3].value.i = 22; where = _lWhere("%T( %I == %s && %I -> %T ( %I < %d ) )", whereargs);
lCondition* - new condition; NULL means all elements will match
lWriteWhereTo() -- Write a condition struct to file stream.
void lWriteWhereTo(const lCondition *cp, FILE *fp)
Write a condition struct to file stream.
const lCondition *cp - condition FILE *fp - file stream
--CULL_Hashtable
: cull hash --CULL_Hashtable--CULL_Packing
: cull pack --CULL_Packing-Cull-List-defines
: cull list -Cull-List-defines-CULL_Hashtable_Defines
: cull hash -CULL_Hashtable_Defines-CULL_Hashtable_Typedefs
: cull hash -CULL_Hashtable_Typedefs-Field_Attributes
: cull list -Field_Attributes-Versioncontrol
: cull pack -Versioncontrol_lGetPosInDescr
: cull multitype _lGetPosInDescrcull_hash_create
: cull hash cull_hash_createcull_hash_create_hashtables
: cull hash cull_hash_create_hashtablescull_hash_delete_non_unique_chain
: cull hash cull_hash_delete_non_unique_chaincull_hash_elem
: cull hash cull_hash_elemcull_hash_first
: cull hash cull_hash_firstcull_hash_free_descr
: cull hash cull_hash_free_descrcull_hash_insert
: cull hash cull_hash_insertcull_hash_new
: cull hash cull_hash_newcull_hash_new_check
: cull hash cull_hash_new_checkcull_hash_next
: cull hash cull_hash_nextcull_hash_remove
: cull hash cull_hash_removecull_once_init
: cull state cull_once_initcull_state_destroy
: cull state cull_state_destroycull_state_get_
: cull state cull_state_get_cull_state_getspecific
: cull state cull_state_getspecificcull_state_init
: cull state cull_state_initcull_state_set_
: cull list cull_state_set_get_lerror_string
: cull lerrno get_lerror_stringgetByteArray
: cull pack getByteArrayinit_packbuffer
: cull pack init_packbufferlAddDouble
: cull multitype lAddDoublelAddElemHost
: cull multitype lAddElemHostlAddElemStr
: cull multitype lAddElemStrlAddElemUlong
: cull multitype lAddElemUlonglAddElemUlong64
: cull multitype lAddElemUlong64lAddList
: cull list lAddListlAddSubHost
: cull multitype lAddSubHostlAddSubList
: cull list lAddSubListlAddSubStr
: cull multitype lAddSubStrlAddSubUlong
: cull multitype lAddSubUlonglAddSubUlong64
: cull multitype lAddSubUlong64lAddUlong
: cull multitype lAddUlonglAddUlong64
: cull multitype lAddUlong64lAndWhere
: cull where lAndWherelAppendElem
: cull list lAppendElemlAppendList
: cull list lAppendListlCompare
: cull where lComparelCompListDescr
: cull list lCompListDescrlCopyDescr
: cull multitype lCopyDescrlCopyElem
: cull list lCopyElemlCopyElemHash
: cull list lCopyElemHashlCopyElemPartialPack
: cull list lCopyElemPartialPacklCopyList
: cull list lCopyListlCopyListHash
: cull list lCopyListHashlCopySwitchPack
: cull list lCopySwitchPacklCopyWhat
: cull what lCopyWhatlCopyWhere
: cull where lCopyWherelCountDescr
: cull multitype lCountDescrlCountWhat
: cull what lCountWhatlCreateElem
: cull list lCreateElemlCreateElemList
: cull list lCreateElemListlCreateList
: cull list lCreateListlCreateListHash
: cull list lCreateListHashlDechainElem
: cull list lDechainElemlDechainList
: cull list lDechainListlDechainObject
: cull list lDechainObjectlDelElemCaseStr
: cull multitype lDelElemCaseStrlDelElemHost
: cull multitype lDelElemHostlDelElemStr
: cull multitype lDelElemStrlDelElemUlong
: cull multitype lDelElemUlonglDelElemUlong64
: cull multitype lDelElemUlong64lDelSubCaseStr
: cull multitype lDelSubCaseStrlDelSubStr
: cull multitype lDelSubStrlDelSubUlong
: cull multitype lDelSubUlonglDelSubUlong64
: cull multitype lDelSubUlong64lDiffListStr
: cull db lDiffListStrlDumpDescr
: cull dump_scan lDumpDescrlDumpElem
: cull dump_scan lDumpElemlDumpElemFp
: cull dump_scan lDumpElemFplDumpList
: cull dump_scan lDumpListlDumpObject
: cull dump_scan lDumpObjectlFindFirst
: cull list lFindFirstlFindLast
: cull list lFindLastlFindNext
: cull list lFindNextlFindPrev
: cull list lFindPrevlFirst
: cull list lFirstlFreeElem
: cull list lFreeElemlFreeList
: cull list lFreeListlFreeWhat
: cull what lFreeWhatlFreeWhere
: cull where lFreeWherelGetBool
: cull multitype lGetBoollGetChar
: cull multitype lGetCharlGetDouble
: cull multitype lGetDoublelGetElemCaseStr
: cull multitype lGetElemCaseStrlGetElemDescr
: cull list lGetElemDescrlGetElemHost
: cull multitype lGetElemHostlGetElemHostFirst
: cull multitype lGetElemHostFirstlGetElemHostNext
: cull multitype lGetElemHostNextlGetElemIndex
: cull list lGetElemIndexlGetElemStr
: cull multitype lGetElemStrlGetElemStrFirst
: cull multitype lGetElemStrFirstlGetElemStrLike
: cull multitype lGetElemStrLikelGetElemStrNext
: cull multitype lGetElemStrNextlGetElemUlong
: cull multitype lGetElemUlonglGetElemUlong64
: cull multitype lGetElemUlong64lGetElemUlong64First
: cull multitype lGetElemUlong64FirstlGetElemUlong64Next
: cull multitype lGetElemUlong64NextlGetElemUlongFirst
: cull multitype lGetElemUlongFirstlGetElemUlongNext
: cull multitype lGetElemUlongNextlGetFloat
: cull multitype lGetFloatlGetHost
: cull multitype lGetHostlGetInt
: cull multitype lGetIntlGetList
: cull multitype lGetListlGetListDescr
: cull list lGetListDescrlGetListName
: cull list lGetListNamelGetLong
: cull multitype lGetLonglGetNumberOfElem
: cull list lGetNumberOfElemlGetNumberOfLeafs
: cull tree lGetNumberOfLeafslGetNumberOfNodes
: cull tree lGetNumberOfNodeslGetNumberOfRemainingElem
: cull list lGetNumberOfRemainingElemlGetObject
: cull multitype lGetObjectlGetOrCreateList
: cull multitype lGetOrCreateListlGetPosBool
: cull multitype lGetPosBoollGetPosChar
: cull multitype lGetPosCharlGetPosDouble
: cull multitype lGetPosDoublelGetPosFloat
: cull multitype lGetPosFloatlGetPosHost
: cull multitype lGetPosHostlGetPosInDescr
: cull multitype lGetPosInDescrlGetPosInt
: cull multitype lGetPosIntlGetPosList
: cull multitype lGetPosListlGetPosLong
: cull multitype lGetPosLonglGetPosName
: cull multitype lGetPosNamelGetPosObject
: cull multitype lGetPosObjectlGetPosRef
: cull multitype lGetPosReflGetPosString
: cull multitype lGetPosStringlGetPosType
: cull multitype lGetPosTypelGetPosUlong
: cull multitype lGetPosUlonglGetPosUlong64
: cull multitype lGetPosUlong64lGetPosViaElem
: cull multitype lGetPosViaElemlGetRef
: cull multitype lGetReflGetString
: cull multitype lGetStringlGetSubCaseStr
: cull multitype lGetSubCaseStrlGetSubHost
: cull multitype lGetSubHostlGetSubStr
: cull multitype lGetSubStrlGetSubUlong
: cull multitype lGetSubUlonglGetSubUlong64
: cull multitype lGetSubUlong64lGetType
: cull multitype lGetTypelGetUlong
: cull multitype lGetUlonglGetUlong64
: cull multitype lGetUlong64lInit
: cull multitype lInitlInsertElem
: cull list lInsertElemlIntVector2What
: cull what lIntVector2WhatlJoin
: cull db lJoinlJoinCopyElem
: cull db lJoinCopyElemlJoinDescr
: cull db lJoinDescrlJoinSublist
: cull db lJoinSublistlLast
: cull list lLastlList_clear_changed_info
: cull list lList_clear_changed_infolListElem_clear_changed_info
: cull list lListElem_clear_changed_infolModifyWhat
: cull list lModifyWhatlMt2Str
: cull multitype lMt2StrlNext
: cull list lNextlNm2Str
: cull multitype lNm2StrlOrWhere
: cull where lOrWherelOverrideStrList
: cull list lOverrideStrListlParseSortOrder
: cull sort lParseSortOrderlPartialDescr
: cull db lPartialDescrlPrev
: cull list lPrevlPSortList
: cull list lPSortListlReadElemFromDisk
: cull file lReadElemFromDisklReduceDescr
: cull what lReduceDescrlRemoveElem
: cull list lRemoveElemlSelect
: cull db lSelectlSelectDestroy
: cull db lSelectDestroylSelectDPack
: cull db lSelectDPacklSelectElemDPack
: cull db lSelectElemDPacklSelectElemPack
: cull db lSelectElemPacklSelectHashPack
: cull db lSelectHashPacklSetBool
: cull multitype lSetBoollSetChar
: cull multitype lSetCharlSetDouble
: cull multitype lSetDoublelSetFloat
: cull multitype lSetFloatlSetHost
: cull multitype lSetHostlSetInt
: cull multitype lSetIntlSetList
: cull multitype lSetListlSetLong
: cull multitype lSetLonglSetObject
: cull multitype lSetObjectlSetPosBool
: cull multitype lSetPosBoollSetPosChar
: cull multitype lSetPosCharlSetPosDouble
: cull multitype lSetPosDoublelSetPosFloat
: cull multitype lSetPosFloatlSetPosHost
: cull multitype lSetPosHostlSetPosInt
: cull multitype lSetPosIntlSetPosList
: cull multitype lSetPosListlSetPosLong
: cull multitype lSetPosLonglSetPosObject
: cull multitype lSetPosObjectlSetPosRef
: cull multitype lSetPosReflSetPosString
: cull multitype lSetPosStringlSetPosUlong
: cull multitype lSetPosUlonglSetPosUlong64
: cull multitype lSetPosUlong64lSetRef
: cull multitype lSetReflSetString
: cull multitype lSetStringlSetUlong
: cull multitype lSetUlonglSetUlong64
: cull multitype lSetUlong64lSortList
: cull list lSortListlSplit
: cull db lSplitlStr2Nm
: cull multitype lStr2NmlString2List
: cull db lString2ListlString2ListNone
: cull db lString2ListNonelSwapList
: cull multitype lSwapListlUndumpDescr
: cull dump_scan lUndumpDescrlUndumpElem
: cull dump_scan lUndumpElemlUndumpElemFp
: cull dump_scan lUndumpElemFplUndumpList
: cull dump_scan lUndumpListlUndumpObject
: cull dump_scan lUndumpObjectlUniqHost
: cull list lUniqHostlUniqStr
: cull list lUniqStrlWhat
: cull what lWhatlWhatAll
: cull what lWhatAlllWhere
: cull where lWherelWriteDescrTo
: cull multitype lWriteDescrTolWriteElem
: cull list lWriteElemlWriteElemTo
: cull list lWriteElemTolWriteElemToDisk
: cull file lWriteElemToDisklWriteList
: cull list lWriteListlWriteListTo
: cull list lWriteListTolWriteWhatTo
: cull what lWriteWhatTolWriteWhatToDString
: cull what lWriteWhatToDStringlWriteWhereTo
: cull where lWriteWhereTolXchgList
: cull multitype lXchgListlXchgString
: cull multitype lXchgStringmt_do_hashing
: cull list mt_do_hashingmt_get_type
: cull list mt_get_typemt_is_unique
: cull list mt_is_uniquenm_set
: cull what nm_setpackbitfield
: cull pack packbitfieldpb_are_equivalent
: cull pack pb_are_equivalentpb_print_to
: cull pack pb_print_tosetByteArray
: cull pack setByteArrayunpackbitfield
: cull pack unpackbitfield