Hdf_vd.hpp

00001 /* Hdf_vd.hpp */
00002 
00003 #ifndef HDF_VD_HPP
00004 #define HDF_VD_HPP
00005 
00006 #include <iostream>
00007 #include <string>
00008 #include "hdf.h"
00009 #include "mfhdf.h"
00010 #include "Hdf_vd_field.hpp"
00011 
00012 class Hdf_vd {
00016   int32 ref;
00020   std::string name;
00024   std::string cls;
00028   int32 interlace;
00032   int32 nb_record;
00036   vector <Hdf_vd_field> fields;
00040   vector<Hdf_attr> attrs;
00041   void init_member();
00042   void init_fields(const int32 &id, const char *field_name_list, const int32 & nb_field);
00043   void init_attributes(const int32 &id);
00044 
00045 public:
00052   Hdf_vd(const int32 &vd_id, const int32 &vd_ref, const char* filename);
00053 
00054   Hdf_vd();
00055   Hdf_vd(const Hdf_vd &hdf_vd);
00056   ~Hdf_vd();
00057 
00058   std::string get_name() const { return name; }
00059   int32 get_ref() const { return ref; }
00060   std::string get_cls() const { return cls; }
00061   int32 get_interlace() const { return interlace; }
00062   int32 get_nb_record() const { return nb_record; }
00063   int32 get_nb_field() const { return fields.size(); }
00064   int32 get_nb_attr() const { return attrs.size(); };
00065 
00072   Hdf_vd_field get_field(const char *field_name) const;
00079   Hdf_vd_field get_field(const int32 &field_idx) const;
00085   const bool has_field( const char * field_name ) const;
00086 
00093   Hdf_attr get_attribute(const char *attr_name) const;
00100   Hdf_attr get_attribute(const int32 &attr_idx) const;
00106   const bool has_attr( const char * attr_name ) const;
00113   void get_attr_value(const char *attr_name,void *value, int32 ival = 0) const;
00119   int32 get_attr_idx(const char* attr_name) const;
00125   int32 get_field_idx(const char* field_name) const;
00126 
00127   Hdf_vd &operator= (const Hdf_vd &hdf_vd);
00128   std::string to_string() const;
00129   friend std::ostream &operator<< (std::ostream &stream, const Hdf_vd &hdf_vd);
00130 
00135   Hdf_vd_field read_field_data( const int32 & file_id, const string &filename, const string &field_name, void* data, int32 start, int32 edges );
00136 
00137 };
00138 
00139 #endif