11299bfb2Sbeveloper /* 21299bfb2Sbeveloper * Copyright 2002, Marcus Overhagen. All rights reserved. 31299bfb2Sbeveloper * Distributed under the terms of the MIT License. 41299bfb2Sbeveloper */ 56fcead13SAxel Dörfler #ifndef APP_MANAGER_H 66fcead13SAxel Dörfler #define APP_MANAGER_H 752a38012Sejakowatz 852a38012Sejakowatz 96fcead13SAxel Dörfler #include <map> 106fcead13SAxel Dörfler 116fcead13SAxel Dörfler #include <Locker.h> 126fcead13SAxel Dörfler #include <Messenger.h> 136fcead13SAxel Dörfler 146fcead13SAxel Dörfler 156fcead13SAxel Dörfler class AppManager : BLocker { 1652a38012Sejakowatz public: 1752a38012Sejakowatz AppManager(); 1852a38012Sejakowatz ~AppManager(); 196396865dSbeveloper 206fcead13SAxel Dörfler status_t RegisterTeam(team_id team, 216fcead13SAxel Dörfler const BMessenger& messenger); 226fcead13SAxel Dörfler status_t UnregisterTeam(team_id team); 236fcead13SAxel Dörfler bool HasTeam(team_id team); 2428a06094Sbeveloper 25*9c3b4706SAxel Dörfler team_id AddOnServerTeam(); 266396865dSbeveloper 276fcead13SAxel Dörfler status_t SendMessage(team_id team, BMessage* message); 28359ac306Sbeveloper 29ced4130fSbeveloper void Dump(); 30ced4130fSbeveloper 3152a38012Sejakowatz private: 326fcead13SAxel Dörfler void _CleanupTeam(team_id team); 336fcead13SAxel Dörfler void _TeamDied(team_id team); 346fcead13SAxel Dörfler 356fcead13SAxel Dörfler static status_t _BigBrotherEntry(void* self); 366fcead13SAxel Dörfler void _BigBrother(); 376396865dSbeveloper 386396865dSbeveloper private: 396fcead13SAxel Dörfler typedef std::map<team_id, BMessenger> AppMap; 406fcead13SAxel Dörfler 416fcead13SAxel Dörfler AppMap fMap; 426396865dSbeveloper thread_id fBigBrother; 436396865dSbeveloper sem_id fQuit; 4452a38012Sejakowatz }; 4528a06094Sbeveloper 466fcead13SAxel Dörfler 476fcead13SAxel Dörfler #endif // APP_MANAGER_H 48