GDCM: gdcmGroupDict.h Source File

GDCM 3.2.5

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{
33 class GDCM_EXPORT GroupDict
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 gdcm_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;
63 GroupStringVector Names;
64};
65//-----------------------------------------------------------------------------
66 inline 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
gdcm::GroupDict::Size
size_t Size() const
Definition gdcmGroupDict.h:42
gdcm::GroupDict::GroupDict
GroupDict()
Definition gdcmGroupDict.h:37
gdcm::GroupDict::Add
void Add(std::string const &abbreviation, std::string const &name)
gdcm::GroupDict::operator<<
friend std::ostream & operator<<(std::ostream &_os, const GroupDict &_val)
Definition gdcmGroupDict.h:66
gdcm::GroupDict::Insert
void Insert(uint16_t num, std::string const &abbreviation, std::string const &name)
gdcm::GroupDict::GroupStringVector
std::vector< std::string > GroupStringVector
Definition gdcmGroupDict.h:36
gdcm::GroupDict::GetAbbreviation
std::string const & GetAbbreviation(uint16_t num) const
gdcm::GroupDict::GetName
std::string const & GetName(uint16_t num) const
gdcm::GroupDict::~GroupDict
~GroupDict()=default
gdcm_assert
#define gdcm_assert(cond)
Definition gdcmException.h:104
gdcmTypes.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