haiku/headers/private/debugger/target_host_interface/TargetHostInterfaceRoster.h

80 lines
2.0 KiB
C
Raw Normal View History

/*
* Copyright 2016, Rene Gollent, rene@gollent.com.
* Distributed under the terms of the MIT License.
*/
#ifndef TARGET_HOST_INTERFACE_ROSTER_H
#define TARGET_HOST_INTERFACE_ROSTER_H
#include <OS.h>
#include <Locker.h>
#include <ObjectList.h>
#include "TargetHostInterface.h"
class Settings;
class TargetHostInterfaceInfo;
class TargetHostInterfaceRoster : private TargetHostInterface::Listener {
public:
class Listener;
TargetHostInterfaceRoster();
virtual ~TargetHostInterfaceRoster();
static TargetHostInterfaceRoster* Default();
static status_t CreateDefault(Listener* listener);
static void DeleteDefault();
bool Lock() { return fLock.Lock(); }
void Unlock() { fLock.Unlock(); }
status_t Init(Listener* listener);
status_t RegisterInterfaceInfos();
int32 CountInterfaceInfos() const;
TargetHostInterfaceInfo*
InterfaceInfoAt(int32 index) const;
status_t CreateInterface(TargetHostInterfaceInfo* info,
Settings* settings,
TargetHostInterface*& _interface);
int32 CountActiveInterfaces() const;
TargetHostInterface* ActiveInterfaceAt(int32 index) const;
int32 CountRunningTeamDebuggers() const
{ return fRunningTeamDebuggers; }
// TargetHostInterface::Listener
virtual void TeamDebuggerStarted(TeamDebugger* debugger);
virtual void TeamDebuggerQuit(TeamDebugger* debugger);
virtual void TargetHostInterfaceQuit(
TargetHostInterface* interface);
Debugger: Rework to fully use TargetHostInterface. Application objects: - Rework and simplify to take into account that they will no longer be directly managing the team debugger list. Requests to start a new debugger are still funnelled through here however, and as such, said requests must now provide the appropriate target host to start with. Adjust StartTeamWindow and TeamsWindow accordingly. - On global init, always create an instance of the local interface. TargetHostInterface: - Convert to BLooper and implement TeamDebugger's Listener interface. TargetHostInterfaces now directly manage their TeamDebugger instances, and consequently take over the equivalent duties that the main application previously had. - Adjust signatures of Attach/CreateTeam to add const. Adjust LocalTargetHostInterface accordingly. - Add accessor to determine if a given interface is local or not. Will be needed for the TeamDebugger's file manager eventually so it knows if it needs to request remote files if no matching local file is found. - Add accessor to start a TeamDebugger instance, and corresponding options structure. TargetHostInterfaceRoster: - Minor adjustments to host interface initialization to take into account needing to start the looper. - Add accessor for number of running team debuggers, for the main app to use when deciding to quit. TeamDebugger: - Add accessor for SettingsManager. Needed for the case of a restart request, as the host interfaces do not have direct access to it. TeamsWindow: - For now, always grab the local host interface when initializing the window. Once the remote interface is implemented, this will need to be adjusted, but the appropriate UI for creating/selecting it is needed first anyways. With these changes, the main application is fully host-agnostic, and all management of actual debuggers is delegated to their parent host interfaces. There still needs to be a listener interface for the host interface and/or roster though, so that the application can be made aware of when debuggers quit, as this drives whether it's time to terminate the app or not.
2016-04-21 02:23:01 +03:00
private:
typedef BObjectList<TargetHostInterfaceInfo> InfoList;
typedef BObjectList<TargetHostInterface> InterfaceList;
private:
BLocker fLock;
static TargetHostInterfaceRoster* sDefaultInstance;
int32 fRunningTeamDebuggers;
InfoList fInterfaceInfos;
InterfaceList fActiveInterfaces;
Listener* fListener;
};
class TargetHostInterfaceRoster::Listener {
public:
virtual ~Listener();
virtual void TeamDebuggerCountChanged(int32 newCount);
};
#endif // TARGET_HOST_INTERFACE_ROSTER_H