haiku/headers/private/debugger/model/TargetHost.h
Rene Gollent fce4895d18 Debugger: Split into core library and application.
- Add subfolder src/kits/debugger which contains the debugger's core
  functionality and lower layers. Correspondingly add headers/private/debugger
  for shared headers to be used by clients such as the Debugger application
  and eventual remote_debug_server. Adjust various files to account for
  differences as a result of the split and moves.
- Add libdebugger.so to minimal Jamfile.
2016-06-04 13:18:39 -04:00

75 lines
1.7 KiB
C++

/*
* Copyright 2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_HOST_H
#define TARGET_HOST_H
#include <Locker.h>
#include <OS.h>
#include <String.h>
#include <ObjectList.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
class TeamInfo;
class TargetHost : public BReferenceable {
public:
class Listener;
public:
TargetHost(const BString& name);
virtual ~TargetHost();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
const BString& Name() const { return fName; }
void AddListener(Listener* listener);
void RemoveListener(Listener* listener);
int32 CountTeams() const;
status_t AddTeam(const team_info& info);
void RemoveTeam(team_id team);
void UpdateTeam(const team_info& info);
TeamInfo* TeamInfoAt(int32 index) const;
TeamInfo* TeamInfoByID(team_id team) const;
private:
typedef DoublyLinkedList<Listener> ListenerList;
typedef BObjectList<TeamInfo> TeamInfoList;
private:
static int _CompareTeams(const TeamInfo* a,
const TeamInfo* b);
static int _FindTeamByKey(const team_id* id,
const TeamInfo* info);
void _NotifyTeamAdded(TeamInfo* info);
void _NotifyTeamRemoved(team_id team);
void _NotifyTeamRenamed(TeamInfo* info);
private:
BString fName;
BLocker fLock;
ListenerList fListeners;
TeamInfoList fTeams;
};
class TargetHost::Listener
: public DoublyLinkedListLinkImpl<TargetHost::Listener> {
public:
virtual ~Listener();
virtual void TeamAdded(TeamInfo* info);
virtual void TeamRemoved(team_id team);
virtual void TeamRenamed(TeamInfo* info);
};
#endif // TARGET_HOST_H