BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/eformat/include/eformat/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:Andre.dos.Anjos@cern.ch">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, CALIBRATION = 0x01, COSMICS = 0x02, TEST = 0x0f };
24
25 /**
26 * An alias
27 */
28 typedef enum RunType RunType;
29
30 namespace helper {
31
32 /**
33 * Defines converters between version numbers and its components
34 */
35 class RunNumber {
36
37 public:
38 /**
39 * Constructor. Takes the components to form a run number
40 *
41 * @param type The run type (@see types.h)
42 * @param n The number 24-bits only are valid
43 */
44 RunNumber( eformat::RunType type, uint32_t n ) : m_type( type ), m_n( n ) {}
45
46 /**
47 * Constructor. Takes the run number to understand the components from.
48 *
49 * @param rn The run number, fully built.
50 * @warning This run number <b>has</b> to conform to the current
51 * version of the library or unpredictable results might occur.
52 */
53 RunNumber( uint32_t rn );
54
55 /**
56 * Extracts the major version part of this version
57 */
58 inline eformat::RunType type( void ) const { return m_type; }
59
60 /**
61 * Extracts the minor version part of this version
62 */
63 inline uint32_t number( void ) const { return m_n; }
64
65 /**
66 * Gets the full 32-bit number made by assembling the 2 numbers
67 * above.
68 */
69 uint32_t code( void ) const;
70
71 private: // representation
72 eformat::RunType m_type; ///< This run type
73 uint32_t m_n; ///< This run number
74 };
75
76 } // namespace helper
77
78} // namespace eformat
79
80#endif /* EFORMAT_RUNNUMBER_H */
const Int_t n
uint32_t code(void) const
Definition RunNumber.cxx:18
RunNumber(eformat::RunType type, uint32_t n)