root/orte/tools/orte-info/components.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. component_map_construct
  2. component_map_destruct
  3. orte_info_components_open
  4. orte_info_components_close

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2010 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2005 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) 2006-2012 Cisco Systems, Inc.  All rights reserved.
  14  * Copyright (c) 2010-2012 Los Alamos National Security, LLC.
  15  *                         All rights reserved.
  16  * Copyright (c) 2015      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 #include "orte_config.h"
  26 
  27 #include <stdlib.h>
  28 #include <string.h>
  29 
  30 #include "orte/runtime/runtime.h"
  31 
  32 #include "opal/util/argv.h"
  33 #include "opal/runtime/opal_info_support.h"
  34 #include "opal/mca/event/base/base.h"
  35 #include "opal/util/output.h"
  36 
  37 #include "orte/runtime/orte_info_support.h"
  38 #include "orte/tools/orte-info/orte-info.h"
  39 /*
  40  * Public variables
  41  */
  42 
  43 static void component_map_construct(orte_info_component_map_t *map)
  44 {
  45     map->type = NULL;
  46 }
  47 static void component_map_destruct(orte_info_component_map_t *map)
  48 {
  49     if (NULL != map->type) {
  50         free(map->type);
  51     }
  52     /* the type close functions will release the
  53      * list of components
  54      */
  55 }
  56 OBJ_CLASS_INSTANCE(orte_info_component_map_t,
  57                    opal_list_item_t,
  58                    component_map_construct,
  59                    component_map_destruct);
  60 
  61 opal_pointer_array_t orte_component_map = {{0}};
  62 
  63 /*
  64  * Private variables
  65  */
  66 
  67 static bool opened_components = false;
  68 
  69 
  70 void orte_info_components_open(void)
  71 {
  72     if (opened_components) {
  73         return;
  74     }
  75 
  76     opened_components = true;
  77 
  78     /* init the map */
  79     OBJ_CONSTRUCT(&orte_component_map, opal_pointer_array_t);
  80     opal_pointer_array_init(&orte_component_map, 256, INT_MAX, 128);
  81 
  82     opal_info_register_framework_params(&orte_component_map);
  83     orte_info_register_framework_params(&orte_component_map);
  84 }
  85 
  86 /*
  87  * Not to be confused with orte_info_close_components.
  88  */
  89 void orte_info_components_close(void)
  90 {
  91     int i;
  92     orte_info_component_map_t *map;
  93 
  94     if (!opened_components) {
  95         return;
  96     }
  97 
  98     orte_info_close_components ();
  99     opal_info_close_components ();
 100 
 101     for (i=0; i < orte_component_map.size; i++) {
 102         if (NULL != (map = (orte_info_component_map_t*)opal_pointer_array_get_item(&orte_component_map, i))) {
 103             OBJ_RELEASE(map);
 104         }
 105     }
 106 
 107     OBJ_DESTRUCT(&orte_component_map);
 108 
 109     opened_components = false;
 110 }

/* [<][>][^][v][top][bottom][index][help] */