RecJobRecord Class Reference

#include <RecJobRecord.h>

Inheritance diagram for RecJobRecord:
Registry

List of all members.

Public Types

enum  ECodeType { kRoot, kMinosSoft }
typedef enum
RecJobRecord::ECodeType 
CodeType_t

Public Member Functions

const char * AsString (ECodeType codetype) const
 RecJobRecord ()
 RecJobRecord (const char *prodname, const char *codename, const char *hostname, const VldTimeStamp &timestamp)
virtual ~RecJobRecord ()
const char * GetProdName () const
const char * GetCodeName () const
const char * GetHostName () const
const VldTimeStampGetTimeStamp () const
std::string GetCodeVersion (ECodeType codetype) const
ReleaseType::Release_t GetProdReleaseType () const
virtual std::ostream & Print (std::ostream &os) const
virtual std::ostream & PrintStream (std::ostream &os) const
 Print to cout (without extraneous bits of Dump()).
virtual void Print (Option_t *option="") const

Static Public Member Functions

static void SetGlobalProdName (const char *prodname)
static const char * GetGlobalProdName ()

Private Attributes

VldTimeStamp fTimeStamp

Static Private Attributes

static std::string fgProdName = ""

Detailed Description

Definition at line 28 of file RecJobRecord.h.


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
kRoot 
kMinosSoft 

Definition at line 36 of file RecJobRecord.h.

00036                           {
00037      kRoot,
00038      kMinosSoft
00039    } CodeType_t;


Constructor & Destructor Documentation

RecJobRecord::RecJobRecord (  ) 

Definition at line 32 of file RecJobRecord.cxx.

References bfld::AsString(), gSystem(), and OscFit::kRoot.

00032                            {
00033   // Default constructor.  Fills data members from environment.  
00034 
00035   Set("ProdName",fgProdName.c_str());
00036   std::string codename = std::string(AsString(kMinosSoft)) + ":" 
00037           + std::string(gSystem->Getenv("SRT_BASE_RELEASE"));
00038   codename += " " + std::string(AsString(kRoot)) + ":v" 
00039                   + std::string(ROOT_RELEASE);
00040   Set("CodeName",codename.c_str());
00041   Set("HostName",gSystem->HostName());
00042   
00043 }

RecJobRecord::RecJobRecord ( const char *  prodname,
const char *  codename,
const char *  hostname,
const VldTimeStamp timestamp 
)

Definition at line 46 of file RecJobRecord.cxx.

References Registry::Set().

00048                                                           : 
00049                            fTimeStamp(timestamp) {
00050   // Normal constructor.  Fills data members from arguments.  To be used
00051   // in special cases when record not created in framework, e.g. for
00052   // gminos produced record.
00053   // Codename should be constructed using format:
00054   // "codetype:version codetype:version codetype:version" ...
00055   // where codetype is standardized as RecJobRecord::AsString(ECodeType type)
00056 
00057   Set("ProdName",prodname);
00058   Set("CodeName",codename);
00059   Set("HostName",hostname);
00060   
00061 }

virtual RecJobRecord::~RecJobRecord (  )  [inline, virtual]

Definition at line 47 of file RecJobRecord.h.

00047 {}


Member Function Documentation

const char * RecJobRecord::AsString ( ECodeType  codetype  )  const

Definition at line 104 of file RecJobRecord.cxx.

References Msg::kError, kMinosSoft, kRoot, and MSG.

Referenced by GetCodeVersion().

00104                                                            {
00105   // Purpose: Get code type AsString
00106 
00107   switch( codetype ) {
00108 
00109     case kRoot:
00110       return "root";
00111 
00112     case kMinosSoft:
00113       return "minossoft";
00114 
00115     default:
00116       MSG("Rec",Msg::kError) << "RecJobRecord::AsString received unknown "
00117                              << "enumerated code type " << codetype 
00118                              << "\nMethod needs updating. Abort." << endl;
00119       abort();
00120   } // end of switch
00121   
00122 }

const char* RecJobRecord::GetCodeName (  )  const [inline]

Definition at line 53 of file RecJobRecord.h.

References Registry::GetCharString().

Referenced by GetCodeVersion(), and Print().

00053 { return GetCharString("CodeName"); }

string RecJobRecord::GetCodeVersion ( ECodeType  codetype  )  const

Definition at line 125 of file RecJobRecord.cxx.

References AsString(), GetCodeName(), UtilString::StringTok(), and UtilString::ToLower().

