vega
value_manipulator.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include <memory>
6 
7 #include "vega/vega.h"
8 #include "vega/dicom/raw_value.h"
9 
10 // Base abstract manipulator class
11 // Used for reading/writing
12 // Can be overridden to have more complicated manipulators,
13 // such as PixelDataManipulator, DecimalStringManipulator, or TypedManipulator<T>
14 // which offer useful ways of manipulating DICOM data (e.g. pixel_data(yi,xi) = value;)
15 namespace vega {
16  namespace dicom {
17  class RawReader;
18  class RawWriter;
19  }
20 
21  namespace manipulators {
22 
23  // NOTE: Implementations of this class should also implement
24  //
25  // template <>
26  // bool vr::manipulator_is_valid_for<T>(VR::value_type value);
27  //
28  // To return true if it is a valid VR
30  public:
31  virtual ~ValueManipulator() = 0;
32 
33  // Returns a RawValue that is suitable for writing/reading to/from DICOM
34  // Acts as a common link between different manipulators
35  virtual std::shared_ptr<dicom::RawValue> raw_value() = 0;
36  virtual std::string str() const = 0;
37  virtual bool read_from(dicom::RawReader* reader, size_t num_bytes) = 0;
38  virtual size_t write_to(dicom::RawWriter* writer) const = 0;
39  // Override for allowed VR
40  virtual bool is_valid_for(const VR& vr) const { return false; }
41 
42  virtual bool operator==(const ValueManipulator& other) const;
43  virtual bool operator!=(const ValueManipulator& other) const;
44  };
45  }
46 }
Definition: vr.h:13
Definition: value_manipulator.h:29
Definition: age.h:6
virtual bool is_valid_for(const VR &vr) const
Definition: value_manipulator.h:40