33 #include <sys/types.h>
40 #include <InternalErr.h>
62 #define HANDLE_CASE(tid,type) \
64 bt = new (type)(var->getNewName(),var->getFullPath()); \
77 throw InternalErr(__FILE__,__LINE__,
"unsupported data type.");
83 const vector<HDF5CF::Dimension *>& dims = var->
getDimensions();
86 vector <HDF5CF::Dimension*>:: const_iterator it_d;
87 if (0 == dims.size()) {
95 throw InternalErr(__FILE__,__LINE__,
"Cannot allocate the HDF5CFStr.");
103 throw InternalErr(__FILE__,__LINE__,
"Non string scalar data is not supported");
121 throw InternalErr(__FILE__,__LINE__,
"Cannot allocate the HDF5CFStr.");
125 for(it_d = dims.begin(); it_d != dims.end(); ++it_d) {
127 if (
""==(*it_d)->getNewName())
128 ar->append_dim((*it_d)->getSize());
130 ar->append_dim((*it_d)->getSize(), (*it_d)->getNewName());
151 throw InternalErr(__FILE__,__LINE__,
"FillValue attribute can only have one element.");
160 unsigned char final_fill_value = (
unsigned char)(attr->
getValue()[0]);
168 short final_fill_value = (short)(attr->
getValue()[0]);
174 short final_fill_value = (short)(attr->
getValue()[0]);
180 unsigned short final_fill_value = (
unsigned short)(attr->
getValue()[0]);
187 int final_fill_value = (int)(attr->
getValue()[0]);
193 unsigned int final_fill_value = (
unsigned int)(attr->
getValue()[0]);
199 float final_fill_value = (float)(attr->
getValue()[0]);
205 double final_fill_value = (double)(attr->
getValue()[0]);
210 throw InternalErr(__FILE__,__LINE__,
"unsupported data type.");
221 unsigned char final_fill_value = (
unsigned char)(attr->getValue()[0]);
249 for (
unsigned int loc=0; loc < attr->
getCount() ; loc++) {
264 if (
true == special_attr_handling) {
275 for (
unsigned int loc=0; loc < attr->
getCount() ; loc++) {
286 string check_droplongstr_key =
"H5.EnableDropLongString";
287 bool is_droplongstr =
false;
290 const vector<size_t>& strsize = attr->
getStrSize();
291 unsigned int temp_start_pos = 0;
292 for (
unsigned int loc=0; loc < attr->
getCount() ; loc++) {
293 if (strsize[loc] !=0) {
294 string tempstring(attr->
getValue().begin()+temp_start_pos,
295 attr->
getValue().begin()+temp_start_pos+strsize[loc]);
296 temp_start_pos += strsize[loc];
301 if (
false == is_droplongstr ||
305 at->append_attr(attr->
getNewName(),
"String",tempstring);
This class provides a way to map HDF5 Str to DAP Str for the CF option.
const string & getFullPath() const
Get the full path of this variable.
This class represents one HDF5 dataset(CF variable)
int getRank() const
Get the dimension rank of this variable.
This class provides a way to map HDF5 unsigned 16-bit integer to DAP uint16 for the CF option...
const string & getNewName() const
This class provides a way to map HDF5 float to DAP float for the CF option.
#define NC_JAVA_STR_SIZE_LIMIT
static bool check_beskeys(const string key)
const std::vector< char > & getValue() const
bool need_special_attribute_handling(const HDF5CF::Attribute *attr, const HDF5CF::Var *var)
static H5DataType get_mem_dtype(H5DataType, size_t)
This class provides a way to map HDF5 int16 to DAP int16 for the CF option.
const std::vector< size_t > & getStrSize() const
void gen_dap_oneobj_das(AttrTable *at, const HDF5CF::Attribute *attr, const HDF5CF::Var *var)
Map and generate DDS and DAS for the CF option for generic HDF5 products.
void gen_dap_special_oneobj_das(AttrTable *at, const HDF5CF::Attribute *attr, const HDF5CF::Var *var)
This class provides a way to map HDF5 64-bit floating-point(double) to DAP 64-bit floating-point for ...
H5DataType getType() const
Get the data type of this variable(Not HDF5 datatype id)
const string & getNewName() const
Get the new name of this variable.
static string print_attr(H5DataType h5type, int loc, void *vals)
This class provides a way to map HDF5 32-bit integer to DAP Int32 for the CF option.
This class includes the methods to read data array into DAP buffer from an HDF5 dataset for the CF op...
static string print_type(H5DataType h5type)
const vector< Dimension * > & getDimensions() const
Get the list of the dimensions.
H5DataType getType() const
static string escattr(string s)
A customized escaping function to escape special characters following OPeNDAP's escattr function that...
This class represents one attribute.
void gen_dap_str_attr(AttrTable *at, const HDF5CF::Attribute *attr)
Helper functions for generating DAS attributes and a function to check BES Key.
This class provides a way to map HDF5 unsigned 32-bit integer to DAP uint32 for the CF option...
void gen_dap_onevar_dds(DDS &dds, const HDF5CF::Var *var, const hid_t file_id, const string &filename)
This class provides a way to map HDF5 byte to DAP byte for the CF option.
#define HANDLE_CASE(tid, type)
size_t getBufSize() const