VTK
ADIOSAttribute.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: ADIOSAttribute.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 #ifndef _ADIOSAttribute_h
16 #define _ADIOSAttribute_h
17 #ifndef __VTK_WRAP__
18 #ifndef VTK_WRAPPING_CXX
19 
20 #include <string>
21 #include <vector>
22 
23 #include <adios_read.h>
24 
25 #include "ADIOSUtilities.h"
26 
27 namespace ADIOS
28 {
29 
30 class Attribute
31 {
32 public:
33  Attribute(ADIOS_FILE *f, int id);
34  ~Attribute(void);
35 
36  const int& GetId() const;
37  const ADIOS_DATATYPES& GetType() const;
38  const std::string& GetName(void) const;
39 
40  template<typename T>
41  const T GetValue() const
42  {
43  ReadError::TestEq(this->Type, Type::NativeToADIOS<T>(), "Invalid type");
44 
45  return *reinterpret_cast<const T*>(this->Value);
46  }
47 
48 protected:
49  int Id;
50  ADIOS_DATATYPES Type;
52  void* Value;
53 };
54 template<> const std::string Attribute::GetValue<std::string>() const;
55 
56 } // End namespace ADIOS
57 #endif
58 #endif
59 #endif // _ADIOSAttribute_h
60 // VTK-HeaderTest-Exclude: ADIOSAttribute.h
std::string Name
Attribute(ADIOS_FILE *f, int id)
const std::string & GetName(void) const
const T GetValue() const
static void TestEq(const T &expected, const T &actual, const std::string &msg="")
const ADIOS_DATATYPES & GetType() const
ADIOS_DATATYPES Type
const int & GetId() const