GDCM 3.0.24
gdcmGroupDict.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
15#ifndef GDCMGROUPDICT_H
16#define GDCMGROUPDICT_H
17
18#include "gdcmTypes.h"
19
20#include <assert.h>
21#include <vector>
22#include <string>
23#include <iostream>
24#include <iomanip>
25
26namespace gdcm
27{
34{
35public:
36 typedef std::vector<std::string> GroupStringVector;
37 GroupDict() { FillDefaultGroupName(); }
38 ~GroupDict() = default;
39
40 friend std::ostream& operator<<(std::ostream& _os, const GroupDict &_val);
41
42 size_t Size() const
43 {
44 assert( Names.size() == Abbreviations.size() );
45 return Names.size(); }
46
47 std::string const &GetAbbreviation(uint16_t num) const;
48
49 std::string const &GetName(uint16_t num) const;
50
51protected:
52 void Add(std::string const &abbreviation, std::string const &name);
53 void Insert(uint16_t num, std::string const &abbreviation, std::string const &name);
54
55private:
56 // Generated implementation, see gdcmDefaultGroupNames
57 void FillDefaultGroupName();
58
59 GroupDict &operator=(const GroupDict &_val); // purposely not implemented
60 GroupDict(const GroupDict &_val); // purposely not implemented
61
62 GroupStringVector Abbreviations;
64};
65//-----------------------------------------------------------------------------
66inline std::ostream& operator<<(std::ostream& _os, const GroupDict &_val)
67{
68 size_t size = _val.Size();
69 for(size_t i=0; i<size; ++i)
70 {
71 _os << std::hex << std::setw(4) << std::setfill( '0' ) << i << ","
72 << _val.GetAbbreviation((uint16_t)i) << "," << _val.GetName((uint16_t)i) << "\n";
73 }
74 return _os;
75}
76
77} // end namespace gdcm
78
79#endif //GDCMGROUPDICT_H
Class to represent the mapping from group number to its abbreviation and name.
Definition gdcmGroupDict.h:34
size_t Size() const
Definition gdcmGroupDict.h:42
GroupDict()
Definition gdcmGroupDict.h:37
void Add(std::string const &abbreviation, std::string const &name)
void Insert(uint16_t num, std::string const &abbreviation, std::string const &name)
std::vector< std::string > GroupStringVector
Definition gdcmGroupDict.h:36
std::string const & GetAbbreviation(uint16_t num) const
std::string const & GetName(uint16_t num) const
~GroupDict()=default
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88