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) 2017 Research Organization for Information Science 17 * and Technology (RIST). All rights reserved. 18 * $COPYRIGHT$ 19 * 20 * Additional copyrights may follow 21 * 22 * $HEADER$ 23 */ 24 25 #ifndef OPAL_MCA_BASE_VAR_GROUP_H 26 #define OPAL_MCA_BASE_VAR_GROUP_H 27 28 #include "opal/mca/mca.h" 29 30 struct mca_base_var_group_t { 31 opal_list_item_t super; 32 33 /** Index of group */ 34 int group_index; 35 36 /** Group is valid (registered) */ 37 bool group_isvalid; 38 39 /** Group name */ 40 char *group_full_name; 41 42 char *group_project; 43 char *group_framework; 44 char *group_component; 45 46 /** Group help message (description) */ 47 char *group_description; 48 49 /** Integer value array of subgroup indices */ 50 opal_value_array_t group_subgroups; 51 52 /** Integer array of group variables */ 53 opal_value_array_t group_vars; 54 55 /** Integer array of group performance variables */ 56 opal_value_array_t group_pvars; 57 58 /** Pointer array of group enums */ 59 opal_value_array_t group_enums; 60 }; 61 62 typedef struct mca_base_var_group_t mca_base_var_group_t; 63 64 /** 65 * Object declaration for mca_base_var_group_t 66 */ 67 OPAL_DECLSPEC OBJ_CLASS_DECLARATION(mca_base_var_group_t); 68 69 /** 70 * Register an MCA variable group 71 * 72 * @param[in] project_name Project name for this group. 73 * @param[in] framework_name Framework name for this group. 74 * @param[in] component_name Component name for this group. 75 * @param[in] descrition Description of this group. 76 * 77 * @retval index Unique group index 78 * @return opal error code on Error 79 * 80 * Create an MCA variable group. If the group already exists 81 * this call is equivalent to mca_base_ver_find_group(). 82 */ 83 OPAL_DECLSPEC int mca_base_var_group_register(const char *project_name, 84 const char *framework_name, 85 const char *component_name, 86 const char *description); 87 88 /** 89 * Register an MCA variable group for a component 90 * 91 * @param[in] component [in] Pointer to the component for which the 92 * group is being registered. 93 * @param[in] description Description of this group. 94 * 95 * @retval index Unique group index 96 * @return opal error code on Error 97 */ 98 OPAL_DECLSPEC int mca_base_var_group_component_register (const mca_base_component_t *component, 99 const char *description); 100 101 /** 102 * Deregister an MCA param group 103 * 104 * @param group_index [in] Group index from mca_base_var_group_register (), 105 * mca_base_var_group_find(). 106 * 107 * This call deregisters all associated variables and subgroups. 108 */ 109 OPAL_DECLSPEC int mca_base_var_group_deregister (int group_index); 110 111 /** 112 * Find an MCA group 113 * 114 * @param[in] project_name Project name 115 * @param[in] framework_name Framework name 116 * @param[in] component_name Component name 117 * 118 * @returns OPAL_SUCCESS if found 119 * @returns OPAL_ERR_NOT_FOUND if not found 120 */ 121 OPAL_DECLSPEC int mca_base_var_group_find (const char *project_name, 122 const char *framework_name, 123 const char *component_name); 124 125 /** 126 * Find an MCA group by its full name 127 * 128 * @param[in] full_name Full name of MCA variable group. Ex: shmem_mmap 129 * @param[out] index Index of group if found 130 * 131 * @returns OPAL_SUCCESS if found 132 * @returns OPAL_ERR_NOT_FOUND if not found 133 */ 134 OPAL_DECLSPEC int mca_base_var_group_find_by_name (const char *full_name, int *index); 135 136 /** 137 * Get the group at a specified index 138 * 139 * @param[in] group_index Group index 140 * @param[out] group Storage for the group object pointer. 141 * 142 * @retval OPAL_ERR_NOT_FOUND If the group specified by group_index does not exist. 143 * @retval OPAL_SUCCESS If the group is found 144 * 145 * The returned pointer belongs to the MCA variable system. Do not modify/release/retain 146 * the pointer. 147 */ 148 OPAL_DECLSPEC int mca_base_var_group_get (const int group_index, 149 const mca_base_var_group_t **group); 150 151 /** 152 * Set/unset a flags for all variables in a group. 153 * 154 * @param[in] group_index Index of group 155 * @param[in] flag Flag(s) to set or unset. 156 * @param[in] set Boolean indicating whether to set flag(s). 157 * 158 * Set a flag for every variable in a group. See mca_base_var_set_flag() for more info. 159 */ 160 OPAL_DECLSPEC int mca_base_var_group_set_var_flag (const int group_index, int flags, 161 bool set); 162 163 /** 164 * Get the number of registered MCA groups 165 * 166 * @retval count Number of registered MCA groups 167 */ 168 OPAL_DECLSPEC int mca_base_var_group_get_count (void); 169 170 /** 171 * Get a relative timestamp for the MCA group system 172 * 173 * @retval stamp 174 * 175 * This value will change if groups or variables are either added or removed. 176 */ 177 OPAL_DECLSPEC int mca_base_var_group_get_stamp (void); 178 179 #endif /* OPAL_MCA_BASE_VAR_GROUP_H */