oomph::TypeNames Namespace Reference

Functions

template<class T >
std::string get_type_name (T &obj)
 
template<class T >
std::string get_type_name (T *obj)
 

Function Documentation

◆ get_type_name() [1/2]

template<class T >
std::string oomph::TypeNames::get_type_name ( T obj)

Get the type name of an object. Only for use in debugging, do not write real code using this function as it is implementation dependant!

227  {
228  using namespace StringConversion;
229 
230  int status;
231  std::string typestr =
232  to_string(abi::__cxa_demangle(typeid(obj).name(), 0, 0, &status));
233 
234  // Throw if there was an error
235  if (status != 0)
236  {
237  std::string err = "Error code " + to_string(status) +
238  " in demangler, see documentation of "
239  "abi::__cxa_demangle for the meaning";
240  throw OomphLibError(
242  }
243 
244  return typestr;
245  }
std::string string(const unsigned &i)
Definition: oomph_definitions.cc:286
std::string to_string(T object, unsigned float_precision=8)
Definition: oomph_utilities.h:189
string name
Definition: plotDoE.py:33
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References plotDoE::name, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::Global_string_for_annotation::string(), and oomph::StringConversion::to_string().

Referenced by get_type_name().

◆ get_type_name() [2/2]

template<class T >
std::string oomph::TypeNames::get_type_name ( T obj)

Get the type name of an object from a pointer to the object (we usually want the type of the object itself not the pointer because the type of the pointer may be a base class). Only for use in debugging, do not write real code using this function as it is implementation dependant!

254  {
255  return get_type_name(*obj);
256  }
std::string get_type_name(T *obj)
Definition: oomph_utilities.h:253

References get_type_name().