Mantid
Loading...
Searching...
No Matches
NexusFile_fwd.h
Go to the documentation of this file.
1
4#pragma once
5
6#include "MantidNexus/DllConfig.h"
8#include <iosfwd>
9#include <map>
10#include <string>
11#include <vector>
12
13// forward declare typedefs from hdf5
14typedef int64_t hid_t;
15typedef uint64_t hsize_t;
16typedef int herr_t;
17
26enum class NXaccess : unsigned int { READ = 0x0000u, RDWR = 0x0001u, CREATE5 = 0x0002u };
27
28MANTID_NEXUS_DLL std::ostream &operator<<(std::ostream &os, const NXaccess &value);
29
35enum class NXentrytype : int { group = 0, sds = 1 };
36
43typedef struct {
44 std::string targetAddress; /* address to item to link */
45 NXentrytype linkType; /* HDF5: 0 for group link, 1 for SDS link */
46} NXlink;
47
48/*--------------------------------------------------------------------------*/
49
65class MANTID_NEXUS_DLL NXnumtype {
66public:
67 // first hexadigit: 2 = float, 1 = signed int, 0 = unsigned int, F = special
68 // second hexadigit: width in bytes
69 static unsigned short constexpr FLOAT32 = 0x24u; // 10 0100 = 0x24
70 static unsigned short constexpr FLOAT64 = 0x28u; // 10 1000 = 0x28
71 static unsigned short constexpr INT8 = 0x11u; // 01 0001 = 0x11
72 static unsigned short constexpr INT16 = 0x12u; // 01 0010 = 0x12
73 static unsigned short constexpr INT32 = 0x14u; // 01 0100 = 0x14
74 static unsigned short constexpr INT64 = 0x18u; // 01 1000 = 0x18
75 static unsigned short constexpr UINT8 = 0x01u; // 00 0001 = 0x01
76 static unsigned short constexpr UINT16 = 0x02u; // 00 0010 = 0x02
77 static unsigned short constexpr UINT32 = 0x04u; // 00 0100 = 0x04
78 static unsigned short constexpr UINT64 = 0x08u; // 00 1000 = 0x08
79 static unsigned short constexpr CHAR = 0xF0u; // 11 0000 = 0xF0
80 static unsigned short constexpr BINARY = 0xF1u; // 11 0001 = 0xF1
81 static unsigned short constexpr BAD = 0xFFu; // 11 1111 = 0xFF
82
83 // for &'ing with a type to check what it is:
84 // & will be true (nonzero) if it is of type indicated; false (zero) else
85 static unsigned short constexpr FLOAT_TYPE = 0x20u;
86 static unsigned short constexpr SPECIAL_TYPE = 0x80u;
87
88private:
89 int m_val;
90 static int validate_val(int const x);
91
92public:
94 NXnumtype(int const val);
95 NXnumtype &operator=(int const);
96 operator int() const;
97 operator std::string() const;
98
99 // Will return true if the type is a float
100 bool isFloat() { return m_val & FLOAT_TYPE; }
101 // Will return true if the type is a special (char, binary, or bad)
102 bool isSpecial() { return m_val & SPECIAL_TYPE; }
103};
104
105MANTID_NEXUS_DLL std::ostream &operator<<(std::ostream &os, const NXnumtype &value);
106
116enum class NXcompression { CHUNK, NONE, LZW, RLE, HUF };
117
118MANTID_NEXUS_DLL std::ostream &operator<<(std::ostream &os, const NXcompression &value);
119
120// forward declare
121namespace Mantid::Nexus {
122
123inline std::string const GROUP_CLASS_SPEC("NX_class");
124inline std::string const UNKNOWN_GROUP_SPEC("NX_UNKNOWN_GROUP");
125inline std::string const SCIENTIFIC_DATA_SET("SDS");
126
128typedef std::vector<dimsize_t> DimVector;
129
130typedef std::pair<std::string, std::string> Entry;
131typedef std::map<std::string, std::string> Entries;
132
144
150struct AttrInfo {
154 std::size_t length;
156 std::string name;
157};
158
160class File;
161} // namespace Mantid::Nexus
162
163constexpr std::size_t NX_MAXRANK(32);
164constexpr Mantid::Nexus::dimsize_t NX_UNLIMITED(-1); // AKA max of unsigned long, equivalent to H5S_UNLIMITED
double value
The value of the point.
Definition FitMW.cpp:51
int64_t hid_t
This class defines data types which are used as part of the Nexus API.
constexpr Mantid::Nexus::dimsize_t NX_UNLIMITED(-1)
constexpr std::size_t NX_MAXRANK(32)
NXaccess
Nexus file access codes.
NXcompression
The available compression types:
int herr_t
uint64_t hsize_t
NXentrytype
Describes the type of entry in a Nexus file, either group or dataset.
MANTID_NEXUS_DLL std::ostream & operator<<(std::ostream &os, const NXaccess &value)
The primitive types published by this API.
bool isFloat()
bool isSpecial()
NXnumtype(int const val)
static int validate_val(int const x)
NXnumtype & operator=(int const)
Header for a base Nexus::Exception.
std::map< std::string, std::string > Entries
std::string const UNKNOWN_GROUP_SPEC("NX_UNKNOWN_GROUP")
std::string const SCIENTIFIC_DATA_SET("SDS")
std::string const GROUP_CLASS_SPEC("NX_class")
std::vector< dimsize_t > DimVector
std::pair< std::string, std::string > Entry
Information about an attribute.
NXnumtype type
The primitive type for the attribute.
std::string name
The name of the attribute.
std::size_t length
The length of the attribute.
This structure holds the type and dimensions of a primative field/array.
DimVector dims
The dimensions of the file.
NXnumtype type
The primative type for the field.