00001
00002
00003 #ifndef HDF_ATTR_HPP
00004 #define HDF_ATTR_HPP
00005
00006 #include <cstdlib>
00007 #include <iostream>
00008 #include <vector>
00009 #include <string>
00010 #include "mfhdf.h"
00011 #include "Hdf_exceptions.hpp"
00012
00013 class Hdf_attr {
00014 public:
00019 typedef enum {
00020 UNDEFINED,
00021 SDS,
00022 VDATA,
00023
00024 } attr_own;
00025
00026 Hdf_attr(const int32 object_id, const int32 iattr, const char *attr_name, const int32 attr_type, const int32 attr_nvalues, const attr_own owner=SDS, const int32 vd_field_idx=_HDF_VDATA);
00027 Hdf_attr();
00028 Hdf_attr(const Hdf_attr &hdf_attr);
00029 ~Hdf_attr();
00030 int32 get_type() const { return type; };
00031 int32 get_nvalues() const { return nvalues; }
00032 void get_value(void *value, int32 ival = 0) const;
00033 void get_values(void *values) const;
00034 std::string get_name() const { return name; }
00035 std::string to_string() const;
00036 std::string list_of_values() const;
00037
00038 Hdf_attr &operator= (const Hdf_attr &hdf_attr);
00039 friend std::ostream &operator<< (std::ostream &stream, const Hdf_attr &hdf_attr);
00040
00041
00042
00043
00044 static int32 chars_to_display;
00045 static int32 numbers_to_display;
00046
00047 private:
00048 int32 obj_id;
00049 int32 index;
00050 std::string name;
00051 int32 type;
00052 int32 nvalues;
00053 void* values;
00054
00055 void allocate_values();
00056 void deallocate_values();
00057 void copy_values(const Hdf_attr &hdf_attr);
00058
00059 };
00060
00061 #endif