~ubuntu-branches/ubuntu/utopic/ardour3/utopic

« back to all changes in this revision

Viewing changes to libs/audiographer/audiographer/debug_utils.h

  • Committer: Package Import Robot
  • Author(s): Felipe Sateler
  • Date: 2013-09-21 19:05:02 UTC
  • Revision ID: package-import@ubuntu.com-20130921190502-8gsftrku6jnzhd7v
Tags: upstream-3.4~dfsg
ImportĀ upstreamĀ versionĀ 3.4~dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef AUDIOGRAPHER_DEBUG_UTILS_H
 
2
#define AUDIOGRAPHER_DEBUG_UTILS_H
 
3
 
 
4
#include "flag_field.h"
 
5
 
 
6
#include <cstdlib>
 
7
#include <string>
 
8
 
 
9
#ifdef __GNUC__
 
10
#include <cxxabi.h>
 
11
#endif
 
12
 
 
13
namespace AudioGrapher
 
14
{
 
15
 
 
16
/// Utilities for debugging
 
17
struct DebugUtils
 
18
{
 
19
        /// Returns the demangled name of the object passed as the parameter
 
20
        template<typename T>
 
21
        static std::string demangled_name (T const & obj)
 
22
        {
 
23
#ifdef __GNUC__
 
24
                int status;
 
25
                char * res = abi::__cxa_demangle (typeid(obj).name(), 0, 0, &status);
 
26
                if (status == 0) {
 
27
                        std::string s(res);
 
28
                        std::free (res);
 
29
                        return s;
 
30
                }
 
31
#endif
 
32
                return typeid(obj).name();
 
33
        }
 
34
        
 
35
        /// Returns name of ProcessContext::Flag
 
36
        static std::string process_context_flag_name (FlagField::Flag flag);
 
37
};
 
38
 
 
39
} // namespace
 
40
 
 
41
#endif // AUDIOGRAPHER_DEBUG_UTILS_H