summaryrefslogtreecommitdiffstats
path: root/c++/src/H5CommonFG.h
blob: 0c7b79944fbd40050ea2d15abfa823d3c3cb065c (plain)
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
80
81
82
83
84
85
86
87
88
89
90
91
// C++ informative line for the emacs editor: -*- C++ -*-
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * Copyright by the Board of Trustees of the University of Illinois.         *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the files COPYING and Copyright.html.  COPYING can be found at the root   *
 * of the source code distribution tree; Copyright.html can be found at the  *
 * root level of an installed copy of the electronic HDF5 document set and   *
 * is linked from the top-level documents page.  It can also be found at     *
 * http://hdfgroup.org/HDF5/doc/Copyright.html.  If you do not have          *
 * access to either file, you may request a copy from help@hdfgroup.org.     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef __CommonFG_H
#define __CommonFG_H

namespace H5 {

// Class forwarding
class Group;
class H5File;
class ArrayType;
class VarLenType;

/*! \class CommonFG
    \brief \a CommonFG is an abstract base class of H5File and H5Group.

    It provides common operations of H5File and H5Group.
*/
class H5_DLLCPP CommonFG {
   public:
        // Opens a generic named datatype in this location.
        DataType openDataType(const char* name) const;
        DataType openDataType(const H5std_string& name) const;

        // Opens a named array datatype in this location.
        ArrayType openArrayType(const char* name) const;
        ArrayType openArrayType(const H5std_string& name) const;

        // Opens a named compound datatype in this location.
        CompType openCompType(const char* name) const;
        CompType openCompType(const H5std_string& name) const;

        // Opens a named enumeration datatype in this location.
        EnumType openEnumType(const char* name) const;
        EnumType openEnumType(const H5std_string& name) const;

        // Opens a named integer datatype in this location.
        IntType openIntType(const char* name) const;
        IntType openIntType(const H5std_string& name) const;

        // Opens a named floating-point datatype in this location.
        FloatType openFloatType(const char* name) const;
        FloatType openFloatType(const H5std_string& name) const;

        // Opens a named string datatype in this location.
        StrType openStrType(const char* name) const;
        StrType openStrType(const H5std_string& name) const;

        // Opens a named variable length datatype in this location.
        VarLenType openVarLenType(const char* name) const;
        VarLenType openVarLenType(const H5std_string& name) const;

#ifndef DOXYGEN_SHOULD_SKIP_THIS
        /// For subclasses, H5File and Group, to return the correct
        /// object id, i.e. file or group id.
        virtual hid_t getLocId() const = 0;


        /// For subclasses, H5File and Group, to throw appropriate exception.
        virtual void throwException(const H5std_string& func_name, const H5std_string& msg) const = 0;

        // Default constructor.
        CommonFG();

        // Noop destructor.
        virtual ~CommonFG();

    protected:
        virtual void p_setId(const hid_t new_id) = 0;

#endif // DOXYGEN_SHOULD_SKIP_THIS

}; // end of CommonFG
} // namespace H5

#endif // __CommonFG_H