This source file includes following definitions.
- PMIx_Data_type_string
- pmix_bfrops_base_get_available_modules
- pmix_bfrops_base_assign_module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 #include <src/include/pmix_config.h>
21
22
23 #include <stdio.h>
24 #ifdef HAVE_UNISTD_H
25 #include <unistd.h>
26 #endif
27
28 #include "src/util/argv.h"
29 #include "src/util/error.h"
30 #include "src/include/pmix_globals.h"
31
32 #include "src/mca/bfrops/base/base.h"
33
34 PMIX_EXPORT const char* PMIx_Data_type_string(pmix_data_type_t type)
35 {
36 pmix_bfrops_base_active_module_t *active;
37 char *reply;
38
39 if (!pmix_bfrops_globals.initialized) {
40 return "NOT INITIALIZED";
41 }
42
43 PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
44 if (NULL != active->module->data_type_string) {
45 if (NULL != (reply = (char*)active->module->data_type_string(type))) {
46 return reply;
47 }
48 }
49 }
50 return "UNKNOWN";
51 }
52
53 char* pmix_bfrops_base_get_available_modules(void)
54 {
55 pmix_bfrops_base_active_module_t *active;
56 char **tmp=NULL, *reply=NULL;
57
58 if (!pmix_bfrops_globals.initialized) {
59 return NULL;
60 }
61
62 PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
63 pmix_argv_append_nosize(&tmp, active->component->base.pmix_mca_component_name);
64 }
65 if (NULL != tmp) {
66 reply = pmix_argv_join(tmp, ',');
67 pmix_argv_free(tmp);
68 }
69 return reply;
70 }
71
72 pmix_bfrops_module_t* pmix_bfrops_base_assign_module(const char *version)
73 {
74 pmix_bfrops_base_active_module_t *active;
75 pmix_bfrops_module_t *mod;
76 char **tmp=NULL;
77 int i;
78
79 if (!pmix_bfrops_globals.initialized) {
80 return NULL;
81 }
82
83 if (NULL != version) {
84 tmp = pmix_argv_split(version, ',');
85 }
86
87 PMIX_LIST_FOREACH(active, &pmix_bfrops_globals.actives, pmix_bfrops_base_active_module_t) {
88 if (NULL == tmp) {
89 if (NULL != (mod = active->component->assign_module())) {
90 return mod;
91 }
92 } else {
93 for (i=0; NULL != tmp[i]; i++) {
94 if (0 == strcmp(tmp[i], active->component->base.pmix_mca_component_name)) {
95 if (NULL != (mod = active->component->assign_module())) {
96 pmix_argv_free(tmp);
97 return mod;
98 }
99 }
100 }
101 }
102 }
103
104
105 if (NULL != tmp) {
106 pmix_argv_free(tmp);
107 }
108 return NULL;
109 }