1 | // C++ informative line for the emacs editor: -*- C++ -*- |
---|
2 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
3 | * Copyright by The HDF Group. * |
---|
4 | * Copyright by the Board of Trustees of the University of Illinois. * |
---|
5 | * All rights reserved. * |
---|
6 | * * |
---|
7 | * This file is part of HDF5. The full HDF5 copyright notice, including * |
---|
8 | * terms governing use, modification, and redistribution, is contained in * |
---|
9 | * the files COPYING and Copyright.html. COPYING can be found at the root * |
---|
10 | * of the source code distribution tree; Copyright.html can be found at the * |
---|
11 | * root level of an installed copy of the electronic HDF5 document set and * |
---|
12 | * is linked from the top-level documents page. It can also be found at * |
---|
13 | * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * |
---|
14 | * access to either file, you may request a copy from help@hdfgroup.org. * |
---|
15 | * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
---|
16 | |
---|
17 | #ifndef _H5DataType_H |
---|
18 | #define _H5DataType_H |
---|
19 | |
---|
20 | #ifndef H5_NO_NAMESPACE |
---|
21 | namespace H5 { |
---|
22 | #endif |
---|
23 | |
---|
24 | class H5_DLLCPP DataType : public H5Object { |
---|
25 | public: |
---|
26 | // Creates a datatype given its class and size |
---|
27 | DataType( const H5T_class_t type_class, size_t size ); |
---|
28 | |
---|
29 | // Copy constructor: makes a copy of the original object |
---|
30 | DataType( const DataType& original ); |
---|
31 | |
---|
32 | // Creates a datatype by way of dereference. |
---|
33 | DataType(H5Object& obj, void* ref); |
---|
34 | DataType(H5File& file, void* ref); |
---|
35 | |
---|
36 | // Closes this datatype. |
---|
37 | virtual void close(); |
---|
38 | |
---|
39 | // Copies an existing datatype to this datatype object. |
---|
40 | void copy(const DataType& like_type); |
---|
41 | |
---|
42 | // Copies the datatype of dset to this datatype object. |
---|
43 | void copy(const DataSet& dset); |
---|
44 | |
---|
45 | // Returns the datatype class identifier. |
---|
46 | H5T_class_t getClass() const; |
---|
47 | |
---|
48 | // Commits a transient datatype to a file; this datatype becomes |
---|
49 | // a named datatype which can be accessed from the location. |
---|
50 | void commit( H5File& loc, const char* name); |
---|
51 | void commit( H5File& loc, const H5std_string& name); |
---|
52 | void commit( H5Object& loc, const char* name); |
---|
53 | void commit( H5Object& loc, const H5std_string& name); |
---|
54 | |
---|
55 | // Determines whether this datatype is a named datatype or |
---|
56 | // a transient datatype. |
---|
57 | bool committed() const; |
---|
58 | |
---|
59 | // Finds a conversion function that can handle the conversion |
---|
60 | // this datatype to the given datatype, dest. |
---|
61 | H5T_conv_t find( const DataType& dest, H5T_cdata_t **pcdata ) const; |
---|
62 | |
---|
63 | // Converts data from between specified datatypes. |
---|
64 | void convert( const DataType& dest, size_t nelmts, void *buf, void *background, const PropList& plist=PropList::DEFAULT) const; |
---|
65 | |
---|
66 | // Assignment operator |
---|
67 | DataType& operator=( const DataType& rhs ); |
---|
68 | |
---|
69 | // Determines whether two datatypes are the same. |
---|
70 | bool operator==(const DataType& compared_type ) const; |
---|
71 | |
---|
72 | // Locks a datatype. |
---|
73 | void lock() const; |
---|
74 | |
---|
75 | // Returns the size of a datatype. |
---|
76 | size_t getSize() const; |
---|
77 | |
---|
78 | // Returns the base datatype from which a datatype is derived. |
---|
79 | // Note: not quite right for specific types yet??? |
---|
80 | DataType getSuper() const; |
---|
81 | |
---|
82 | // Registers a conversion function. |
---|
83 | void registerFunc(H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; |
---|
84 | void registerFunc(H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const; |
---|
85 | |
---|
86 | // Removes a conversion function from all conversion paths. |
---|
87 | void unregister( H5T_pers_t pers, const char* name, const DataType& dest, H5T_conv_t func ) const; |
---|
88 | void unregister( H5T_pers_t pers, const H5std_string& name, const DataType& dest, H5T_conv_t func ) const; |
---|
89 | |
---|
90 | // Tags an opaque datatype. |
---|
91 | void setTag( const char* tag ) const; |
---|
92 | void setTag( const H5std_string& tag ) const; |
---|
93 | |
---|
94 | // Gets the tag associated with an opaque datatype. |
---|
95 | H5std_string getTag() const; |
---|
96 | |
---|
97 | // Checks whether this datatype contains (or is) a certain type class. |
---|
98 | bool detectClass(H5T_class_t cls) const; |
---|
99 | |
---|
100 | // Checks whether this datatype is a variable-length string. |
---|
101 | bool isVariableStr() const; |
---|
102 | |
---|
103 | #ifndef H5_NO_DEPRECATED_SYMBOLS |
---|
104 | // Retrieves the type of object that an object reference points to. |
---|
105 | H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; |
---|
106 | #endif /* H5_NO_DEPRECATED_SYMBOLS */ |
---|
107 | |
---|
108 | // Retrieves a dataspace with the region pointed to selected. |
---|
109 | DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; |
---|
110 | |
---|
111 | // Returns this class name |
---|
112 | virtual H5std_string fromClass () const { return("DataType"); } |
---|
113 | |
---|
114 | // Creates a copy of an existing DataType using its id |
---|
115 | DataType( const hid_t type_id ); |
---|
116 | |
---|
117 | // Default constructor |
---|
118 | DataType(); |
---|
119 | |
---|
120 | // Gets the datatype id. |
---|
121 | virtual hid_t getId() const; |
---|
122 | virtual void setId(const hid_t new_id); |
---|
123 | |
---|
124 | // Destructor: properly terminates access to this datatype. |
---|
125 | virtual ~DataType(); |
---|
126 | |
---|
127 | protected: |
---|
128 | hid_t id; // HDF5 datatype id |
---|
129 | private: |
---|
130 | void p_commit(hid_t loc_id, const char* name); |
---|
131 | }; |
---|
132 | #ifndef H5_NO_NAMESPACE |
---|
133 | } |
---|
134 | #endif |
---|
135 | #endif |
---|