radarlib 1.4.6
odimh5v21_hdf5.hpp
Go to the documentation of this file.
1/*
2 * Radar Library
3 *
4 * Copyright (C) 2009-2010 ARPA-SIM <urpsim@smr.arpa.emr.it>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Author: Guido Billi <guidobilli@gmail.com>
21 */
22
26
27#ifndef __RADAR_ODIMH5V21_HDF5_HPP__
28#define __RADAR_ODIMH5V21_HDF5_HPP__
29
30/*===========================================================================*/
31/* INTERNAL HEADER FILE USED INSIDE THE LIBRARY */
32/*===========================================================================*/
33
34#include <radarlib/defs.h>
35
36/* sotto windows bisogna utilizzare queste macro per poter usare la DLL */
37#ifndef _HDF5USEDLL_
38#define _HDF5USEDLL_
39#endif
40#ifndef HDF5CPP_USEDLL
41#define HDF5CPP_USEDLL
42#endif
43
44#include "H5Cpp.h"
45//#ifndef H5_NO_NAMESPACE
46//using namespace H5;
47//#endif
48
49#include <set>
50
51namespace OdimH5v21 {
52
53/*===========================================================================*/
54/* HDF5 FILE */
55/*===========================================================================*/
56
62class RADAR_API HDF5File
63{
64public:
73 static H5::H5File* open (const std::string& path, int h5flags);
80 static H5::Group* getRoot (H5::H5File* file);
81};
82
83/*===========================================================================*/
84/* HDF5 ATTRIBUTE */
85/*===========================================================================*/
86
92class RADAR_API HDF5Attribute
93{
94public:
105 static H5::Attribute* get (H5::H5Object* obj, const char* name, bool mandatory);
114 static bool exists (H5::H5Object* obj, const char* name);
123 static void remove (H5::H5Object* obj, const char* name);
132 static std::string getName (H5::Attribute* attr);
133
145 static void set (H5::H5Object* obj, const char* name, int64_t value);
157 static void set (H5::H5Object* obj, const char* name, double value);
169 static void set (H5::H5Object* obj, const char* name, const char* value);
181 static void set (H5::H5Object* obj, const char* name, const std::string& value);
182
192 static int64_t getLong (H5::H5Object* obj, const char* name);
202 static int64_t getLong (H5::H5Object* obj, const char* name, int64_t defaultValue);
212 static double getDouble (H5::H5Object* obj, const char* name);
223 static double getDouble (H5::H5Object* obj, const char* name, double defaultValue);
233 static std::string getStr (H5::H5Object* obj, const char* name);
244 static std::string getStr (H5::H5Object* obj, const char* name, const std::string& defaultValue);
245
246};
247
248/*===========================================================================*/
249/* HDF5 GROUP */
250/*===========================================================================*/
251
257class RADAR_API HDF5Group
258{
259public:
268 static int getChildCount (H5::Group* parent, const char* prefix);
278 static H5::Group* getChild (H5::Group* parent, const char* name);
287 static void ensureChild (H5::Group* parent, const char* name);
297 static H5::Group* ensureGetChild (H5::Group* parent, const char* name);
306 static void removeChild (H5::Group* parent, const char* name);
307
316 static bool exists (H5::Group* parent, const char* name);
325 static H5::DataSet* getDataset (H5::Group* parent, const char* name);
334 static void copyAttributes (H5::Group* src, H5::Group* dst);
344 static void copyAttributes (H5::Group* src, H5::Group* dst, const std::set<std::string>& names);
353// static void copyDatasets(H5::Group* src, H5::Group* dst);
354// static void copyDatasets(MetadataGroup* src, MetadataGroup* dst);
364// static void copyDatasets(H5::Group* src, H5::Group* dst, const std::set<std::string>& names);
365};
366
367/*===========================================================================*/
368/* HDF5 ATOM TYPE */
369/*===========================================================================*/
370
376class RADAR_API HDF5AtomType
377{
378public:
388 static H5::AtomType fromDataType(const H5::DataType& type);
389};
390
391
392/*===========================================================================*/
393
394}
395
396#endif
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
HDF5Group class.
Definition odimh5v21_hdf5.hpp:377
static H5::AtomType fromDataType(const H5::DataType &type)
Try to cast a generic HDF5 DataType to a AtomType.
Definition odimh5v21_hdf5.cpp:806
HDF5Attribute class.
Definition odimh5v21_hdf5.hpp:93
static bool exists(H5::H5Object *obj, const char *name)
Check if an HDF5 attribute exists.
Definition odimh5v21_hdf5.cpp:137
static int64_t getLong(H5::H5Object *obj, const char *name)
Get the value of a 64 bit int signed attribute attribute.
Definition odimh5v21_hdf5.cpp:285
static void set(H5::H5Object *obj, const char *name, int64_t value)
Set the value of an attribute.
Definition odimh5v21_hdf5.cpp:170
static double getDouble(H5::H5Object *obj, const char *name)
Get the value of a 64 bit floating point attribute.
Definition odimh5v21_hdf5.cpp:324
static H5::Attribute * get(H5::H5Object *obj, const char *name, bool mandatory)
Get a HDF5 attribute.
Definition odimh5v21_hdf5.cpp:128
static std::string getStr(H5::H5Object *obj, const char *name)
Get the value of a string attribute.
Definition odimh5v21_hdf5.cpp:383
static std::string getName(H5::Attribute *attr)
Get the name of a given attribute.
Definition odimh5v21_hdf5.cpp:161
static void remove(H5::H5Object *obj, const char *name)
Delete an HDF5 attribute.
Definition odimh5v21_hdf5.cpp:155
HDF5File class.
Definition odimh5v21_hdf5.hpp:63
static H5::H5File * open(const std::string &path, int h5flags)
Open a HDF5 file.
Definition odimh5v21_hdf5.cpp:83
static H5::Group * getRoot(H5::H5File *file)
Get the HDF5 root group of a file Get the HDF5 root group of a given HDF5 file.
Definition odimh5v21_hdf5.cpp:97
HDF5Group class.
Definition odimh5v21_hdf5.hpp:258
static void copyAttributes(H5::Group *src, H5::Group *dst)
Copy all attributes from a HDF5 group to another.
Definition odimh5v21_hdf5.cpp:657
static H5::DataSet * getDataset(H5::Group *parent, const char *name)
Get a HDF5 dataset child of a given HDF5 group.
Definition odimh5v21_hdf5.cpp:624
static H5::Group * ensureGetChild(H5::Group *parent, const char *name)
Get (and automatically create) a child group.
Definition odimh5v21_hdf5.cpp:477
static void ensureChild(H5::Group *parent, const char *name)
Check or create a child group.
Definition odimh5v21_hdf5.cpp:448
static bool exists(H5::Group *parent, const char *name)
Check for child group existance.
Definition odimh5v21_hdf5.cpp:606
static H5::Group * getChild(H5::Group *parent, const char *name)
Get the a child group of a given HDF5 group.
Definition odimh5v21_hdf5.cpp:426
static void removeChild(H5::Group *parent, const char *name)
Delete a child group.
Definition odimh5v21_hdf5.cpp:550
static int getChildCount(H5::Group *parent, const char *prefix)
Get the number of children group of a given HDF5 group.
Definition odimh5v21_hdf5.cpp:530
Internal library macros.
Namespace related to ODIMH5 version 2.1.
Definition odimh5v21.hpp:46