DP3
PrettyUnits.h
Go to the documentation of this file.
1 // PrettyUnits.h - Print units in a human-readable way
2 //
3 // Copyright (C) 2020 ASTRON (Netherlands Institute for Radio Astronomy)
4 // SPDX-License-Identifier: GPL-3.0-or-later
5 
6 #ifndef LOFAR_COMMON_PRETTY_UNITS_H
7 #define LOFAR_COMMON_PRETTY_UNITS_H
8 
9 #include <string>
10 
11 namespace dp3 {
12 namespace common {
13 
15 class PrettyUnits : public std::string {
16  protected:
17  PrettyUnits(double value, const char *unit, unsigned precision);
18 };
19 
21 class PrettyTime : public PrettyUnits {
22  public:
23  PrettyTime(double seconds = 0, unsigned precision = 3)
24  : PrettyUnits(seconds, "s", precision) {}
25 };
26 
28 class PrettyFrequency : public PrettyUnits {
29  public:
30  PrettyFrequency(double frequency = 0, unsigned precision = 3)
31  : PrettyUnits(frequency, "Hz", precision) {}
32 };
33 
34 } // namespace common
35 } // namespace dp3
36 
37 #endif
Print frequency in a human-readable way.
Definition: PrettyUnits.h:28
PrettyFrequency(double frequency=0, unsigned precision=3)
Definition: PrettyUnits.h:30
Print time in a human-readable way.
Definition: PrettyUnits.h:21
PrettyTime(double seconds=0, unsigned precision=3)
Definition: PrettyUnits.h:23
Print units in a human-readable way.
Definition: PrettyUnits.h:15
PrettyUnits(double value, const char *unit, unsigned precision)
This file has generic helper routines for testing steps.
Definition: AntennaConfig.h:53