* rename ompi_value_array opal_value_array
This commit was SVN r6323.
Этот коммит содержится в:
родитель
761402f95f
Коммит
764a9314db
@ -38,7 +38,7 @@
|
||||
*
|
||||
* - ompi_bitmap and orte_bitmap
|
||||
* - ompi_pointer_array and orte_pointer_array
|
||||
* - ompi_value_array and orte_value_array
|
||||
* - opal_value_array and orte_value_array
|
||||
*
|
||||
* Short version:
|
||||
*
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#include "class/ompi_value_array.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "util/printf.h"
|
||||
#include "util/show_help.h"
|
||||
#include "mca/base/mca_base_param.h"
|
||||
@ -61,7 +61,7 @@ string ompi_info::path_sysconfdir = "sysconfdir";
|
||||
// in mca_base_param.h so that no one else will use it.
|
||||
//
|
||||
|
||||
extern ompi_value_array_t mca_base_params;
|
||||
extern opal_value_array_t mca_base_params;
|
||||
|
||||
|
||||
void ompi_info::do_params(bool want_all, bool want_internal)
|
||||
|
@ -26,7 +26,7 @@ headers = \
|
||||
ompi_hash_table.h \
|
||||
opal_list.h \
|
||||
opal_object.h \
|
||||
ompi_value_array.h
|
||||
opal_value_array.h
|
||||
|
||||
libclass_la_SOURCES = \
|
||||
$(headers) \
|
||||
@ -34,7 +34,7 @@ libclass_la_SOURCES = \
|
||||
ompi_hash_table.c \
|
||||
opal_list.c \
|
||||
opal_object.c \
|
||||
ompi_value_array.c
|
||||
opal_value_array.c
|
||||
|
||||
# Conditionally install the header files
|
||||
|
||||
|
@ -16,10 +16,10 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "class/ompi_value_array.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
|
||||
|
||||
static void ompi_value_array_construct(ompi_value_array_t* array)
|
||||
static void opal_value_array_construct(opal_value_array_t* array)
|
||||
{
|
||||
array->array_items = NULL;
|
||||
array->array_size = 0;
|
||||
@ -27,25 +27,25 @@ static void ompi_value_array_construct(ompi_value_array_t* array)
|
||||
array->array_alloc_size = 0;
|
||||
}
|
||||
|
||||
static void ompi_value_array_destruct(ompi_value_array_t* array)
|
||||
static void opal_value_array_destruct(opal_value_array_t* array)
|
||||
{
|
||||
if (NULL != array->array_items)
|
||||
free(array->array_items);
|
||||
}
|
||||
|
||||
opal_class_t ompi_value_array_t_class = {
|
||||
"ompi_value_array_t",
|
||||
opal_class_t opal_value_array_t_class = {
|
||||
"opal_value_array_t",
|
||||
OBJ_CLASS(opal_object_t),
|
||||
(opal_construct_t)ompi_value_array_construct,
|
||||
(opal_destruct_t)ompi_value_array_destruct
|
||||
(opal_construct_t)opal_value_array_construct,
|
||||
(opal_destruct_t)opal_value_array_destruct
|
||||
};
|
||||
|
||||
|
||||
int ompi_value_array_set_size(ompi_value_array_t* array, size_t size)
|
||||
int opal_value_array_set_size(opal_value_array_t* array, size_t size)
|
||||
{
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if(array->array_item_sizeof == 0) {
|
||||
ompi_output(0, "ompi_value_array_set_size: item size must be initialized");
|
||||
ompi_output(0, "opal_value_array_set_size: item size must be initialized");
|
||||
return OMPI_ERR_BAD_PARAM;
|
||||
}
|
||||
#endif
|
@ -14,8 +14,8 @@
|
||||
* $HEADER$
|
||||
*/
|
||||
|
||||
#ifndef OMPI_VALUE_ARRAY_H
|
||||
#define OMPI_VALUE_ARRAY_H
|
||||
#ifndef OPAL_VALUE_ARRAY_H
|
||||
#define OPAL_VALUE_ARRAY_H
|
||||
|
||||
#include <string.h>
|
||||
#include "ompi_config.h"
|
||||
@ -36,10 +36,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
OMPI_DECLSPEC extern opal_class_t ompi_value_array_t_class;
|
||||
OMPI_DECLSPEC extern opal_class_t opal_value_array_t_class;
|
||||
|
||||
|
||||
struct ompi_value_array_t
|
||||
struct opal_value_array_t
|
||||
{
|
||||
opal_object_t super;
|
||||
unsigned char* array_items;
|
||||
@ -47,7 +47,7 @@ struct ompi_value_array_t
|
||||
size_t array_size;
|
||||
size_t array_alloc_size;
|
||||
};
|
||||
typedef struct ompi_value_array_t ompi_value_array_t;
|
||||
typedef struct opal_value_array_t opal_value_array_t;
|
||||
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ typedef struct ompi_value_array_t ompi_value_array_t;
|
||||
* delete it.
|
||||
*/
|
||||
|
||||
static inline int ompi_value_array_init(ompi_value_array_t *array, size_t item_sizeof)
|
||||
static inline int opal_value_array_init(opal_value_array_t *array, size_t item_sizeof)
|
||||
{
|
||||
array->array_item_sizeof = item_sizeof;
|
||||
array->array_alloc_size = 1;
|
||||
@ -82,7 +82,7 @@ static inline int ompi_value_array_init(ompi_value_array_t *array, size_t item_s
|
||||
* @return OMPI error code.
|
||||
*/
|
||||
|
||||
static inline int ompi_value_array_reserve(ompi_value_array_t* array, size_t size)
|
||||
static inline int opal_value_array_reserve(opal_value_array_t* array, size_t size)
|
||||
{
|
||||
if(size > array->array_alloc_size) {
|
||||
array->array_items = (unsigned char*)realloc(array->array_items, array->array_item_sizeof * size);
|
||||
@ -105,7 +105,7 @@ static inline int ompi_value_array_reserve(ompi_value_array_t* array, size_t siz
|
||||
* @return The number of elements currently in use.
|
||||
*/
|
||||
|
||||
static inline size_t ompi_value_array_get_size(ompi_value_array_t* array)
|
||||
static inline size_t opal_value_array_get_size(opal_value_array_t* array)
|
||||
{
|
||||
return array->array_size;
|
||||
}
|
||||
@ -122,11 +122,11 @@ static inline size_t ompi_value_array_get_size(ompi_value_array_t* array)
|
||||
* Note that resizing the array to a smaller size may not change
|
||||
* the underlying memory allocated by the array. However, setting
|
||||
* the size larger than the current allocation will grow it. In either
|
||||
* case, if the routine is successful, ompi_value_array_get_size() will
|
||||
* case, if the routine is successful, opal_value_array_get_size() will
|
||||
* return the new size.
|
||||
*/
|
||||
|
||||
int ompi_value_array_set_size(ompi_value_array_t* array, size_t size);
|
||||
int opal_value_array_set_size(opal_value_array_t* array, size_t size);
|
||||
|
||||
|
||||
/**
|
||||
@ -143,7 +143,7 @@ int ompi_value_array_set_size(ompi_value_array_t* array, size_t size);
|
||||
* ensuring the array index is valid (0 <= item index < array size).
|
||||
*/
|
||||
|
||||
#define OMPI_VALUE_ARRAY_GET_ITEM(array, item_type, item_index) \
|
||||
#define OPAL_VALUE_ARRAY_GET_ITEM(array, item_type, item_index) \
|
||||
((item_type*)((array)->array_items))[item_index]
|
||||
|
||||
/**
|
||||
@ -158,9 +158,9 @@ int ompi_value_array_set_size(ompi_value_array_t* array, size_t size);
|
||||
* array size, the array is grown to satisfy the request.
|
||||
*/
|
||||
|
||||
static inline void* ompi_value_array_get_item(ompi_value_array_t *array, size_t index)
|
||||
static inline void* opal_value_array_get_item(opal_value_array_t *array, size_t index)
|
||||
{
|
||||
if(index >= array->array_size && ompi_value_array_set_size(array, index+1) != OMPI_SUCCESS)
|
||||
if(index >= array->array_size && opal_value_array_set_size(array, index+1) != OMPI_SUCCESS)
|
||||
return NULL;
|
||||
return array->array_items + (index * array->array_item_sizeof);
|
||||
}
|
||||
@ -181,7 +181,7 @@ static inline void* ompi_value_array_get_item(ompi_value_array_t *array, size_t
|
||||
* copied into the array by value.
|
||||
*/
|
||||
|
||||
#define OMPI_VALUE_ARRAY_SET_ITEM(array, item_type, item_index, item_value) \
|
||||
#define OPAL_VALUE_ARRAY_SET_ITEM(array, item_type, item_index, item_value) \
|
||||
(((item_type*)((array)->array_items))[item_index] = item_value)
|
||||
|
||||
/**
|
||||
@ -198,11 +198,11 @@ static inline void* ompi_value_array_get_item(ompi_value_array_t *array, size_t
|
||||
* copied into the array by value.
|
||||
*/
|
||||
|
||||
static inline int ompi_value_array_set_item(ompi_value_array_t *array, size_t index, const void* item)
|
||||
static inline int opal_value_array_set_item(opal_value_array_t *array, size_t index, const void* item)
|
||||
{
|
||||
int rc;
|
||||
if(index >= array->array_size &&
|
||||
(rc = ompi_value_array_set_size(array, index+1)) != OMPI_SUCCESS)
|
||||
(rc = opal_value_array_set_size(array, index+1)) != OMPI_SUCCESS)
|
||||
return rc;
|
||||
memcpy(array->array_items + (index * array->array_item_sizeof), item, array->array_item_sizeof);
|
||||
return OMPI_SUCCESS;
|
||||
@ -223,9 +223,9 @@ static inline int ompi_value_array_set_item(ompi_value_array_t *array, size_t in
|
||||
* it is copied by value into the array.
|
||||
*/
|
||||
|
||||
static inline int ompi_value_array_append_item(ompi_value_array_t *array, const void *item)
|
||||
static inline int opal_value_array_append_item(opal_value_array_t *array, const void *item)
|
||||
{
|
||||
return ompi_value_array_set_item(array, array->array_size, item);
|
||||
return opal_value_array_set_item(array, array->array_size, item);
|
||||
}
|
||||
|
||||
|
||||
@ -241,11 +241,11 @@ static inline int ompi_value_array_append_item(ompi_value_array_t *array, const
|
||||
* All elements following this index are shifted down.
|
||||
*/
|
||||
|
||||
static inline int ompi_value_array_remove_item(ompi_value_array_t *array, size_t index)
|
||||
static inline int opal_value_array_remove_item(opal_value_array_t *array, size_t index)
|
||||
{
|
||||
#if OMPI_ENABLE_DEBUG
|
||||
if (index >= array->array_size) {
|
||||
ompi_output(0, "ompi_value_array_remove_item: invalid index %d\n", index);
|
||||
ompi_output(0, "opal_value_array_remove_item: invalid index %d\n", index);
|
||||
return OMPI_ERR_BAD_PARAM;
|
||||
}
|
||||
#endif
|
||||
@ -267,12 +267,12 @@ static inline int ompi_value_array_remove_item(ompi_value_array_t *array, size_t
|
||||
* This function is helpful when you need to iterate through an
|
||||
* entire array; simply get the base value of the array and use native
|
||||
* C to iterate through it manually. This can have better performance
|
||||
* than looping over OMPI_VALUE_ARRAY_GET_ITEM() and
|
||||
* OMPI_VALUE_ARRAY_SET_ITEM() because it will [potentially] reduce the
|
||||
* than looping over OPAL_VALUE_ARRAY_GET_ITEM() and
|
||||
* OPAL_VALUE_ARRAY_SET_ITEM() because it will [potentially] reduce the
|
||||
* number of pointer dereferences.
|
||||
*/
|
||||
|
||||
#define OMPI_VALUE_ARRAY_GET_BASE(array, item_type) \
|
||||
#define OPAL_VALUE_ARRAY_GET_BASE(array, item_type) \
|
||||
((item_type*) ((array)->array_items))
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
@ -22,7 +22,7 @@
|
||||
|
||||
#include "mpi.h"
|
||||
#include "include/constants.h"
|
||||
#include "class/ompi_value_array.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "class/ompi_hash_table.h"
|
||||
#if 0
|
||||
/* JMS commented out for now -- see lookup_keyvals() below for an
|
||||
@ -48,7 +48,7 @@ opal_list_t mca_base_param_file_values;
|
||||
/*
|
||||
* local variables
|
||||
*/
|
||||
static ompi_value_array_t mca_base_params;
|
||||
static opal_value_array_t mca_base_params;
|
||||
static const char *mca_prefix = "OMPI_MCA_";
|
||||
static char *home = NULL;
|
||||
static bool initialized = false;
|
||||
@ -115,8 +115,8 @@ int mca_base_param_init(void)
|
||||
|
||||
/* Init the value array for the param storage */
|
||||
|
||||
OBJ_CONSTRUCT(&mca_base_params, ompi_value_array_t);
|
||||
ompi_value_array_init(&mca_base_params, sizeof(mca_base_param_t));
|
||||
OBJ_CONSTRUCT(&mca_base_params, opal_value_array_t);
|
||||
opal_value_array_init(&mca_base_params, sizeof(mca_base_param_t));
|
||||
|
||||
/* Init the file param value list */
|
||||
|
||||
@ -201,7 +201,7 @@ int mca_base_param_kv_associate(int index, int keyval)
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
len = ompi_value_array_get_size(&mca_base_params);
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
if (((size_t) index) > len) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
@ -210,7 +210,7 @@ int mca_base_param_kv_associate(int index, int keyval)
|
||||
parameters, so if the index is >0 and <len, it must be good), so
|
||||
save the keyval */
|
||||
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array[index].mbp_keyval = keyval;
|
||||
|
||||
/* All done */
|
||||
@ -321,7 +321,7 @@ int mca_base_param_unset(int index)
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
len = ompi_value_array_get_size(&mca_base_params);
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
if (((size_t) index) > len) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
@ -330,7 +330,7 @@ int mca_base_param_unset(int index)
|
||||
parameters, so if the index is >0 and <len, it must be good),
|
||||
so save the internal flag */
|
||||
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
if (array[index].mbp_override_value_set) {
|
||||
if (MCA_BASE_PARAM_TYPE_STRING == array[index].mbp_type &&
|
||||
NULL != array[index].mbp_override_value.stringval) {
|
||||
@ -364,7 +364,7 @@ char *mca_base_param_environ_variable(const char *type,
|
||||
|
||||
id = mca_base_param_find(type, component, param);
|
||||
if (OMPI_ERROR != id) {
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
ret = strdup(array[id].mbp_env_var_name);
|
||||
} else {
|
||||
len = strlen(mca_prefix) + strlen(type) + 16;
|
||||
@ -418,8 +418,8 @@ int mca_base_param_find(const char *type_name, const char *component_name,
|
||||
/* Loop through looking for a parameter of a given
|
||||
type/component/param */
|
||||
|
||||
size = ompi_value_array_get_size(&mca_base_params);
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
size = opal_value_array_get_size(&mca_base_params);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
for (i = 0; i < size; ++i) {
|
||||
if (0 == strcmp(type_name, array[i].mbp_type_name) &&
|
||||
((NULL == component_name && NULL == array[i].mbp_component_name) ||
|
||||
@ -449,7 +449,7 @@ int mca_base_param_set_internal(int index, bool internal)
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
|
||||
len = ompi_value_array_get_size(&mca_base_params);
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
if (((size_t) index) > len) {
|
||||
return OMPI_ERROR;
|
||||
}
|
||||
@ -458,7 +458,7 @@ int mca_base_param_set_internal(int index, bool internal)
|
||||
parameters, so if the index is >0 and <len, it must be good),
|
||||
so save the internal flag */
|
||||
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array[index].mbp_internal = internal;
|
||||
|
||||
/* All done */
|
||||
@ -489,8 +489,8 @@ int mca_base_param_dump(opal_list_t **info, bool internal)
|
||||
|
||||
/* Iterate through all the registered parameters */
|
||||
|
||||
len = ompi_value_array_get_size(&mca_base_params);
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
for (i = 0; i < len; ++i) {
|
||||
if(array[i].mbp_internal == internal || internal) {
|
||||
p = OBJ_NEW(mca_base_param_info_t);
|
||||
@ -532,8 +532,8 @@ int mca_base_param_build_env(char ***env, int *num_env, bool internal)
|
||||
|
||||
/* Iterate through all the registered parameters */
|
||||
|
||||
len = ompi_value_array_get_size(&mca_base_params);
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
for (i = 0; i < len; ++i) {
|
||||
if (array[i].mbp_internal == internal || internal) {
|
||||
if (param_lookup(i, &storage, NULL)) {
|
||||
@ -606,10 +606,10 @@ int mca_base_param_finalize(void)
|
||||
|
||||
/* This is slow, but effective :-) */
|
||||
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
while (ompi_value_array_get_size(&mca_base_params) > 0) {
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
while (opal_value_array_get_size(&mca_base_params) > 0) {
|
||||
OBJ_DESTRUCT(&array[0]);
|
||||
ompi_value_array_remove_item(&mca_base_params, 0);
|
||||
opal_value_array_remove_item(&mca_base_params, 0);
|
||||
}
|
||||
OBJ_DESTRUCT(&mca_base_params);
|
||||
|
||||
@ -803,8 +803,8 @@ static int param_register(const char *type_name, const char *component_name,
|
||||
|
||||
/* See if this entry is already in the array */
|
||||
|
||||
len = ompi_value_array_get_size(&mca_base_params);
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
len = opal_value_array_get_size(&mca_base_params);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
for (i = 0; i < len; ++i) {
|
||||
if (0 == strcmp(param.mbp_full_name, array[i].mbp_full_name)) {
|
||||
|
||||
@ -939,10 +939,10 @@ static int param_register(const char *type_name, const char *component_name,
|
||||
/* Add it to the array */
|
||||
|
||||
if (OMPI_SUCCESS !=
|
||||
(ret = ompi_value_array_append_item(&mca_base_params, ¶m))) {
|
||||
(ret = opal_value_array_append_item(&mca_base_params, ¶m))) {
|
||||
return ret;
|
||||
}
|
||||
return ompi_value_array_get_size(&mca_base_params) - 1;
|
||||
return opal_value_array_get_size(&mca_base_params) - 1;
|
||||
}
|
||||
|
||||
|
||||
@ -961,12 +961,12 @@ static bool param_set_override(size_t index,
|
||||
if (!initialized) {
|
||||
return false;
|
||||
}
|
||||
size = ompi_value_array_get_size(&mca_base_params);
|
||||
size = opal_value_array_get_size(&mca_base_params);
|
||||
if (index > size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
if (MCA_BASE_PARAM_TYPE_INT == type) {
|
||||
array[index].mbp_override_value.intval = storage->intval;
|
||||
} else if (MCA_BASE_PARAM_TYPE_STRING == type) {
|
||||
@ -998,11 +998,11 @@ static bool param_lookup(size_t index, mca_base_param_storage_t *storage,
|
||||
if (!initialized) {
|
||||
return false;
|
||||
}
|
||||
size = ompi_value_array_get_size(&mca_base_params);
|
||||
size = opal_value_array_get_size(&mca_base_params);
|
||||
if (index > size) {
|
||||
return false;
|
||||
}
|
||||
array = OMPI_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
array = OPAL_VALUE_ARRAY_GET_BASE(&mca_base_params, mca_base_param_t);
|
||||
|
||||
/* Ensure that MCA param has a good type */
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
#include "ompi_config.h"
|
||||
|
||||
#include "class/ompi_value_array.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
#include "opal/class/opal_list.h"
|
||||
#include "class/ompi_hash_table.h"
|
||||
|
||||
|
Двоичные данные
test/Unit-Test-Status.xls
Двоичные данные
test/Unit-Test-Status.xls
Двоичный файл не отображается.
@ -24,7 +24,7 @@ check_PROGRAMS = \
|
||||
ompi_fifo \
|
||||
ompi_hash_table \
|
||||
opal_list \
|
||||
ompi_value_array \
|
||||
opal_value_array \
|
||||
ompi_pointer_array \
|
||||
ompi_rb_tree \
|
||||
orte_bitmap
|
||||
@ -68,11 +68,11 @@ ompi_pointer_array_LDADD = \
|
||||
$(top_builddir)/test/support/libsupport.a
|
||||
ompi_pointer_array_DEPENDENCIES = $(ompi_pointer_array_LDADD)
|
||||
|
||||
ompi_value_array_SOURCES = ompi_value_array.c
|
||||
ompi_value_array_LDADD = \
|
||||
opal_value_array_SOURCES = opal_value_array.c
|
||||
opal_value_array_LDADD = \
|
||||
$(top_builddir)/src/libmpi.la \
|
||||
$(top_builddir)/test/support/libsupport.a
|
||||
ompi_value_array_DEPENDENCIES = $(ompi_value_array_LDADD)
|
||||
opal_value_array_DEPENDENCIES = $(opal_value_array_LDADD)
|
||||
|
||||
ompi_rb_tree_SOURCES = ompi_rb_tree.c
|
||||
ompi_rb_tree_LDADD = \
|
||||
|
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* This test is intended to test the ompi_value_array class
|
||||
* This test is intended to test the opal_value_array class
|
||||
*/
|
||||
|
||||
#include "ompi_config.h"
|
||||
@ -25,7 +25,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "support.h"
|
||||
#include "class/ompi_value_array.h"
|
||||
#include "opal/class/opal_value_array.h"
|
||||
|
||||
|
||||
#define NUM_ITEMS 10
|
||||
@ -36,22 +36,22 @@ int main(int argc, char **argv)
|
||||
uint64_t i, val;
|
||||
uint64_t count;
|
||||
|
||||
ompi_value_array_t array;
|
||||
OBJ_CONSTRUCT(&array, ompi_value_array_t);
|
||||
opal_value_array_t array;
|
||||
OBJ_CONSTRUCT(&array, opal_value_array_t);
|
||||
|
||||
test_init("ompi_value_array_t");
|
||||
ompi_value_array_init(&array, sizeof(uint64_t));
|
||||
test_verify_int(0, ompi_value_array_get_size(&array));
|
||||
test_init("opal_value_array_t");
|
||||
opal_value_array_init(&array, sizeof(uint64_t));
|
||||
test_verify_int(0, opal_value_array_get_size(&array));
|
||||
|
||||
/* add several items to the array */
|
||||
for(i=0; i < NUM_ITEMS; i++) {
|
||||
ompi_value_array_append_item(&array, &i);
|
||||
opal_value_array_append_item(&array, &i);
|
||||
}
|
||||
test_verify_int(NUM_ITEMS, ompi_value_array_get_size(&array));
|
||||
test_verify_int(NUM_ITEMS, opal_value_array_get_size(&array));
|
||||
|
||||
/* verify contents */
|
||||
for(i=0; i < NUM_ITEMS; i++) {
|
||||
val = OMPI_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i);
|
||||
val = OPAL_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i);
|
||||
if (val != i) {
|
||||
test_failure("Comparison failure");
|
||||
fprintf(stderr, " Expected result: %lld\n", (long long) i);
|
||||
@ -61,43 +61,43 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* re-init array with new type */
|
||||
ompi_value_array_init(&array, sizeof(uint64_t));
|
||||
test_verify_int(0, ompi_value_array_get_size(&array));
|
||||
opal_value_array_init(&array, sizeof(uint64_t));
|
||||
test_verify_int(0, opal_value_array_get_size(&array));
|
||||
|
||||
/* set fixed size */
|
||||
ompi_value_array_set_size(&array, NUM_ITEMS);
|
||||
opal_value_array_set_size(&array, NUM_ITEMS);
|
||||
|
||||
/* initialize array */
|
||||
count = 0;
|
||||
for(i=0; i < NUM_ITEMS; i++) {
|
||||
OMPI_VALUE_ARRAY_SET_ITEM(&array, uint64_t, i, count++);
|
||||
OPAL_VALUE_ARRAY_SET_ITEM(&array, uint64_t, i, count++);
|
||||
}
|
||||
|
||||
/* grow it */
|
||||
for(i=0; i < NUM_ITEMS; i++) {
|
||||
ompi_value_array_append_item(&array, &count);
|
||||
opal_value_array_append_item(&array, &count);
|
||||
count++;
|
||||
}
|
||||
/* check size */
|
||||
test_verify_int(count, ompi_value_array_get_size(&array));
|
||||
test_verify_int(count, opal_value_array_get_size(&array));
|
||||
|
||||
/* validate contents */
|
||||
for(i=0; i < count; i++) {
|
||||
test_verify_int(i, OMPI_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i));
|
||||
test_verify_int(i, OPAL_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i));
|
||||
}
|
||||
|
||||
/* remove an item */
|
||||
ompi_value_array_remove_item(&array, NUM_ITEMS);
|
||||
opal_value_array_remove_item(&array, NUM_ITEMS);
|
||||
|
||||
/* check size */
|
||||
test_verify_int(count-1, ompi_value_array_get_size(&array));
|
||||
test_verify_int(count-1, opal_value_array_get_size(&array));
|
||||
|
||||
/* validate contents */
|
||||
for(i=0; i < count-1; i++) {
|
||||
if(i >= NUM_ITEMS) {
|
||||
test_verify_int(i+1, OMPI_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i));
|
||||
test_verify_int(i+1, OPAL_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i));
|
||||
} else {
|
||||
test_verify_int(i, OMPI_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i));
|
||||
test_verify_int(i, OPAL_VALUE_ARRAY_GET_ITEM(&array, uint64_t, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,10 +203,10 @@
|
||||
RelativePath="..\..\src\class\ompi_rb_tree.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\class\ompi_value_array.c">
|
||||
RelativePath="..\..\src\class\opal_value_array.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\class\ompi_value_array.h">
|
||||
RelativePath="..\..\src\class\opal_value_array.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user