Hdf_vd_field.hpp

00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Fabrice DUCOS   *
00003  *   fabrice.ducos@icare.univ-lille1.fr   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef HDF_VD_FIELD_HPP
00022 #define HDF_VD_FIELD_HPP
00023 
00024 #include <iostream>
00025 #include <string>
00026 #include "mfhdf.h"
00027 #include "Hdf_attr.hpp"
00028 
00032 class Hdf_vd_field {
00033   string name;
00034   int32 type;
00035   int32 order;
00036   int32 size;
00040   vector<Hdf_attr> attrs;
00046   int32 get_attr_idx(const char* attr_name) const;
00047 public:
00056   Hdf_vd_field(const char *vd_name,const int32 &type, const int32 &order, const int32 &size, const int32 &vd_id=-1, const int32& field_idx=-1);
00057   Hdf_vd_field();
00058   Hdf_vd_field(const Hdf_vd_field &hdf_vd);
00059   ~Hdf_vd_field(){};
00060   Hdf_vd_field &operator= (const Hdf_vd_field &hdf_vd);
00061 
00062   std::string get_name() const { return name; }
00063   int32 get_type() const { return type; }
00064   int32 get_order() const { return order; }
00065   int32 get_size() const { return size; }
00066   void set_name(const string& name) { this->name = name; }
00067   void set_type(const int32& type) { this->type = type; }
00068   void set_order(const int32& order) { this->order = order; }
00069   void set_size(const int32& size) { this->size = size; }
00070 
00071   int32 get_nb_attr() const { return attrs.size(); };
00078   Hdf_attr get_attribute(const char *attr_name) const;
00085   Hdf_attr get_attribute(const int32 &attr_idx) const;
00091   const bool has_attr( const char * attr_name ) const;
00098   void get_attr_value(const char *attr_name,void *value, int32 ival = 0) const;
00099 
00100   std::string to_string() const;
00101 };
00102 
00103 #endif