add new method GetTypeOfPath to TMusrRunHeader. It allows deduce the type of a given path-name.

This commit is contained in:
suter_a 2021-02-06 19:05:40 +01:00
parent bfd7229252
commit 90fb81f16a
2 changed files with 64 additions and 0 deletions

View File

@ -394,6 +394,68 @@ Bool_t TMusrRunHeader::FillFolder(TFolder *folder)
return true; return true;
} }
//--------------------------------------------------------------------------
// GetTypeOfPath (public)
//--------------------------------------------------------------------------
/**
* <p>Get type of path-name, e.g. RunInfo/Sample Name.
*
* @param pathName path-name for which the type is requested
*
* @return the type, or 'undef' if path-name is not found.
*/
TString TMusrRunHeader::GetTypeOfPath(TString pathName)
{
TString type("undef");
// find pathName
for (Int_t i=0; i<fStringObj.size(); i++) {
if (fStringObj[i].GetPathName() == pathName) {
type = fStringObj[i].GetType();
return type;
}
}
for (Int_t i=0; i<fIntObj.size(); i++) {
if (fIntObj[i].GetPathName() == pathName) {
type = fIntObj[i].GetType();
return type;
}
}
for (Int_t i=0; i<fDoubleObj.size(); i++) {
if (fDoubleObj[i].GetPathName() == pathName) {
type = fDoubleObj[i].GetType();
return type;
}
}
for (Int_t i=0; i<fMusrRunPhysQuantityObj.size(); i++) {
if (fMusrRunPhysQuantityObj[i].GetPathName() == pathName) {
type = fMusrRunPhysQuantityObj[i].GetType();
return type;
}
}
for (Int_t i=0; i<fStringVectorObj.size(); i++) {
if (fStringVectorObj[i].GetPathName() == pathName) {
type = fStringVectorObj[i].GetType();
return type;
}
}
for (Int_t i=0; i<fIntVectorObj.size(); i++) {
if (fIntVectorObj[i].GetPathName() == pathName) {
type = fIntVectorObj[i].GetType();
return type;
}
}
for (Int_t i=0; i<fDoubleVectorObj.size(); i++) {
if (fDoubleVectorObj[i].GetPathName() == pathName) {
type = fDoubleVectorObj[i].GetType();
return type;
}
}
return type;
}
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Get (public) // Get (public)
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@ -133,6 +133,8 @@ public:
virtual Bool_t ExtractAll(TFolder *folder); virtual Bool_t ExtractAll(TFolder *folder);
virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path); virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path);
virtual TString GetTypeOfPath(TString pathName);
virtual void Get(TString pathName, TString &value, Bool_t &ok); virtual void Get(TString pathName, TString &value, Bool_t &ok);
virtual void Get(TString pathName, Int_t &value, Bool_t &ok); virtual void Get(TString pathName, Int_t &value, Bool_t &ok);
virtual void Get(TString pathName, Double_t &value, Bool_t &ok); virtual void Get(TString pathName, Double_t &value, Bool_t &ok);