#include "TObjArray.h"
#include "TObjString.h"
#include "TProofNodeInfo.h"
ClassImp(TProofNodeInfo)
#define PNISETANY(a) \
  { if (os->String() != "-") { a; } \
    if (!(os = (TObjString *) nxos())) return; }
#define PNISETSTRING(s) PNISETANY(s = os->GetName())
#define PNISETINT(i) PNISETANY(i = os->String().Atoi())
TProofNodeInfo::TProofNodeInfo():
   fNodeType(kWorker),
   fPort(-1),
   fPerfIndex(100)
{
   
}
TProofNodeInfo::TProofNodeInfo(const char *str)
               : fNodeType(kWorker), fPort(-1), fPerfIndex(100)
{
   
   
   
   
   if (!str || strlen(str) <= 0)
      return;
   
   TString ss(str);
   TObjArray *oa = ss.Tokenize("|");
   if (!oa)
      return;
   TIter nxos(oa);
   TObjString *os = (TObjString *) nxos();
   if (!os)
      return;
   
   PNISETANY(fNodeType = GetNodeType(os->GetName()));
   
   PNISETSTRING(fNodeName);
   
   PNISETINT(fPort);
   
   PNISETSTRING(fOrdinal);
   
   PNISETSTRING(fId);
   
   PNISETINT(fPerfIndex);
   
   PNISETSTRING(fImage);
   
   PNISETSTRING(fWorkDir);
   
   PNISETSTRING(fMsd);
   
   PNISETSTRING(fConfig);
}
TProofNodeInfo::TProofNodeInfo(const TProofNodeInfo &nodeInfo) : TObject(nodeInfo)
{
   
   fNodeType  = nodeInfo.fNodeType;
   fNodeName  = nodeInfo.fNodeName;
   fWorkDir   = nodeInfo.fWorkDir;
   fOrdinal   = nodeInfo.fOrdinal;
   fImage     = nodeInfo.fImage;
   fId        = nodeInfo.fId;
   fConfig    = nodeInfo.fConfig;
   fMsd       = nodeInfo.fMsd;
   fPort      = nodeInfo.fPort;
   fPerfIndex = nodeInfo.fPerfIndex;
}
void TProofNodeInfo::Assign(const TProofNodeInfo &n)
{
   
   fNodeType  = n.fNodeType;
   fNodeName  = n.fNodeName;
   fWorkDir   = n.fWorkDir;
   fOrdinal   = n.fOrdinal;
   fImage     = n.fImage;
   fId        = n.fId;
   fConfig    = n.fConfig;
   fMsd       = n.fMsd;
   fPort      = n.fPort;
   fPerfIndex = n.fPerfIndex;
}
void TProofNodeInfo::Print(const Option_t *opt) const
{
   
   if (opt[0] == 'c' || opt[0] == 'C') {
      Printf("%d %s:%d %s %s", fNodeType, fNodeName.Data(), fPort,
                               fOrdinal.Data(), fWorkDir.Data());
   } else {
      Printf(" NodeType:      %d", fNodeType);
      Printf(" NodeName:      %s", fNodeName.Data());
      Printf(" WorkDir:       %s", fWorkDir.Data());
      Printf(" Ordinal:       %s", fOrdinal.Data());
      Printf(" Image:         %s", fImage.Data());
      Printf(" Id:            %s", fId.Data());
      Printf(" Config:        %s", fConfig.Data());
      Printf(" Msd:           %s", fMsd.Data());
      Printf(" Port:          %d", fPort);
      Printf(" Performance:   %d\n", fPerfIndex);
   }
}
TProofNodeInfo::ENodeType TProofNodeInfo::GetNodeType(const TString &type)
{
   
   
   ENodeType enType;
   if (type == "M" || type == "master") {
      enType = kMaster;
   }
   else if (type == "S" || type == "submaster") {
      enType = kSubMaster;
   }
   else { 
      enType = kWorker;
   }
   return enType;
}
Last change: Wed Jun 25 08:51:20 2008
Last generated: 2008-06-25 08:51
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.