#include "TList.h"
#include "TProof.h"
#include "TProofMgr.h"
#include "TROOT.h"
ClassImp(TProofMgr)
extern "C" {
TVirtualProofMgr *GetTProofMgr(const char *url, Int_t l, const char *al)
{ return ((TVirtualProofMgr *) new TProofMgr(url, l, al)); }
}
class TProofMgrInit {
public:
TProofMgrInit() {
TVirtualProofMgr::SetTProofMgrHook(&GetTProofMgr);
}};
static TProofMgrInit gproofmgr_init;
TProofMgr::TProofMgr(const char *url, Int_t, const char *alias)
: TVirtualProofMgr(url)
{
fServType = kProofd;
if (!strcmp(fUrl.GetProtocol(), TUrl("a").GetProtocol()))
fUrl.SetProtocol("proof");
if (strcmp(fUrl.GetHost(), fUrl.GetHostFQDN()))
fUrl.SetHost(fUrl.GetHostFQDN());
SetName(fUrl.GetUrl());
if (alias)
SetAlias(alias);
else
SetAlias(fUrl.GetHost());
}
TVirtualProof *TProofMgr::AttachSession(Int_t id, Bool_t)
{
TVirtualProofDesc *d = GetProofDesc(id);
if (d) {
if (d->GetProof())
return d->GetProof();
}
Info("AttachSession","invalid proofserv id (%d)", id);
return 0;
}
void TProofMgr::DetachSession(Int_t id, Option_t *opt)
{
TVirtualProofDesc *d = GetProofDesc(id);
if (d) {
if (d->GetProof())
d->GetProof()->Detach(opt);
fSessions->Remove(d);
delete d;
}
return;
}
TList *TProofMgr::QuerySessions(Option_t *opt)
{
if (opt && !strncasecmp(opt,"L",1))
return fSessions;
if (!fSessions) {
fSessions = new TList();
fSessions->SetOwner();
}
if (gROOT->GetListOfProofs()) {
TIter nxp(gROOT->GetListOfProofs());
TVirtualProof *p = 0;
Int_t ns = 0;
while ((p = (TVirtualProof *)nxp())) {
if (MatchUrl(p->GetUrl())) {
if (!(fSessions->FindObject(p->GetSessionTag()))) {
Int_t st = (p->IsIdle()) ? TVirtualProofDesc::kIdle
: TVirtualProofDesc::kRunning;
TVirtualProofDesc *d =
new TVirtualProofDesc(p->GetName(), p->GetTitle(), p->GetUrl(),
++ns, p->GetSessionID(), st, p);
fSessions->Add(d);
}
}
}
}
if (fSessions->GetSize() > 0) {
TIter nxd(fSessions);
TVirtualProofDesc *d = 0;
while ((d = (TVirtualProofDesc *)nxd())) {
if (d->GetProof()) {
if (!(gROOT->GetListOfProofs()->FindObject(d->GetProof()))) {
fSessions->Remove(d);
SafeDelete(d);
} else {
if (opt && !strncasecmp(opt,"S",1))
d->Print("");
}
}
}
}
return fSessions;
}
Int_t TProofMgr::Reset(const char *)
{
Warning("Reset","functionality not supported");
return -1;
}
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.