|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00013 #include <string.h> 00014 #include <stdexcept> 00015 #include <iostream> 00016 #include <sstream> 00017 #include <algorithm> 00018 00019 #include <stk_util/util/string_case_compare.hpp> 00020 #include <stk_mesh/base/MetaData.hpp> 00021 00022 namespace stk_classic { 00023 namespace mesh { 00024 00025 //---------------------------------------------------------------------- 00026 00027 Property<void>::~Property() {} 00028 00029 PropertyBase * 00030 MetaData::get_property_base( const std::string & name , 00031 const std::type_info & type , 00032 unsigned size ) const 00033 { 00034 PropertyBase * p = NULL ; 00035 { 00036 std::vector< PropertyBase * >::const_iterator i ; 00037 for ( i = m_properties.begin() ; 00038 i != m_properties.end() && not_equal_case( (*i)->name() , name ) ; 00039 ++i ); 00040 00041 if ( i != m_properties.end() ) { 00042 const bool error_type = ( (*i)->m_type != type ); 00043 const bool error_size = size && ( (*i)->m_size != size ); 00044 00045 ThrowErrorMsgIf( error_type, 00046 "For property name " << name << ": " << 00047 " actual_type(" << (*i)->m_type.name() << 00048 ") != request_type(" << type.name() << ")"); 00049 00050 ThrowErrorMsgIf( error_size, 00051 "For property name " << name << ": " << 00052 " actual_size(" << (*i)->m_size << 00053 ") != request_size(" << size << ")") ; 00054 p = *i; 00055 } 00056 } 00057 return p ; 00058 } 00059 00060 //---------------------------------------------------------------------- 00061 00062 } // namespace mesh 00063 } // namespace stk_classic 00064