gdcmCSAHeaderDictEntry.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMCSAHEADERDICTENTRY_H
#define GDCMCSAHEADERDICTENTRY_H
#include "gdcmVR.h"
#include "gdcmVM.h"
#include <string>
#include <iostream>
#include <iomanip>
#include <cstring>
namespace gdcm
{
class GDCM_EXPORT CSAHeaderDictEntry
{
public:
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) {
}
friend std::ostream& operator<<(std::ostream& _os, const CSAHeaderDictEntry &_val);
const VR &GetVR() const { return ValueRepresentation; }
void SetVR(const VR & vr) { ValueRepresentation = vr; }
const VM &GetVM() const { return ValueMultiplicity; }
void SetVM(VM const & vm) { ValueMultiplicity = vm; }
const char *GetName() const { return Name.c_str(); }
void SetName(const char* name) { Name = name; }
const char *GetDescription() const { return Description.c_str(); }
void SetDescription(const char* desc) { Description = desc; }
bool operator<(const CSAHeaderDictEntry &entry) const
{
return strcmp(GetName(),entry.GetName()) < 0;
}
private:
std::string Name;
VR ValueRepresentation;
VM ValueMultiplicity;
std::string Description;
std::string Type; // TODO
};
//-----------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream& os, const CSAHeaderDictEntry &val)
{
if( val.Name.empty() )
{
os << "[No name]";
}
else
{
os << val.Name;
}
os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity;
if( !val.Description.empty() )
{
os << "\t" << val.Description;
}
return os;
}
} // end namespace gdcm
#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