Sierra Toolkit  Version of the Day
Property.cpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
13 #include <string.h>
14 #include <stdexcept>
15 #include <iostream>
16 #include <sstream>
17 #include <algorithm>
18 
19 #include <stk_util/util/string_case_compare.hpp>
20 #include <stk_mesh/base/MetaData.hpp>
21 
22 namespace stk_classic {
23 namespace mesh {
24 
25 //----------------------------------------------------------------------
26 
27 Property<void>::~Property() {}
28 
29 PropertyBase *
30 MetaData::get_property_base( const std::string & name ,
31  const std::type_info & type ,
32  unsigned size ) const
33 {
34  PropertyBase * p = NULL ;
35  {
36  std::vector< PropertyBase * >::const_iterator i ;
37  for ( i = m_properties.begin() ;
38  i != m_properties.end() && not_equal_case( (*i)->name() , name ) ;
39  ++i );
40 
41  if ( i != m_properties.end() ) {
42  const bool error_type = ( (*i)->m_type != type );
43  const bool error_size = size && ( (*i)->m_size != size );
44 
45  ThrowErrorMsgIf( error_type,
46  "For property name " << name << ": " <<
47  " actual_type(" << (*i)->m_type.name() <<
48  ") != request_type(" << type.name() << ")");
49 
50  ThrowErrorMsgIf( error_size,
51  "For property name " << name << ": " <<
52  " actual_size(" << (*i)->m_size <<
53  ") != request_size(" << size << ")") ;
54  p = *i;
55  }
56  }
57  return p ;
58 }
59 
60 //----------------------------------------------------------------------
61 
62 } // namespace mesh
63 } // namespace stk_classic
64 
bool not_equal_case(const char *lhs, const char *rhs)
Case-insensitive inequality compare.
Sierra Toolkit.