InnerhalbNach weiteren Dokumenten suchenSupport-Ressourcen | Dieses Buch im PDF-Format herunterladen (909 KB)
Chapter 5 Map FunctionsThis chapter provides a reference to functions you can use for creating, destroying, and manipulating the map objects used by the Sun JavaTM System Access Management SDK. Function summaries include a short description, syntax, parameters and returns. The following functions are contained in the header file am_map.h. am_map_clear()Erases all of the entries in the specified map. Syntax#include "am_map.h" AM_EXPORT am_status_t am_map_clear(am_map_t map); ParametersThis function takes the following parameter:
ReturnsThis function returns am_status_t with one of the following values:
am_map_copy()Makes a copy of a map object. Syntax#include "am_map.h" AM_EXPORT am_status_t am_map_copy(am_map_t source_map, am_map_t *map_ptr); ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
DetailsThis function creates an instance of am_map_t structure, copies all the elements in source_map into the newly created structure and assigns it to map_ptr. It does not alter the contents of source_map. Memory Concerns: The caller must make sure not to pass a map_ptr which as a valid am_map_t structure, otherwise the reference will be lost. The caller must destroy map_ptr after usage by calling am_map_destroy. am_map_create()Creates a new, empty map object. Syntax#include "am_map.h" AM_EXPORT am_status_t am_map_create(am_map_t *map_ptr); ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
am_map_destroy()Destroys the map object referenced by the provided handle. Syntax#include "am_map.h" AM_EXPORT void am_map_destroy(am_map_t map); ParametersThis function takes the following parameters:
ReturnsThis function returns one of the following values:
DetailsThis function destroys an instance of am_map_t structure which is pointed by map_ptr. Memory Concerns: Care must be taken that map_ptr was not freed before by calling am_map_destroy or by erroneously calling the system void free (void *) function. am_map_entry_iter_destroy()Destroys the entry iterator object referenced by the provided handle. Syntax#include "am_map.h" AM_EXPORT void am_map_entry_iter_destroy(am_map_entry_iter_t entry_iter); ParametersThis function takes the following parameter:
am_map_entry_iter_get_first_value()Returns the first value of the element currently referenced by the specified iterator. Syntax#include "am_map.h" AM_EXPORT const char * am_map_entry_iter_get_first_value(am_map_entry_iter_t entry_iter); ParametersThis function takes the following parameter:
ReturnsThis function returns const char * with one of the following values:
DetailsThis function destroys the am_map_entry_iterator_t passed to it. Memory Concerns: Caller must be sure that this function is not called multiple times on the same am_map_entry_iter_t. am_map_entry_iter_get_key()Returns the key of the element currently referenced by the specified iterator. Syntax#include "am_map.h" AM_EXPORT const char * am_map_entry_iter_get_key(am_map_entry_iter_t entry_iter); ParametersThis function takes the following parameters:
ReturnsThis function returns const char * with one of the following values:
DetailsThis function returns the key of this key-value pair entry iterator. Memory Concerns: Caller must not modify or free the return value. am_map_entry_iter_get_values()Returns an iterator object that can be used to enumerate all of the values associated with the entry referenced by the iterator you specify. Syntax#include "am_map.h" AM_EXPORT am_status_t am_map_entry_iter_get_values(am_map_entry_iter_t entry_iter, ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
DetailsThis function returns an am_map_value_iter_t that enumerates over the values associated with am_map_entry_iter_t. Memory Concerns After the use of value_iter_t the caller must call am_map_value_iter_destroy. am_map_entry_iter_is_entry_valid()Determines if the specified iterator references a valid entry. Syntax#include "am_map.h" AM_EXPORT boolean_t am_map_entry_iter_is_entry_valid(am_map_entry_iter_t entry_iter); ParametersThis function takes the following parameter:
ReturnsThis function returns boolean_t with one of the following values:
am_map_entry_iter_next()Advances the specified iterator to the next entry in the map specified when the iterator was created. Syntax#include "am_map.h" AM_EXPORT boolean_t am_map_entry_iter_next(am_map_entry_iter_t entry_iter); ParametersThis function takes the following parameters:
ReturnsThis function returns boolean_t with one of the following values:
am_map_erase()Erases the specified key from the specified map. Syntax#include "am_map.h" AM_EXPORT am_status_t am_map_erase(am_map_t map, const char *key); ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
am_map_find()Returns an iterator object that can be used to enumerate all of the values associated with the specified key. Syntax#include "am_map.h"
AM_EXPORT am_status_t
am_map_find(am_map_t map, const char *key,
am_map_value_iter_t *value_iter_ptr);
ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
DetailsThis function takes a key and returns an iterator that iterates over the values associated with the key. If the value_iter_ptr argument is non-NULL, then the location that it refers to will be set to NULL if an error is returned. Memory Concerns: At the end of usage of value_iter_ptr, the caller must call am_map_value_iter_destroy with the iterators pointer. am_map_find_first_value()Returns the first value associated with the specified key in the specified map. Syntax#include "am_map.h" AM_EXPORT const char * am_map_find_first_value(am_map_t map, const char *key); ParametersThis function takes the following parameters:
ReturnsThis function returns const char * with one of the following values:
DetailsThis function takes a key and returns the first value associated with the key. Memory Concerns: Caller must not modify or free the return value. am_map_get_entries()Returns an iterator object that can be used to enumerate all of the entries in the specified map. Syntax#include "am_map.h" AM_EXPORT am_status_t am_map_get_entries(am_map_t map, am_map_entry_iter_t *entry_iter_ptr); ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
DetailsThis function extracts an iterator pointer that can be used to iterate over the key value pairs stored in this table. Memory Concerns: The iterator pointer passed in must not have non-destroyed iterators assigned to them. The caller, in future must call am_map_entry_iter_destroy to destroy the iterator instance. If the entry_iter_ptr argument is non-NULL, then the location that it refers to will be set to NULL if an error is returned. am_map_insert()Inserts a new key-value pair into the specified map. Syntax#include "am_map.h"
AM_EXPORT am_status_t
am_map_insert(am_map_t map, const char *key, const char *value,
int replace);
ParametersThis function takes the following parameters:
ReturnsThis function returns am_status_t with one of the following values:
DetailsIf an entry with the same key already exists, then the existing value is replaced by the new value. NOTE: The map does not retain any references to the provided key or value parameters. It makes copies of any strings it needs to store. am_map_size()Returns the number of elements in the map. Syntax#include "am_map.h" AM_EXPORT size_t am_map_size(const am_map_t map); ParametersThis function takes the following parameters:
ReturnsThis function returns size_t with the size whose type is size_t. am_map_entry_iter_destroy()Destroys the entry iterator object referenced by the provided handle. Syntax#include "am_map.h" AM_EXPORT void am_map_entry_iter_destroy(am_map_entry_iter_t entry_iter); ParametersThis function takes the following parameter:
DetailsThis function destroys the am_map_entry_iterator_t passed to it. Memory Concerns: Caller must be sure that this function is not called multiple times on the same am_map_entry_iter_t. am_map_value_iter_get()Returns the value currently referenced by the specified iterator. Syntax#include "am_map.h" AM_EXPORT const char * am_map_value_iter_get(am_map_value_iter_t iter); ParametersThis function takes the following parameters:
ReturnsThis function returns const char * with one of the following values:
am_map_value_iter_is_value_valid()Advances the specified iterator to the next value associated with the key specified when the iterator was created. Syntax#include "am_map.h" AM_EXPORT boolean_t am_map_value_iter_is_value_valid(am_map_value_iter_t iter); ParametersThis function takes the following parameters:
ReturnsThis function returns AM_EXPORT boolean_t with one of the following values:
|