]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/STEERBase/AliVersion.cxx
ARVersion update
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliVersion.cxx
1 #include "AliVersion.h"
2 #include "ARVersion.h"
3 #include <TClass.h>
4
5 AliVersion* AliVersion::fgInstance = 0;
6
7 AliVersion* AliVersion::Instance()
8 {
9   if (!fgInstance) fgInstance = new AliVersion;
10   return (AliVersion*)fgInstance;
11 }
12
13 AliVersion::AliVersion()
14   : TNamed("alirootVersion", "AliROOT Version"),
15     fHash(ALIROOT_REVISION),
16     fTag(ALIROOT_BRANCH)
17 {   SetUniqueID(ALIROOT_SERIAL); }
18
19 Int_t AliVersion::Compare(const TObject* o) const
20 {
21    if (!o->IsA()->InheritsFrom(AliVersion::Class()))
22      Fatal("Compare", "Cannot compare an AliVersion object to a %s object",
23            o->IsA()->GetName());
24    const AliVersion* av = static_cast<const AliVersion*>(o);
25    return (av->GetSerial() == GetSerial() ? 0 : 
26            av->GetSerial() >  GetSerial() ? -1 : 1);
27 }
28
29 void AliVersion::Print(Option_t *) const
30 {
31   // print aliroot version
32   printf("AliRoot serial:\t%d\nAliRoot hash:\t%s\nAliRoot tag:\t%s\n",GetSerial(),fTag.Data(),fHash.Data());
33 }