KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
Hexa_t.h
Go to the documentation of this file.
1 #ifndef __HEXA_T__
2 #define __HEXA_T__
3 
4 #include "Rtypes.h"
5 #include "Riostream.h"
6 #include "TString.h"
7 
14 class Hexa_t {
15 private:
17  static TString fPrefix;
18 
19 public:
20  Hexa_t();
21  Hexa_t(const Long64_t);
22  Hexa_t(const Char_t*);
23  Hexa_t(const Hexa_t& other) : fVal(other.fVal) {}
24  virtual ~ Hexa_t()
25  {
26  };
28 
29  static void SetPrefix(const Char_t* pref)
30  {
31  fPrefix = pref;
32  };
33  static const Char_t* GetPrefix()
34  {
35  return fPrefix.Data();
36  };
37 
38  void Set(const Long64_t);
39  Long64_t Value() const;
40  void Set(const Char_t*);
41  const Char_t* String(UChar_t nbits = 0) const;
42 
43  void SetBit(UChar_t, Long64_t = -1);
44  void ResetBit(UChar_t);
46 
47  Hexa_t& operator=(const Long64_t);
48  Hexa_t& operator=(const Char_t*);
50  Hexa_t& operator=(const Hexa_t&);
52  operator Int_t() const
53  {
54  return (Int_t) Value();
55  };
56  operator Long64_t() const
57  {
58  return Value();
59  };
60  operator Float_t() const
61  {
62  return (Float_t) Value();
63  };
64  operator Double_t() const
65  {
66  return (Double_t) Value();
67  };
68  operator const char* () const
69  {
70  return String();
71  };
72 
73  Hexa_t operator+(const Hexa_t& b1);
75  Hexa_t operator+(const Long64_t l1);
76  Hexa_t operator+(const Char_t* c1);
77 
80 
81  ClassDef(Hexa_t, 1) //a Hexadecimal number
82 };
83 
84 
102 
103 #endif
int Int_t
unsigned char UChar_t
char Char_t
bool Bool_t
double Double_t
float Float_t
#define ClassDef(name, id)
Hexadecimal numbers.
Definition: Hexa_t.h:14
Long64_t fVal
Definition: Hexa_t.h:16
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:29
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:33
Hexa_t(const Hexa_t &other)
Definition: Hexa_t.h:23
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:24
static TString fPrefix
the prefix used to represent hexadecimal numbers as strings
Definition: Hexa_t.h:17
const char * Data() const
long long Long64_t