File: H5Vol_link.c

package info (click to toggle)
adios2 2.10.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 33,764 kB
  • sloc: cpp: 175,964; ansic: 160,510; f90: 14,630; yacc: 12,668; python: 7,275; perl: 7,126; sh: 2,825; lisp: 1,106; xml: 1,049; makefile: 579; lex: 557
file content (79 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef __H5VOL_LINK_FUNC
#define __H5VOL_LINK_FUNC

#include "H5Vol_def.h"

herr_t H5VL_adios2_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
                                 H5VL_link_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
                                 void H5_ATTR_UNUSED **req)

{
    REQUIRE_NOT_NULL_ERR(loc_params, -1);
    REQUIRE_NOT_NULL_ERR(obj, -1);

    H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;

    switch (args->op_type)
    {
    case H5VL_LINK_EXISTS: {
        if ((GROUP == vol->m_ObjType) || (ROOT == vol->m_ObjType))
        {
            hbool_t *ret = args->args.exists.exists;

            const char *obj_name = loc_params->loc_data.loc_by_name.name;
            *ret = gExistsUnderGrp(vol, obj_name);
        }
        return 0;
    }

    case H5VL_LINK_DELETE: {
        ADIOS_VOL_WARN("link does not have effect if already written in file ..\n");

        if ((GROUP == vol->m_ObjType) || (ROOT == vol->m_ObjType))
        {
            if (loc_params->type == H5VL_OBJECT_BY_NAME)
            {
                const char *obj_name = loc_params->loc_data.loc_by_name.name;
                if (gRemoveUnderGrp(vol, obj_name))
                {
                    return 0;
                }
            }
        }
    }
    default:
        break;
    }
    return -1;
}

herr_t H5VL_adios2_link_get(void *obj, const H5VL_loc_params_t *loc_params,
                            H5VL_link_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
                            void H5_ATTR_UNUSED **req)
{

    REQUIRE_NOT_NULL_ERR(loc_params, -1);
    REQUIRE_NOT_NULL_ERR(obj, -1);

    H5VL_ObjDef_t *vol = (H5VL_ObjDef_t *)obj;
    switch (args->op_type)
    {
    case H5VL_LINK_GET_NAME: {
        char *name = args->args.get_name.name;
        size_t *ret = (size_t *)args->args.get_name.name_len;

        if ((GROUP == vol->m_ObjType) || (ROOT == vol->m_ObjType))
        {
            // so idx makes sense
            *ret = gGetNameOfNthItem(vol, loc_params->loc_data.loc_by_idx.n, name);
            return 0;
        }
        break;
    }

    default:
        break;
    }
    return -1;
}
#endif