1 /* 2 * Copyright 2014, Rene Gollent, rene@gollent.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef IMAGE_DEBUG_LOADING_STATE_HANDLER_ROSTER_H 6 #define IMAGE_DEBUG_LOADING_STATE_HANDLER_ROSTER_H 7 8 9 #include <Locker.h> 10 #include <ObjectList.h> 11 12 13 class ImageDebugLoadingStateHandler; 14 class SpecificImageDebugInfoLoadingState; 15 16 17 typedef BObjectList<ImageDebugLoadingStateHandler> LoadingStateHandlerList; 18 19 20 class ImageDebugLoadingStateHandlerRoster { 21 public: 22 ImageDebugLoadingStateHandlerRoster(); 23 ~ImageDebugLoadingStateHandlerRoster(); 24 25 static ImageDebugLoadingStateHandlerRoster* 26 Default(); 27 static status_t CreateDefault(); 28 static void DeleteDefault(); 29 30 status_t Init(); 31 status_t RegisterDefaultHandlers(); 32 33 status_t FindStateHandler( 34 SpecificImageDebugInfoLoadingState* state, 35 ImageDebugLoadingStateHandler*& 36 _handler); 37 // returns a reference 38 39 bool RegisterHandler( 40 ImageDebugLoadingStateHandler* 41 handler); 42 void UnregisterHandler( 43 ImageDebugLoadingStateHandler* 44 handler); 45 46 private: 47 BLocker fLock; 48 LoadingStateHandlerList 49 fStateHandlers; 50 static ImageDebugLoadingStateHandlerRoster* 51 sDefaultInstance; 52 }; 53 54 55 #endif // IMAGE_DEBUG_LOADING_STATE_HANDLER_ROSTER_H 56 57