Changeset 147 for libcrash

Show
Ignore:
Timestamp:
08/01/05 09:39:47 (3 years ago)
Author:
athomas
Message:
  • Added an unregister_extension method to the component pattern.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libcrash/trunk/crash/Component.h

    r146 r147  
    2525                static void register_interface(T *interface) { 
    2626                        Singleton<ExtensionPoint<T> >::singleton().mextensioninstances.push_back(interface); 
     27                } 
     28 
     29                static void unregister_interface(T *interface) { 
     30                        for (iterator i = begin(); i != end(); ++i) 
     31                                if ((*i) == interface) { 
     32                                        Singleton<ExtensionPoint<T> >::singleton().mextensioninstances.erase(i); 
     33                                        break; 
     34                                } 
    2735                } 
    2836 
     
    7381                } 
    7482        protected : 
    75                 virtual ~Interface() {} 
     83                virtual ~Interface() { 
     84                        ExtensionPoint<T>::unregister_interface(static_cast<T*>(this)); 
     85                } 
    7686 
    7787                Interface() {