KaliVeda
Toolkit for HIC analysis
Hexa_t.h
1 #ifndef __HEXA_T__
2 #define __HEXA_T__
3 
4 #include "Rtypes.h"
5 #include "Riostream.h"
6 #include "TString.h"
7 
15 class Hexa_t {
16 private:
18  static TString fPrefix;
19 
20 public:
21  Hexa_t();
22  Hexa_t(const Long64_t);
23  Hexa_t(const Char_t*);
24  Hexa_t(const Hexa_t& other) : fVal(other.fVal) {}
25  virtual ~ Hexa_t()
26  {
27  };
29 
30  static void SetPrefix(const Char_t* pref)
31  {
32  fPrefix = pref;
33  };
34  static const Char_t* GetPrefix()
35  {
36  return fPrefix.Data();
37  };
38 
39  void Set(const Long64_t);
40  Long64_t Value() const;
41  void Set(const Char_t*);
42  const Char_t* String(UChar_t nbits = 0) const;
43 
44  void SetBit(UChar_t, Long64_t = -1);
45  void ResetBit(UChar_t);
47 
48  Hexa_t& operator=(const Long64_t);
49  Hexa_t& operator=(const Char_t*);
51  Hexa_t& operator=(const Hexa_t&);
53  operator Int_t() const
54  {
55  return (Int_t) Value();
56  };
57  operator Long64_t() const
58  {
59  return Value();
60  };
61  operator Float_t() const
62  {
63  return (Float_t) Value();
64  };
65  operator Double_t() const
66  {
67  return (Double_t) Value();
68  };
69  operator const char* () const
70  {
71  return String();
72  };
73 
74  Hexa_t operator+(const Hexa_t& b1);
76  Hexa_t operator+(const Long64_t l1);
77  Hexa_t operator+(const Char_t* c1);
78 
81 
82  ClassDef(Hexa_t, 1) //a Hexadecimal number
83 };
84 
85 
103 
104 #endif
int Int_t
bool Bool_t
unsigned char UChar_t
char Char_t
float Float_t
double Double_t
#define ClassDef(name, id)
Hexadecimal numbers.
Definition: Hexa_t.h:15
Long64_t fVal
Definition: Hexa_t.h:17
Hexa_t operator+(const Hexa_t &b1)
Addition of two Hexa numbers.
Definition: Hexa_t.cpp:157
const Char_t * String(UChar_t nbits=0) const
Definition: Hexa_t.cpp:97
static void SetPrefix(const Char_t *pref)
_________________________________________//
Definition: Hexa_t.h:30
void Set(const Long64_t)
Set number corresponding to decimal value "val".
Definition: Hexa_t.cpp:47
Hexa_t & operator=(const Long64_t)
Assign a decimal value to the Hexa number.
Definition: Hexa_t.cpp:113
Hexa_t()
Create hexa number.
Definition: Hexa_t.cpp:14
Bool_t TestBit(UChar_t)
Definition: Hexa_t.cpp:312
static const Char_t * GetPrefix()
Definition: Hexa_t.h:34
Hexa_t(const Hexa_t &other)
Definition: Hexa_t.h:24
Long64_t Value() const
Get decimal value of number.
Definition: Hexa_t.cpp:58
void ResetBit(UChar_t)
Definition: Hexa_t.cpp:298
void SetBit(UChar_t, Long64_t=-1)
Definition: Hexa_t.cpp:276
virtual ~ Hexa_t()
Definition: Hexa_t.h:25
static TString fPrefix
the prefix used to represent hexadecimal numbers as strings
Definition: Hexa_t.h:18
const char * Data() const
long long Long64_t