11299bfb2Sbeveloper /* 21299bfb2Sbeveloper * Copyright 2002, Marcus Overhagen. All rights reserved. 31299bfb2Sbeveloper * Distributed under the terms of the MIT License. 41299bfb2Sbeveloper */ 5*6fcead13SAxel Dörfler #ifndef APP_MANAGER_H 6*6fcead13SAxel Dörfler #define APP_MANAGER_H 752a38012Sejakowatz 852a38012Sejakowatz 9*6fcead13SAxel Dörfler #include <map> 10*6fcead13SAxel Dörfler 11*6fcead13SAxel Dörfler #include <Locker.h> 12*6fcead13SAxel Dörfler #include <Messenger.h> 13*6fcead13SAxel Dörfler 14*6fcead13SAxel Dörfler 15*6fcead13SAxel Dörfler class AppManager : BLocker { 1652a38012Sejakowatz public: 1752a38012Sejakowatz AppManager(); 1852a38012Sejakowatz ~AppManager(); 196396865dSbeveloper 20*6fcead13SAxel Dörfler status_t RegisterTeam(team_id team, 21*6fcead13SAxel Dörfler const BMessenger& messenger); 22*6fcead13SAxel Dörfler status_t UnregisterTeam(team_id team); 23*6fcead13SAxel Dörfler bool HasTeam(team_id team); 2428a06094Sbeveloper 2528a06094Sbeveloper team_id AddonServerTeam(); 266396865dSbeveloper 27*6fcead13SAxel Dörfler status_t SendMessage(team_id team, BMessage* message); 28359ac306Sbeveloper 29ced4130fSbeveloper void Dump(); 30ced4130fSbeveloper 3152a38012Sejakowatz private: 32*6fcead13SAxel Dörfler void _CleanupTeam(team_id team); 33*6fcead13SAxel Dörfler void _TeamDied(team_id team); 34*6fcead13SAxel Dörfler 35*6fcead13SAxel Dörfler static status_t _BigBrotherEntry(void* self); 36*6fcead13SAxel Dörfler void _BigBrother(); 376396865dSbeveloper 386396865dSbeveloper private: 39*6fcead13SAxel Dörfler typedef std::map<team_id, BMessenger> AppMap; 40*6fcead13SAxel Dörfler 41*6fcead13SAxel Dörfler AppMap fMap; 426396865dSbeveloper thread_id fBigBrother; 436396865dSbeveloper sem_id fQuit; 4452a38012Sejakowatz }; 4528a06094Sbeveloper 46*6fcead13SAxel Dörfler 47*6fcead13SAxel Dörfler #endif // APP_MANAGER_H 48