GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
gmHdf5Utils.h
Go to the documentation of this file.
1/************************************************************************
2**
3** Copyright (C) 2014 by Carlos Augusto Teixera Mendes
4** All rights reserved.
5**
6** This file is part of the "GeMA" software. It's use should respect
7** the terms in the license agreement that can be found together
8** with this source code.
9** It is provided AS IS, with NO WARRANTY OF ANY KIND,
10** INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR
11** A PARTICULAR PURPOSE.
12**
13************************************************************************/
14
25#ifndef _GEMA_HDF5_UTILS_H_
26#define _GEMA_HDF5_UTILS_H_
27
28#include "gmCoreConfig.h"
29
30#include <QString>
31#include <QVariant>
32#include <QVector>
33
34class QStringList;
35
36namespace H5 {
37 class H5File;
38 class H5Object;
39 class Group;
40 class DataType;
41}
42
43#include <H5Opublic.h>
44
45namespace GmHdf5Utils
46{
47 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, int value);
48 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, unsigned value);
49 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, double value);
50 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, bool value);
51 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, const char* value);
52 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, const QString& value);
53 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, const QStringList& value);
54 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, unsigned n, const int* values);
55 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, unsigned n, const unsigned* values);
56 GMC_API_EXPORT void addAttribute(H5::H5Object* obj, const QString& name, unsigned n, const double* values);
57
58 GMC_API_EXPORT bool saveStringTable(H5::H5File* file, const QString& dsName, const QStringList& values);
59 GMC_API_EXPORT bool saveDataTable (H5::H5File* file, const QString& dsName, int n, int d, const double* values);
60 GMC_API_EXPORT bool saveDataTable (H5::H5File* file, const QString& dsName, int n, int d, const int* values);
61
62 GMC_API_EXPORT QVariant loadAttribute(H5::H5Object* obj, const QString& name);
63 GMC_API_EXPORT QVariant loadAttribute(H5::H5Object* obj, const QString& name, const H5::DataType& type);
64
65 GMC_API_EXPORT H5O_type_t childObjectType (H5::H5Object* father, const QString& childName);
66 GMC_API_EXPORT bool tableSize (H5::H5Object* father, const QString& childName, hsize_t sizes[2]);
67 GMC_API_EXPORT bool checkTableLayout(H5::H5Object* father, const QString& childName, int ncols,
68 const H5::DataType& type, int* nlines = NULL, int* ncolumns = NULL);
69
71
72 GMC_API_EXPORT bool loadStringTable(H5::H5File* file, const QString& dsName, QStringList& values);
73 GMC_API_EXPORT bool loadDataTable (H5::H5File* file, const QString& dsName, int valuesSize, double* values, int offset = 0);
74 GMC_API_EXPORT bool loadDataTable (H5::H5File* file, const QString& dsName, int valuesSize, int* values, int offset = 0);
75 GMC_API_EXPORT bool loadDataTable (H5::H5File* file, const QString& dsName, QVector<double>& values);
76 GMC_API_EXPORT bool loadDataTable (H5::H5File* file, const QString& dsName, QVector<int>& values);
77
78};
79
80#endif
81
Declaration of useful configuration definitions for the Core library.
#define GMC_API_EXPORT
Macro for controlling if the class is being exported (GEMA_CORE_LIB defined) or imported (GEMA_CORE_L...
Definition gmCoreConfig.h:35
H5O_type_t childObjectType(H5::H5Object *father, const QString &childName)
Returns the type of the given object (name relative to the given father). If the named child doesn't ...
Definition gmHdf5Utils.cpp:307
bool loadStringTable(H5::H5File *file, const QString &dsName, QStringList &values)
Loads the contents of the given string table to the values list. Returns false on error....
Definition gmHdf5Utils.cpp:447
bool checkTableLayout(H5::H5Object *father, const QString &childName, int ncol, const H5::DataType &type, int *nlines, int *ncolumns)
Returns true if the table specified by a father object and its child path exists, has the given numbe...
Definition gmHdf5Utils.cpp:364
QVector< QPair< QString, H5O_type_t > > listObjectChildren(H5::H5Object *object)
Returns a list of object's children, together with their types. Might throw an HDF5 exception.
Definition gmHdf5Utils.cpp:423
bool saveDataTable(H5::H5File *file, const QString &dsName, int n, int d, const double *values)
Saves the complete set of given values to a new table with d columns and n lines. Expects the data ve...
Definition gmHdf5Utils.cpp:205
void addAttribute(H5::H5Object *obj, const QString &name, int value)
Adds an int attribute to the given object. Might throw an HDF5 exception.
Definition gmHdf5Utils.cpp:68
QVariant loadAttribute(H5::H5Object *obj, const QString &name)
Returns the value of the given object attribute as a Variant object. Returns an invalid variant if th...
Definition gmHdf5Utils.cpp:265
bool tableSize(H5::H5Object *father, const QString &childName, hsize_t sizes[2])
Returns the dimensions of the given table object (name relative to the given father)....
Definition gmHdf5Utils.cpp:326
bool loadDataTable(H5::H5File *file, const QString &dsName, int valuesSize, double *values, int offset)
Loads the specified number of values from the specified table, starting at the given offset....
Definition gmHdf5Utils.cpp:527
bool saveStringTable(H5::H5File *file, const QString &dsName, const QStringList &values)
Saves the complete set of given values to a new table with one string column. Returns false on error ...
Definition gmHdf5Utils.cpp:158