
1. Introduces a flag for the type of buffer that now allows a user to either have a fully described or a completely non-described buffer. In the latter case, no data type descriptions are included in the buffer. This obviously limits what we can do for debugging purposes, but the intent here was to provide an optimized communications capability for those wanting it. Note that individual buffers can be designated for either type using the orte_dss.set_buffer_type command. In other words, the buffer type can be set dynamically - it isn't a configuration setting at all. The type will default to fully described. A buffer MUST be empty to set its type - this is checked by the set_buffer_type command, and you will receive an error if you violate that rule. IMPORTANT NOTE: ORTE 1.x actually will NOT work with non-described buffers. This capability should therefore NOT be used until we tell you it is okay. For now, it is here simply so we can begin bringing over parts of ORTE 2.0. The problem is that ORTE 1.x depends upon the transmission of non-hard-cast data types such as size_t. These "soft" types currently utilize a "peek" function to see their actual type in the buffer - obviously, without description, the system has no idea how to unpack these "soft" types. We will deal with this later - for now, please don't use the non-described buffer option. 2. Introduces the orte_std_cntr_t type. This will become the replacement for the size_t's used throughout ORTE 1.x. At the moment, it is actually typedef'd to size_t for backward compatibility. 3. Introduces the orte_dss.arith API that supports arbitrary arithmetic functions on numeric data types. Calling the function with any other data type will generate an error. This commit was SVN r11075.
100 строки
3.3 KiB
C
100 строки
3.3 KiB
C
/*
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
* University Research and Technology
|
|
* Corporation. All rights reserved.
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
* of Tennessee Research Foundation. All rights
|
|
* reserved.
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
* University of Stuttgart. All rights reserved.
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
* All rights reserved.
|
|
* $COPYRIGHT$
|
|
*
|
|
* Additional copyrights may follow
|
|
*
|
|
* $HEADER$
|
|
*/
|
|
|
|
#include "orte_config.h"
|
|
#include "orte/orte_types.h"
|
|
|
|
#include "orte/mca/errmgr/errmgr.h"
|
|
#include "orte/mca/ns/ns.h"
|
|
|
|
#include "orte/dss/dss.h"
|
|
#include "orte/dss/dss_internal.h"
|
|
|
|
|
|
int orte_dss_register(orte_dss_pack_fn_t pack_fn,
|
|
orte_dss_unpack_fn_t unpack_fn,
|
|
orte_dss_copy_fn_t copy_fn,
|
|
orte_dss_compare_fn_t compare_fn,
|
|
orte_dss_size_fn_t size_fn,
|
|
orte_dss_print_fn_t print_fn,
|
|
orte_dss_release_fn_t release_fn,
|
|
bool structured,
|
|
const char *name, orte_data_type_t *type)
|
|
{
|
|
int ret;
|
|
orte_dss_type_info_t *info, **ptr;
|
|
orte_std_cntr_t i;
|
|
orte_data_type_t j;
|
|
|
|
/* Check for bozo cases */
|
|
|
|
if (NULL == pack_fn || NULL == unpack_fn || NULL == copy_fn || NULL == compare_fn ||
|
|
NULL == size_fn || NULL == print_fn || NULL == name || NULL == type) {
|
|
ORTE_ERROR_LOG(ORTE_ERR_BAD_PARAM);
|
|
return ORTE_ERR_BAD_PARAM;
|
|
}
|
|
|
|
/* check if this entry already exists - if so, error - we do NOT allow multiple type registrations */
|
|
ptr = (orte_dss_type_info_t**)(orte_dss_types->addr);
|
|
for (i=0, j=0; j < orte_dss_num_reg_types &&
|
|
i < orte_dss_types->size; i++) {
|
|
if (NULL != ptr[i]) {
|
|
j++;
|
|
if (0 == strcmp(ptr[i]->odti_name, name)) {
|
|
ORTE_ERROR_LOG(ORTE_ERR_DATA_TYPE_REDEF);
|
|
return ORTE_ERR_DATA_TYPE_REDEF;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* if type is given (i.e., *type > 0), then just use it.
|
|
* otherwise, go and get a new type id from the name
|
|
* service
|
|
*/
|
|
if (0 >= *type) {
|
|
if (ORTE_SUCCESS != (ret = orte_ns.define_data_type(name, type))) {
|
|
ORTE_ERROR_LOG(ret);
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
/* Add a new entry to the table */
|
|
info = (orte_dss_type_info_t*) OBJ_NEW(orte_dss_type_info_t);
|
|
if (NULL == info) {
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
}
|
|
info->odti_type = *type;
|
|
info->odti_name = strdup(name);
|
|
info->odti_pack_fn = pack_fn;
|
|
info->odti_unpack_fn = unpack_fn;
|
|
info->odti_copy_fn = copy_fn;
|
|
info->odti_compare_fn = compare_fn;
|
|
info->odti_size_fn = size_fn;
|
|
info->odti_print_fn = print_fn;
|
|
info->odti_release_fn = release_fn;
|
|
info->odti_structured = structured;
|
|
if (ORTE_SUCCESS != (ret = orte_pointer_array_set_item(orte_dss_types, *type, info))) {
|
|
ORTE_ERROR_LOG(ret);
|
|
}
|
|
|
|
/* All done */
|
|
|
|
return ret;
|
|
}
|