1/* 2 * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef TEAM_H 6#define TEAM_H 7 8#include <String.h> 9 10#include <debug_support.h> 11#include <ObjectList.h> 12#include <Referenceable.h> 13#include <util/DoublyLinkedList.h> 14 15#include "Thread.h" 16 17 18class Image; 19class SharedImage; 20struct system_profiler_team_added; 21 22 23class Team : public BReferenceable { 24public: 25 Team(); 26 ~Team(); 27 28 status_t Init(team_id teamID, port_id debuggerPort); 29 status_t Init(system_profiler_team_added* addedInfo); 30 status_t InitThread(Thread* thread); 31 32 void RemoveThread(Thread* thread); 33 34 void Exec(int32 event, const char* args, 35 const char* threadName); 36 37 status_t AddImage(SharedImage* sharedImage, 38 const image_info& imageInfo, team_id owner, 39 int32 event); 40 status_t RemoveImage(image_id imageID, int32 event); 41 42 inline const BObjectList<Image>& Images() const; 43 Image* FindImage(image_id id) const; 44 45 inline team_id ID() const; 46 47private: 48 void _RemoveImage(int32 index, int32 event); 49 50 bool _SynchronousProfiling() const 51 { return fDebugContext.nub_port < 0; } 52 53private: 54 typedef DoublyLinkedList<Thread> ThreadList; 55 56 team_id fID; 57 BString fArgs; 58 port_id fNubPort; 59 debug_context fDebugContext; 60 ThreadList fThreads; 61 BObjectList<Image> fImages; 62}; 63 64 65// #pragma mark - 66 67 68const BObjectList<Image>& 69Team::Images() const 70{ 71 return fImages; 72} 73 74 75team_id 76Team::ID() const 77{ 78 return fID; 79} 80 81 82#endif // TEAM_H 83