vega
tag.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 #include <iostream>
5 #include <string>
6 
7 namespace vega {
15  class Tag {
16  public:
17  typedef uint16_t group_type;
18  typedef uint16_t element_type;
19  typedef uint32_t tag_type;
20 
21  static const tag_type ITEM_TAG;
22  static const tag_type ITEM_DELIMITATION_TAG;
23  static const tag_type SEQ_DELIMITATION_TAG;
24  static const tag_type PIXEL_DATA_TAG;
25 
26  static const Tag ITEM;
27  static const Tag ITEM_DELIMITATION;
28  static const Tag SEQ_DELIMITATION;
29  static const Tag PIXEL_DATA;
30 
31  private:
32  group_type m_group;
33  element_type m_element;
34 
35  public:
36  constexpr Tag()
37  : m_group(0),
38  m_element(0)
39  {}
40 
41  explicit constexpr Tag(tag_type tag)
42  : m_group(tag >> 16),
43  m_element(0xFFFF & tag)
44  {}
45 
46  explicit constexpr Tag(group_type group, element_type element)
47  : m_group(group),
48  m_element(element)
49  {}
50 
52  const group_type& group() const;
54  group_type& group();
56  const element_type& element() const;
58  element_type& element();
59 
60  tag_type tag() const;
61 
62  std::string str() const;
63 
64  bool is_file_meta() const;
65 
66  bool operator==(const Tag& other) const;
67  bool operator!=(const Tag& other) const;
68  bool operator<(const Tag& other) const;
69 
70  bool is_item_tag() const;
71  bool is_item_delimitation_tag() const;
72  bool is_sequence_delimitation_tag() const;
73  bool is_private() const;
74  bool is_private_owner() const;
75 
76  friend std::ostream& operator<<(std::ostream& os, const Tag& tag);
77  };
78 }
constexpr Tag()
Definition: tag.h:36
uint16_t element_type
Definition: tag.h:18
constexpr Tag(tag_type tag)
Definition: tag.h:41
bool is_private() const
friend std::ostream & operator<<(std::ostream &os, const Tag &tag)
bool is_item_tag() const
bool is_sequence_delimitation_tag() const
static const Tag SEQ_DELIMITATION
Definition: tag.h:28
bool is_item_delimitation_tag() const
constexpr Tag(group_type group, element_type element)
Definition: tag.h:46
tag_type tag() const
const group_type & group() const
bool is_private_owner() const
static const Tag PIXEL_DATA
Definition: tag.h:29
std::string str() const
static const tag_type ITEM_TAG
Definition: tag.h:21
static const tag_type PIXEL_DATA_TAG
Definition: tag.h:24
static const Tag ITEM
Definition: tag.h:26
uint32_t tag_type
Definition: tag.h:19
bool operator==(const Tag &other) const
static const tag_type ITEM_DELIMITATION_TAG
Definition: tag.h:22
Definition: age.h:6
const element_type & element() const
static const tag_type SEQ_DELIMITATION_TAG
Definition: tag.h:23
static const Tag ITEM_DELIMITATION
Definition: tag.h:27
bool operator<(const Tag &other) const
uint16_t group_type
Definition: tag.h:17
Class for working with DICOM data element tags.
Definition: tag.h:15
bool is_file_meta() const
bool operator!=(const Tag &other) const