vega
decimal_string_manipulator.h
Go to the documentation of this file.
1 #pragma once
2 
4 
5 namespace vega {
6  class DecimalString {
7  private:
8  double m_double;
9 
10  public:
11  explicit DecimalString();
12 
13  // Allow conversion from arbitrary type if allowed
14  template <typename T>
15  DecimalString(const T& t) : m_double(t) {}
16  DecimalString(const std::string& s);
17 
18  operator double() const;
19  operator float() const;
20 
21  bool operator ==(const DecimalString& ds) const;
22  bool operator !=(const DecimalString& ds) const;
23 
24  std::string str() const;
25  };
26 
27  namespace manipulators {
28  class DecimalStringManipulator : public PaddedStringManipulator<DecimalString> {
30 
31  public:
32  virtual bool is_valid_for(const VR& vr) const override {
33  return vr == vr::DS;
34  }
35  };
36  }
37 
38  namespace vr {
39  template <>
40  bool manipulator_is_valid_for<manipulators::DecimalStringManipulator>(VR::value_type value);
41  }
42 }
DecimalString(const T &t)
Definition: decimal_string_manipulator.h:15
const VR DS
Definition: vr_constants.h:163
Definition: decimal_string_manipulator.h:6
Definition: vr.h:13
bool operator==(const DecimalString &ds) const
uint16_t value_type
Definition: vr.h:29
virtual bool is_valid_for(const VR &vr) const override
Definition: decimal_string_manipulator.h:32
Definition: decimal_string_manipulator.h:28
bool operator!=(const DecimalString &ds) const
Definition: age.h:6
A manipulator class for VR that represent elements which are encoded in DICOM using strings...
Definition: padded_string_manipulator.h:89
std::string str() const