17 #ifndef DISTRHO_LEAK_DETECTOR_HPP_INCLUDED 
   18 #define DISTRHO_LEAK_DETECTOR_HPP_INCLUDED 
   20 #include "../DistrhoUtils.hpp" 
   22 START_NAMESPACE_DISTRHO
 
   32 #define DISTRHO_JOIN_MACRO_HELPER(a, b) a ## b 
   33 #define DISTRHO_JOIN_MACRO(item1, item2) DISTRHO_JOIN_MACRO_HELPER(item1, item2) 
   50 #define DISTRHO_LEAK_DETECTOR(ClassName)                                          \ 
   51     friend class DISTRHO_NAMESPACE::LeakedObjectDetector<ClassName>;              \ 
   52     static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \ 
   53     DISTRHO_NAMESPACE::LeakedObjectDetector<ClassName> DISTRHO_JOIN_MACRO(leakDetector_, ClassName); 
   55 #define DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \ 
   56     DISTRHO_DECLARE_NON_COPY_CLASS(ClassName)                      \ 
   57     DISTRHO_LEAK_DETECTOR(ClassName) 
   71 template<
class OwnerClass>
 
   81         if (--(getCounter().numObjects) < 0)
 
   94             d_stderr2(
"*** Dangling pointer deletion! Class: '%s', Count: %i", getLeakedObjectClassName(), getCounter().numObjects);
 
  103         LeakCounter() noexcept
 
  106         ~LeakCounter() noexcept
 
  117                 d_stderr2(
"*** Leaked objects detected: %i instance(s) of class '%s'", numObjects, getLeakedObjectClassName());
 
  122         volatile int numObjects;
 
  125     static const char* getLeakedObjectClassName() noexcept
 
  127         return OwnerClass::getLeakedObjectClassName();
 
  130     static LeakCounter& getCounter() noexcept
 
  132         static LeakCounter counter;
 
  139 END_NAMESPACE_DISTRHO
 
  141 #endif // DISTRHO_LEAK_DETECTOR_HPP_INCLUDED 
Definition: d_leakdetector.hpp:72
~LeakedObjectDetector() noexcept
Definition: d_leakdetector.hpp:79