GDCM: gdcmCSAHeaderDictEntry.h Source File

GDCM 3.2.7

gdcmCSAHeaderDictEntry.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14#ifndef GDCMCSAHEADERDICTENTRY_H
15#define GDCMCSAHEADERDICTENTRY_H
16
17#include "gdcmVR.h"
18#include "gdcmVM.h"
19
20#include <string>
21#include <iostream>
22#include <iomanip>
23
24#include <cstring>
25
26namespace gdcm
27{
38 class GDCM_EXPORT CSAHeaderDictEntry
39{
40public:
41 CSAHeaderDictEntry(const char *name = "", VR const &vr = VR::INVALID, VM const &vm = VM::VM0, const char *desc = ""):Name(name),ValueRepresentation(vr),ValueMultiplicity(vm),Description(desc) {
42 }
43
44 friend std::ostream& operator<<(std::ostream& _os, const CSAHeaderDictEntry &_val);
45
47 const VR &GetVR() const { return ValueRepresentation; }
48 void SetVR(const VR & vr) { ValueRepresentation = vr; }
49
51 const VM &GetVM() const { return ValueMultiplicity; }
52 void SetVM(VM const & vm) { ValueMultiplicity = vm; }
53
55 const char *GetName() const { return Name.c_str(); }
56 void SetName(const char* name) { Name = name; }
57
59 const char *GetDescription() const { return Description.c_str(); }
60 void SetDescription(const char* desc) { Description = desc; }
61
62 bool operator<(const CSAHeaderDictEntry &entry) const
63 {
64 return strcmp(GetName(),entry.GetName()) < 0;
65 }
66
67private:
68 std::string Name;
69 VR ValueRepresentation;
70 VM ValueMultiplicity;
71 std::string Description;
72 std::string Type; // TODO
73};
74
75
76//-----------------------------------------------------------------------------
77 inline std::ostream& operator<<(std::ostream& os, const CSAHeaderDictEntry &val)
78{
79 if( val.Name.empty() )
80 {
81 os << "[No name]";
82 }
83 else
84 {
85 os << val.Name;
86 }
87 os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity;
88 if( !val.Description.empty() )
89 {
90 os << "\t" << val.Description;
91 }
92 return os;
93}
94
95} // end namespace gdcm
96
97#endif //GDCMCSAHEADERDICTENTRY_H
gdcm::CSAHeaderDictEntry
Class to represent an Entry in the Dict.
Definition gdcmCSAHeaderDictEntry.h:39
gdcm::CSAHeaderDictEntry::GetName
const char * GetName() const
Set/Get Name.
Definition gdcmCSAHeaderDictEntry.h:55
gdcm::CSAHeaderDictEntry::SetDescription
void SetDescription(const char *desc)
Definition gdcmCSAHeaderDictEntry.h:60
gdcm::CSAHeaderDictEntry::GetVM
const VM & GetVM() const
Set/Get VM.
Definition gdcmCSAHeaderDictEntry.h:51
gdcm::CSAHeaderDictEntry::operator<
bool operator<(const CSAHeaderDictEntry &entry) const
Definition gdcmCSAHeaderDictEntry.h:62
gdcm::CSAHeaderDictEntry::CSAHeaderDictEntry
CSAHeaderDictEntry(const char *name="", VR const &vr=VR::INVALID, VM const &vm=VM::VM0, const char *desc="")
Definition gdcmCSAHeaderDictEntry.h:41
gdcm::CSAHeaderDictEntry::SetVR
void SetVR(const VR &vr)
Definition gdcmCSAHeaderDictEntry.h:48
gdcm::CSAHeaderDictEntry::GetDescription
const char * GetDescription() const
Set/Get Description.
Definition gdcmCSAHeaderDictEntry.h:59
gdcm::CSAHeaderDictEntry::GetVR
const VR & GetVR() const
Set/Get VR.
Definition gdcmCSAHeaderDictEntry.h:47
gdcm::CSAHeaderDictEntry::SetName
void SetName(const char *name)
Definition gdcmCSAHeaderDictEntry.h:56
gdcm::CSAHeaderDictEntry::SetVM
void SetVM(VM const &vm)
Definition gdcmCSAHeaderDictEntry.h:52
gdcm::Type
Type.
Definition gdcmType.h:42
gdcm::VM
Value Multiplicity Looking at the DICOMV3 dict only there is very few cases: 1 2 3 4 5 6 8 16 24 1-2 ...
Definition gdcmVM.h:68
gdcm::VM::VM0
@ VM0
Definition gdcmVM.h:71
gdcm::VR
VR class.
Definition gdcmVR.h:55
gdcm::VR::INVALID
@ INVALID
Definition gdcmVR.h:59
gdcmVM.h
gdcmVR.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88