Mania++
 All Classes Functions Variables Pages
Parameter.h
1 #ifndef PARAMETER_H_
2 #define PARAMETER_H_
3 
4 #include <typeinfo>
5 #include <cxxabi.h>
6 
7 //* Parameter
11 struct Parameter
12 {
13  void* pointer;
14  const std::type_info* typeinfo;
21  template<typename T>
22  Parameter(T* input)
23  {
24  pointer = input;
25  typeinfo = &typeid(T);
26  }
27 
34  Parameter(void* input, const std::type_info* type)
35  {
36  pointer = input;
37  typeinfo = type;
38  }
39 
43  std::string GetType()
44  {
45  int status;
46  char* realParamName = abi::__cxa_demangle(typeinfo->name(), 0, 0, &status);
47  std::string paramType = std::string(realParamName);
48 
49  free(realParamName);
50  realParamName = NULL;
51 
52  return paramType;
53  }
54 };
55 
56 #endif // PARAMETER_H_
Parameter(T *input)
Updates properties with input information.
Definition: Parameter.h:22
std::string GetType()
Returns demangled type information.
Definition: Parameter.h:43
void * pointer
Pointer to the parameter.
Definition: Parameter.h:13
const std::type_info * typeinfo
Type information of the parameter.
Definition: Parameter.h:14
Pointer and type information of a parameter.
Definition: Parameter.h:11
Parameter(void *input, const std::type_info *type)
Updates properties with input information.
Definition: Parameter.h:34