00125                                                         {
00126   // Parse the CodeName for the code version corresponding to codetype 
00127   // AsString(type).  
00128   // The format of the CodeName is assumed to be:
00129   // "codetype:version codetype:version codetype:version ..."
00130   // If no matching codetype is found, return empty string.
00131 
00132   string codetype = string(AsString(type)) + ":";
00133   UtilString::ToLower(codetype);
00134   
00135   vector<string> codevec;
00136   UtilString::StringTok(codevec,string(GetCodeName())," ");
00137   
00138   vector<string>::const_iterator citr;
00139   for ( citr = codevec.begin(); citr != codevec.end(); citr++ ) {
00140     string codetok = *citr;
00141     string::size_type pos = codetok.find(codetype);
00142     if ( pos != string::npos ) {
00143       pos += codetype.size();
00144       return codetok.substr(pos);
00145     }
00146   }
00147   
00148   return "";
00149   
00150 }

static const char* RecJobRecord::GetGlobalProdName (  )  [inline, static]

Definition at line 34 of file RecJobRecord.h.

References fgProdName.

Referenced by reroot_configure().

00034 { return fgProdName.c_str(); }

const char* RecJobRecord::GetHostName (  )  const [inline]

Definition at line 55 of file RecJobRecord.h.

References Registry::GetCharString().

Referenced by Print().

00055 { return GetCharString("HostName"); }

const char* RecJobRecord::GetProdName (  )  const [inline]

Definition at line 51 of file RecJobRecord.h.

References Registry::GetCharString().

Referenced by GetProdReleaseType(), and Print().

00051 { return GetCharString("ProdName"); }

ReleaseType::Release_t RecJobRecord::GetProdReleaseType (  )  const

Definition at line 153 of file RecJobRecord.cxx.

References GetProdName(), ReleaseType::GetProductionRelease(), and ReleaseType::kUnknown.

Referenced by RecJobHistory::GetProdReleaseType().

00153                                                             {
00154   // Get release type corresponding to ProdName (e.g. "Dogwood0" or
00155   // "Daikon_04")
00156   // Return ReleaseType::kUnknown if unknown.
00157 
00158   ReleaseType::Release_t release = ReleaseType::kUnknown;
00159     
00160   std::string prodname = GetProdName();
00161   
00162   if ( prodname.empty() ) return release;
00163 
00164   release = ReleaseType::GetProductionRelease(prodname.c_str());
00165   return release;
00166   
00167 }

const VldTimeStamp& RecJobRecord::GetTimeStamp (  )  const [inline]

Definition at line 56 of file RecJobRecord.h.

References fTimeStamp.

Referenced by operator!=(), operator<(), operator==(), and operator>().

00056 { return fTimeStamp; }

void RecJobRecord::Print ( Option_t *  option = ""  )  const [virtual]

Reimplemented from Registry.

Definition at line 85 of file RecJobRecord.cxx.

References Print().

00085                                                       {
00086   //  Purpose:  Print header in form supported by TObject::Print.
00087 
00088   Print(std::cout);
00089 
00090   return;
00091 
00092 }

std::ostream & RecJobRecord::Print ( std::ostream &  os  )  const [virtual]

Definition at line 64 of file RecJobRecord.cxx.

References VldTimeStamp::AsString(), fTimeStamp, GetCodeName(), GetHostName(), and GetProdName().

Referenced by Print(), and PrintStream().

00064                                                     {
00065   //  Purpose:  Print status of record on ostream.
00066 
00067   std::string prodname = GetProdName();
00068   std::string codename = GetCodeName();
00069   
00070   if ( prodname.empty() ) {
00071     os << "[" << codename.c_str() << ((codename.empty()) ? "" : " ") 
00072        << GetHostName() << " " << fTimeStamp.AsString("s") << "]";
00073   }
00074   else {
00075     os << "[" << prodname.c_str() << " " << codename.c_str() 
00076        << ((codename.empty()) ? "" : " ") 
00077        << GetHostName() << " " << fTimeStamp.AsString("s") << "]";
00078   }
00079   
00080   return os;
00081 
00082 }

std::ostream & RecJobRecord::PrintStream ( std::ostream &  os  )  const [virtual]

Print to cout (without extraneous bits of Dump()).

Reimplemented from Registry.

Definition at line 95 of file RecJobRecord.cxx.

References Print().

00095                                                            {
00096   //  Purpose:  Print status of record on ostream, overriding base class
00097   //            PrintStream method.
00098 
00099   return Print(os);
00100 
00101 }

static void RecJobRecord::SetGlobalProdName ( const char *  prodname  )  [inline, static]

Definition at line 33 of file RecJobRecord.h.

References fgProdName.

00033 { fgProdName=prodname; }


Member Data Documentation

std::string RecJobRecord::fgProdName = "" [static, private]

Definition at line 69 of file RecJobRecord.h.

Referenced by GetGlobalProdName(), and SetGlobalProdName().

Definition at line 67 of file RecJobRecord.h.

Referenced by GetTimeStamp(), and Print().


The documentation for this class was generated from the following files:

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1