1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ 2 /* 3 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana 4 * University Research and Technology 5 * Corporation. All rights reserved. 6 * Copyright (c) 2004-2006 The University of Tennessee and The University 7 * of Tennessee Research Foundation. All rights 8 * reserved. 9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, 10 * University of Stuttgart. All rights reserved. 11 * Copyright (c) 2004-2005 The Regents of the University of California. 12 * All rights reserved. 13 * Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved. 14 * Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights 15 * reserved. 16 * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. 17 * $COPYRIGHT$ 18 * 19 * Additional copyrights may follow 20 * 21 * $HEADER$ 22 */ 23 24 #ifndef PMIX_MCA_BASE_VAR_GROUP_H 25 #define PMIX_MCA_BASE_VAR_GROUP_H 26 27 #include "src/mca/mca.h" 28 29 struct pmix_mca_base_var_group_t { 30 pmix_list_item_t super; 31 32 /** Index of group */ 33 int group_index; 34 35 /** Group is valid (registered) */ 36 bool group_isvalid; 37 38 /** Group name */ 39 char *group_full_name; 40 41 char *group_project; 42 char *group_framework; 43 char *group_component; 44 45 /** Group help message (description) */ 46 char *group_description; 47 48 /** Integer value array of subgroup indices */ 49 pmix_value_array_t group_subgroups; 50 51 /** Integer array of group variables */ 52 pmix_value_array_t group_vars; 53 54 }; 55 56 typedef struct pmix_mca_base_var_group_t pmix_mca_base_var_group_t; 57 58 /** 59 * Object declaration for pmix_mca_base_var_group_t 60 */ 61 PMIX_EXPORT PMIX_CLASS_DECLARATION(pmix_mca_base_var_group_t); 62 63 /** 64 * Register an MCA variable group 65 * 66 * @param[in] project_name Project name for this group. 67 * @param[in] framework_name Framework name for this group. 68 * @param[in] component_name Component name for this group. 69 * @param[in] descrition Description of this group. 70 * 71 * @retval index Unique group index 72 * @return pmix error code on Error 73 * 74 * Create an MCA variable group. If the group already exists 75 * this call is equivalent to pmix_mca_base_ver_find_group(). 76 */ 77 PMIX_EXPORT int pmix_mca_base_var_group_register(const char *project_name, 78 const char *framework_name, 79 const char *component_name, 80 const char *description); 81 82 /** 83 * Register an MCA variable group for a component 84 * 85 * @param[in] component [in] Pointer to the component for which the 86 * group is being registered. 87 * @param[in] description Description of this group. 88 * 89 * @retval index Unique group index 90 * @return pmix error code on Error 91 */ 92 PMIX_EXPORT int pmix_mca_base_var_group_component_register (const pmix_mca_base_component_t *component, 93 const char *description); 94 95 /** 96 * Deregister an MCA param group 97 * 98 * @param group_index [in] Group index from pmix_mca_base_var_group_register (), 99 * pmix_mca_base_var_group_find(). 100 * 101 * This call deregisters all associated variables and subgroups. 102 */ 103 PMIX_EXPORT int pmix_mca_base_var_group_deregister (int group_index); 104 105 /** 106 * Find an MCA group 107 * 108 * @param[in] project_name Project name 109 * @param[in] framework_name Framework name 110 * @param[in] component_name Component name 111 * 112 * @returns PMIX_SUCCESS if found 113 * @returns PMIX_ERR_NOT_FOUND if not found 114 */ 115 PMIX_EXPORT int pmix_mca_base_var_group_find (const char *project_name, 116 const char *framework_name, 117 const char *component_name); 118 119 /** 120 * Find an MCA group by its full name 121 * 122 * @param[in] full_name Full name of MCA variable group. Ex: shmem_mmap 123 * @param[out] index Index of group if found 124 * 125 * @returns PMIX_SUCCESS if found 126 * @returns PMIX_ERR_NOT_FOUND if not found 127 */ 128 PMIX_EXPORT int pmix_mca_base_var_group_find_by_name (const char *full_name, int *index); 129 130 /** 131 * Get the group at a specified index 132 * 133 * @param[in] group_index Group index 134 * @param[out] group Storage for the group object pointer. 135 * 136 * @retval PMIX_ERR_NOT_FOUND If the group specified by group_index does not exist. 137 * @retval PMIX_SUCCESS If the group is found 138 * 139 * The returned pointer belongs to the MCA variable system. Do not modify/release/retain 140 * the pointer. 141 */ 142 PMIX_EXPORT int pmix_mca_base_var_group_get (const int group_index, 143 const pmix_mca_base_var_group_t **group); 144 145 /** 146 * Set/unset a flags for all variables in a group. 147 * 148 * @param[in] group_index Index of group 149 * @param[in] flag Flag(s) to set or unset. 150 * @param[in] set Boolean indicating whether to set flag(s). 151 * 152 * Set a flag for every variable in a group. See pmix_mca_base_var_set_flag() for more info. 153 */ 154 PMIX_EXPORT int pmix_mca_base_var_group_set_var_flag (const int group_index, int flags, 155 bool set); 156 157 /** 158 * Get the number of registered MCA groups 159 * 160 * @retval count Number of registered MCA groups 161 */ 162 PMIX_EXPORT int pmix_mca_base_var_group_get_count (void); 163 164 /** 165 * Get a relative timestamp for the MCA group system 166 * 167 * @retval stamp 168 * 169 * This value will change if groups or variables are either added or removed. 170 */ 171 PMIX_EXPORT int pmix_mca_base_var_group_get_stamp (void); 172 173 #endif /* PMIX_MCA_BASE_VAR_GROUP_H */