23 #include "openPMD/config.hpp" 
   24 #if openPMD_HAVE_ADIOS2 
   31 #include <type_traits> 
   33 #include "openPMD/Datatype.hpp" 
   44     template< 
typename T >
 
   76             char *destroy = 
nullptr;
 
  100         std::vector< char > m_rawBuffer;
 
  101         std::map< std::string, AttributeLocation > m_offsets;
 
  136         template< 
typename T >
 
  139         Datatype attributeType( std::string 
const & name ) 
const;
 
  142     template< 
typename T >
 
  146         auto it = m_offsets.find( name );
 
  147         if( it == m_offsets.end() )
 
  149             throw std::runtime_error(
 
  150                 "[ADIOS2] Requested attribute not found: " + name );
 
  153         Datatype determinedDatatype = determineDatatype< T >();
 
  154         if( std::is_same< T, signed char >::value )
 
  159             determinedDatatype = Datatype::CHAR;
 
  161         if( location.dt != determinedDatatype )
 
  163             std::stringstream errorMsg;
 
  164             errorMsg << 
"[ADIOS2] Wrong datatype for attribute: " << name
 
  165                      << 
"(location.dt=" << location.dt
 
  166                      << 
", T=" << determineDatatype< T >() << 
")";
 
  167             throw std::runtime_error( errorMsg.str() );
 
  170         res.shape = location.shape;
 
  172             reinterpret_cast< T const * 
>( &m_rawBuffer[ location.offset ] );
 
  178 #endif // openPMD_HAVE_ADIOS2