00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "TObjArray.h"
00023 #include "TObjString.h"
00024 #include "TProofNodeInfo.h"
00025
00026 ClassImp(TProofNodeInfo)
00027
00028
00029 #define PNISETANY(a) \
00030 { if (os->String() != "-") { a; } \
00031 if (!(os = (TObjString *) nxos())) return; }
00032 #define PNISETSTRING(s) PNISETANY(s = os->GetName())
00033 #define PNISETINT(i) PNISETANY(i = os->String().Atoi())
00034
00035
00036 TProofNodeInfo::TProofNodeInfo():
00037 fNodeType(kWorker),
00038 fPort(-1),
00039 fPerfIndex(100)
00040 {
00041
00042 }
00043
00044
00045 TProofNodeInfo::TProofNodeInfo(const char *str)
00046 : fNodeType(kWorker), fPort(-1), fPerfIndex(100)
00047 {
00048
00049
00050
00051
00052
00053 if (!str || strlen(str) <= 0)
00054 return;
00055
00056
00057 TString ss(str);
00058 TObjArray *oa = ss.Tokenize("|");
00059 if (!oa)
00060 return;
00061 TIter nxos(oa);
00062 TObjString *os = (TObjString *) nxos();
00063 if (!os)
00064 return;
00065
00066
00067 PNISETANY(fNodeType = GetNodeType(os->GetName()));
00068
00069
00070 PNISETSTRING(fNodeName);
00071
00072
00073 PNISETINT(fPort);
00074
00075
00076 PNISETSTRING(fOrdinal);
00077
00078
00079 PNISETSTRING(fId);
00080
00081
00082 PNISETINT(fPerfIndex);
00083
00084
00085 PNISETSTRING(fImage);
00086
00087
00088 PNISETSTRING(fWorkDir);
00089
00090
00091 PNISETSTRING(fMsd);
00092
00093
00094 PNISETSTRING(fConfig);
00095 }
00096
00097
00098 TProofNodeInfo::TProofNodeInfo(const TProofNodeInfo &nodeInfo) : TObject(nodeInfo)
00099 {
00100
00101
00102 fNodeType = nodeInfo.fNodeType;
00103 fNodeName = nodeInfo.fNodeName;
00104 fWorkDir = nodeInfo.fWorkDir;
00105 fOrdinal = nodeInfo.fOrdinal;
00106 fImage = nodeInfo.fImage;
00107 fId = nodeInfo.fId;
00108 fConfig = nodeInfo.fConfig;
00109 fMsd = nodeInfo.fMsd;
00110 fPort = nodeInfo.fPort;
00111 fPerfIndex = nodeInfo.fPerfIndex;
00112 }
00113
00114
00115 void TProofNodeInfo::Assign(const TProofNodeInfo &n)
00116 {
00117
00118
00119 fNodeType = n.fNodeType;
00120 fNodeName = n.fNodeName;
00121 fWorkDir = n.fWorkDir;
00122 fOrdinal = n.fOrdinal;
00123 fImage = n.fImage;
00124 fId = n.fId;
00125 fConfig = n.fConfig;
00126 fMsd = n.fMsd;
00127 fPort = n.fPort;
00128 fPerfIndex = n.fPerfIndex;
00129 }
00130
00131
00132 void TProofNodeInfo::Print(const Option_t *opt) const
00133 {
00134
00135
00136 if (opt[0] == 'c' || opt[0] == 'C') {
00137 Printf("%d %s:%d %s %s", fNodeType, fNodeName.Data(), fPort,
00138 fOrdinal.Data(), fWorkDir.Data());
00139 } else {
00140 Printf(" NodeType: %d", fNodeType);
00141 Printf(" NodeName: %s", fNodeName.Data());
00142 Printf(" WorkDir: %s", fWorkDir.Data());
00143 Printf(" Ordinal: %s", fOrdinal.Data());
00144 Printf(" Image: %s", fImage.Data());
00145 Printf(" Id: %s", fId.Data());
00146 Printf(" Config: %s", fConfig.Data());
00147 Printf(" Msd: %s", fMsd.Data());
00148 Printf(" Port: %d", fPort);
00149 Printf(" Performance: %d\n", fPerfIndex);
00150 }
00151 }
00152
00153
00154 TProofNodeInfo::ENodeType TProofNodeInfo::GetNodeType(const TString &type)
00155 {
00156
00157
00158
00159 ENodeType enType;
00160
00161 if (type == "M" || type == "master") {
00162 enType = kMaster;
00163 }
00164 else if (type == "S" || type == "submaster") {
00165 enType = kSubMaster;
00166 }
00167 else {
00168 enType = kWorker;
00169 }
00170
00171 return enType;
00172 }