|
libGDF
|
00001 // 00002 // This file is part of libGDF. 00003 // 00004 // libGDF is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation, either version 3 of 00007 // the License, or (at your option) any later version. 00008 // 00009 // libGDF is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with libGDF. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // Copyright 2010 Martin Billinger 00018 00019 #include "GDF/Types.h" 00020 #include <boost/lexical_cast.hpp> 00021 00022 namespace gdf 00023 { 00024 size_t datatype_size( uint32 t ) 00025 { 00026 switch( t ) 00027 { 00028 case INT8: return sizeof( int8 ); break; 00029 case INT16: return sizeof( int16 ); break; 00030 case INT32: return sizeof( int32 ); break; 00031 case INT64: return sizeof( int64 ); break; 00032 case UINT8: return sizeof( uint8 ); break; 00033 case UINT16: return sizeof( uint16 ); break; 00034 case UINT32: return sizeof( uint32 ); break; 00035 case UINT64: return sizeof( uint64 ); break; 00036 case FLOAT32: return sizeof( float32 ); break; 00037 case FLOAT64: return sizeof( float64 ); break; 00038 default: 00039 throw exception::invalid_type_id( boost::lexical_cast<std::string>(t) ); 00040 } 00041 } 00042 }