GDCM  2.2.0
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 
26 namespace gdcm
27 {
39 {
40 public:
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 
67 private:
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

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo