/*************************************************************************** * Copyright (C) 2006 by Fabrice DUCOS * * fabrice.ducos@icare.univ-lille1.fr * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "Hdf_vd_field.hpp" Hdf_vd_field::Hdf_vd_field(const char *vd_name,const int32 &type, const int32 &order, const int32 &size, const int32& vd_id, const int32& field_idx) : name(vd_name),type(type),order(order),size(size){ // if the necessary parametres are given (the VData ID and the field index), it is possible to read the field's attributes if (vd_id!=-1 && field_idx!=-1) { // read the number attributes int32 nb_attr=VSfnattrs(vd_id,field_idx); if (nb_attr==FAIL) { bad_vs_fnattrs e(name,field_idx); throw e; } // read the attributes infos char attr_name[VSNAMELENMAX]; int32 attr_type,attr_nvalues,size; intn status_n; for (intn iattr=0;iattr=(int32)attrs.size()) { bad_attribute_index e(name,attr_idx,VDATA); throw e; } return attrs[attr_idx]; } const bool Hdf_vd_field::has_attr( const char * attr_name ) const { return ( get_attr_idx(attr_name)!=-1 ); } void Hdf_vd_field::get_attr_value( const char * attr_name, void * value, int32 ival ) const { Hdf_attr attr = get_attribute(attr_name); // throw a bad_attribute_name if the attribute doesn't exist attr.get_value(value,ival); } std::string Hdf_vd_field::to_string() const { using namespace std; ostringstream s; s << name << ", type: " << Hdf_common::hdf_cstr_type(type) << ", order: " << order << ", size: " << size ; int nb_attrs=attrs.size(); if (nb_attrs>0) { s <