BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
RunNumber.h
Go to the documentation of this file.
1//Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/RunNumber.h
5 * @author <a href="mailto:[email protected]">Andre DOS ANJOS</a>
6 * $Author: zhangy $
7 * $Revision: 1.1.1.1 $
8 * $Date: 2009/06/19 07:35:41 $
9 *
10 * @brief A helper class to aid in composing valid run numbers
11 */
12
13#ifndef EFORMAT_RUNNUMBER_H
14#define EFORMAT_RUNNUMBER_H
15
16#include <stdint.h>
17
18namespace eformat {
19
20 /**
21 * Physics Types
22 */
23 enum RunType { PHYSICS = 0x00,
25 COSMICS = 0x02,
26 TEST = 0x0f};
27
28 /**
29 * An alias
30 */
31 typedef enum RunType RunType;
32
33 namespace helper {
34
35 /**
36 * Defines converters between version numbers and its components
37 */
38 class RunNumber {
39
40 public:
41 /**
42 * Constructor. Takes the components to form a run number
43 *
44 * @param type The run type (@see types.h)
45 * @param n The number 24-bits only are valid
46 */
48 : m_type(type), m_n(n) {}
49
50 /**
51 * Constructor. Takes the run number to understand the components from.
52 *
53 * @param rn The run number, fully built.
54 * @warning This run number <b>has</b> to conform to the current
55 * version of the library or unpredictable results might occur.
56 */
57 RunNumber (uint32_t rn);
58
59 /**
60 * Extracts the major version part of this version
61 */
62 inline eformat::RunType type (void) const { return m_type; }
63
64 /**
65 * Extracts the minor version part of this version
66 */
67 inline uint32_t number (void) const { return m_n; }
68
69 /**
70 * Gets the full 32-bit number made by assembling the 2 numbers
71 * above.
72 */
73 uint32_t code (void) const;
74
75 private: //representation
76
77 eformat::RunType m_type; ///< This run type
78 uint32_t m_n; ///< This run number
79
80 };
81
82 }
83
84}
85
86#endif /* EFORMAT_RUNNUMBER_H */
uint32_t code(void) const
Definition: RunNumber.cxx:21
eformat::RunType type(void) const
Definition: RunNumber.h:62
uint32_t number(void) const
Definition: RunNumber.h:67
RunNumber(eformat::RunType type, uint32_t n)
Definition: RunNumber.h:47
@ TEST
Definition: RunNumber.h:26
@ PHYSICS
Definition: RunNumber.h:23
@ COSMICS
Definition: RunNumber.h:25
@ CALIBRATION
Definition: RunNumber.h:24