OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
types.hpp
Go to the documentation of this file.
1 #ifndef INTERPRETER_TYPES_H_INCLUDED
2 #define INTERPRETER_TYPES_H_INCLUDED
3 
4 #include <stdexcept>
5 
6 namespace Interpreter
7 {
8  typedef unsigned int Type_Code; // 32 bit
9 
10  typedef unsigned int Type_Data; // 32 bit
11 
12  typedef short Type_Short; // 16 bit
13 
14  typedef int Type_Integer; // 32 bit
15 
16  typedef float Type_Float; // 32 bit
17 
18  union Data
19  {
22  };
23 
24  template<typename T>
25  T& getData (Data& data)
26  {
27  throw std::runtime_error ("unsupported data type");
28  }
29 
30  template<>
31  inline Type_Integer& getData (Data& data)
32  {
33  return data.mInteger;
34  }
35 
36  template<>
37  inline Type_Float& getData (Data& data)
38  {
39  return data.mFloat;
40  }
41 }
42 
43 #endif
44 
Definition: types.hpp:18
unsigned int Type_Data
Definition: types.hpp:10
Type_Integer mInteger
Definition: types.hpp:20
T & getData(Data &data)
Definition: types.hpp:25
int Type_Integer
Definition: types.hpp:14
unsigned int Type_Code
Definition: types.hpp:8
Type_Float mFloat
Definition: types.hpp:21
short Type_Short
Definition: types.hpp:12
float Type_Float
Definition: types.hpp:16