00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00019
00020 #ifndef TrigConf_L1PSNumber
00021 #define TrigConf_L1PSNumber
00022
00023 #include <iosfwd>
00024 #include <string>
00025 #include <stdint.h>
00026
00027 namespace TrigConf {
00028
00029 class L1PSNumber {
00030 private:
00031 unsigned int n;
00032 unsigned int m;
00033 unsigned int d;
00034 int s;
00035 float psFloat;
00036 int64_t psLong;
00037
00038 static const uint32_t NMASK = 0x00FFFFFF;
00039 static const uint32_t MMASK = 0xF0000000;
00040 static const uint32_t DMASK = 0x0F000000;
00041 static const int MSHIFT = 28;
00042 static const int DSHIFT = 24;
00043
00044 bool validate(const int nn, const unsigned int mm,
00045 const unsigned int dd, const int ss);
00046 void setInt64(const int64_t tmpLong);
00047
00048 static int64_t makeLong(unsigned int n, unsigned int m, unsigned int d);
00049
00050
00051 static const int auxLength = 79;
00052 static const unsigned int psAuxValues[79][2];
00053
00054 public:
00055 L1PSNumber();
00056
00057 virtual ~L1PSNumber();
00058 L1PSNumber(const float ps);
00059 L1PSNumber(const int64_t ps);
00060 L1PSNumber(const int ps);
00061 L1PSNumber(const int nn, const unsigned int mm,
00062 unsigned const int dd, const int ss);
00063
00064 static int64_t decodeFloat(const float psF);
00065 static int64_t encodeNMD(const int nn, const unsigned int mm,
00066 const unsigned int dd);
00067 std::string write();
00068
00069
00070 unsigned int getN() const { return n; };
00071 unsigned int getM() const { return m; };
00072 unsigned int getD() const { return d; };
00073 int getSign() const { return s; };
00074 float getFloatPrescale() const { return psFloat; };
00075 int64_t getInt64() const { return psLong; };
00076 int getInt32() const { return n*s; };
00077
00078 };
00079 }
00080
00081 #endif
00082