gdcmVM.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 GDCMVM_H
#define GDCMVM_H
#include "gdcmTypes.h"
#include <iostream>
namespace gdcm
{
class GDCM_EXPORT VM
{
public:
typedef enum {
VM0 = 0, // aka the invalid VM
VM1 = 1,
VM2 = 2,
VM3 = 4,
VM4 = 8,
VM5 = 16,
VM6 = 32,
VM8 = 64,
VM9 = 128,
VM10 = 256,
VM12 = 512, //1024,
VM16 = 1024, //2048,
VM18 = 2048, //4096,
VM24 = 4096, //8192,
VM28 = 8192, //16384,
VM32 = 16384, //32768,
VM35 = 32768, //65536,
VM99 = 65536, //131072,
VM256 = 131072, //262144,
VM1_2 = VM1 | VM2,
VM1_3 = VM1 | VM2 | VM3,
VM1_4 = VM1 | VM2 | VM3 | VM4,
VM1_5 = VM1 | VM2 | VM3 | VM4 | VM5,
VM1_8 = VM1 | VM2 | VM3 | VM4 | VM5 | VM6 | VM8,
// The following need some work:
VM1_32 = VM1 | VM2 | VM3 | VM4 | VM5 | VM6 | VM8 | VM9 | VM16 | VM24 | VM32,
VM1_99 = VM1 | VM2 | VM3 | VM4 | VM5 | VM6 | VM8 | VM9 | VM16 | VM24 | VM32 | VM99,
VM1_n = VM1 | VM2 | VM3 | VM4 | VM5 | VM6 | VM8 | VM9 | VM16 | VM24 | VM32 | VM99 | VM256,
VM2_2n = VM2 | VM4 | VM6 | VM8 | VM16 | VM24 | VM32 | VM256,
VM2_n = VM2 | VM3 | VM4 | VM5 | VM6 | VM8 | VM9 | VM16 | VM24 | VM32 | VM99 | VM256,
VM3_4 = VM3 | VM4,
VM3_3n = VM3 | VM6 | VM9 | VM24 | VM99 | VM256,
VM3_n = VM3 | VM4 | VM5 | VM6 | VM8 | VM9 | VM16 | VM24 | VM32 | VM99 | VM256,
VM4_4n = VM4 | VM16 | VM24 | VM32 | VM256,
VM6_6n = VM6 | VM12 | VM18 | VM24 ,
VM6_n = VM6 | VM8 | VM9 | VM16 | VM24 | VM32 | VM99 | VM256,
VM7_7n,
VM30_30n,
VM47_47n,
VM_END = VM1_n + 1 // Custom tag to count number of entry
} VMType;
static const char* GetVMString(VMType vm);
static VMType GetVMType(const char *vm);
static bool IsValid(int vm1, VMType vm2);
//bool IsValid() { return VMField != VM0 && VMField < VM_END; }
bool Compatible(VM const &vm) const;
static VMType GetVMTypeFromLength(size_t length, unsigned int size);
static size_t GetNumberOfElementsFromArray(const char *array, size_t length);
VM(VMType type = VM0):VMField(type) {}
operator VMType () const { return VMField; }
unsigned int GetLength() const;
friend std::ostream &operator<<(std::ostream &os, const VM &vm);
protected:
static unsigned int GetIndex(VMType vm);
private:
VMType VMField;
};
//-----------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream& _os, const VM &_val)
{
assert( VM::GetVMString(_val) );
_os << VM::GetVMString(_val);
return _os;
}
//template <int TVM> struct LengthToVM;
//template <> struct LengthToVM<1>
//{ enum { TVM = VM::VM1 }; };
template<int T> struct VMToLength;
#define TYPETOLENGTH(type,length) \
template<> struct VMToLength<VM::type> \
{ enum { Length = length }; };
// TODO: Could be generated from XML file
//TYPETOLENGTH(VM0,1)
TYPETOLENGTH(VM1,1)
TYPETOLENGTH(VM2,2)
TYPETOLENGTH(VM3,3)
TYPETOLENGTH(VM4,4)
TYPETOLENGTH(VM5,5)
TYPETOLENGTH(VM6,6)
TYPETOLENGTH(VM8,8)
TYPETOLENGTH(VM9,9)
TYPETOLENGTH(VM10,10)
TYPETOLENGTH(VM12,12)
TYPETOLENGTH(VM16,16)
TYPETOLENGTH(VM18,18)
TYPETOLENGTH(VM24,24)
TYPETOLENGTH(VM28,28)
TYPETOLENGTH(VM32,32)
TYPETOLENGTH(VM35,35)
TYPETOLENGTH(VM99,99)
TYPETOLENGTH(VM256,256)
//TYPETOLENGTH(VM1_2,2)
//TYPETOLENGTH(VM1_3,3)
//TYPETOLENGTH(VM1_8,8)
//TYPETOLENGTH(VM1_32,32)
//TYPETOLENGTH(VM1_99,99)
//TYPETOLENGTH(VM1_n,
//TYPETOLENGTH(VM2_2n,
//TYPETOLENGTH(VM2_n,
//TYPETOLENGTH(VM3_3n,
//TYPETOLENGTH(VM3_n,
} // end namespace gdcm
#endif //GDCMVM_H
gdcm::VM::VMType
VMType
Definition gdcmVM.h:70
gdcm::VM::VM1_n
@ VM1_n
Definition gdcmVM.h:98
gdcm::VM::VM6
@ VM6
Definition gdcmVM.h:77
gdcm::VM::VM6_n
@ VM6_n
Definition gdcmVM.h:106
gdcm::VM::VM1_8
@ VM1_8
Definition gdcmVM.h:94
gdcm::VM::VM8
@ VM8
Definition gdcmVM.h:78
gdcm::VM::VM47_47n
@ VM47_47n
Definition gdcmVM.h:109
gdcm::VM::VM12
@ VM12
Definition gdcmVM.h:81
gdcm::VM::VM3
@ VM3
Definition gdcmVM.h:74
gdcm::VM::VM3_4
@ VM3_4
Definition gdcmVM.h:101
gdcm::VM::VM_END
@ VM_END
Definition gdcmVM.h:110
gdcm::VM::VM2_2n
@ VM2_2n
Definition gdcmVM.h:99
gdcm::VM::VM2
@ VM2
Definition gdcmVM.h:73
gdcm::VM::VM0
@ VM0
Definition gdcmVM.h:71
gdcm::VM::VM4
@ VM4
Definition gdcmVM.h:75
gdcm::VM::VM16
@ VM16
Definition gdcmVM.h:82
gdcm::VM::VM1_3
@ VM1_3
Definition gdcmVM.h:91
gdcm::VM::VM256
@ VM256
Definition gdcmVM.h:89
gdcm::VM::VM32
@ VM32
Definition gdcmVM.h:86
gdcm::VM::VM28
@ VM28
Definition gdcmVM.h:85
gdcm::VM::VM3_n
@ VM3_n
Definition gdcmVM.h:103
gdcm::VM::VM1_99
@ VM1_99
Definition gdcmVM.h:97
gdcm::VM::VM1_2
@ VM1_2
Definition gdcmVM.h:90
gdcm::VM::VM7_7n
@ VM7_7n
Definition gdcmVM.h:107
gdcm::VM::VM99
@ VM99
Definition gdcmVM.h:88
gdcm::VM::VM9
@ VM9
Definition gdcmVM.h:79
gdcm::VM::VM1_5
@ VM1_5
Definition gdcmVM.h:93
gdcm::VM::VM24
@ VM24
Definition gdcmVM.h:84
gdcm::VM::VM10
@ VM10
Definition gdcmVM.h:80
gdcm::VM::VM30_30n
@ VM30_30n
Definition gdcmVM.h:108
gdcm::VM::VM2_n
@ VM2_n
Definition gdcmVM.h:100
gdcm::VM::VM5
@ VM5
Definition gdcmVM.h:76
gdcm::VM::VM1_4
@ VM1_4
Definition gdcmVM.h:92
gdcm::VM::VM18
@ VM18
Definition gdcmVM.h:83
gdcm::VM::VM35
@ VM35
Definition gdcmVM.h:87
gdcm::VM::VM1
@ VM1
Definition gdcmVM.h:72
gdcm::VM::VM4_4n
@ VM4_4n
Definition gdcmVM.h:104
gdcm::VM::VM6_6n
@ VM6_6n
Definition gdcmVM.h:105
gdcm::VM::VM3_3n
@ VM3_3n
Definition gdcmVM.h:102
gdcm::VM::VM1_32
@ VM1_32
Definition gdcmVM.h:96
gdcm::VM::operator<<
friend std::ostream & operator<<(std::ostream &os, const VM &vm)
Definition gdcmVM.h:144
gdcm::VM::IsValid
static bool IsValid(int vm1, VMType vm2)
gdcm::VM::GetNumberOfElementsFromArray
static size_t GetNumberOfElementsFromArray(const char *array, size_t length)
gdcm::VM::GetVMType
static VMType GetVMType(const char *vm)
gdcm::VM::GetVMString
static const char * GetVMString(VMType vm)
gdcm::VM::GetLength
unsigned int GetLength() const
gdcm::VM::GetIndex
static unsigned int GetIndex(VMType vm)
gdcm::VM::Compatible
bool Compatible(VM const &vm) const
gdcm::VM::GetVMTypeFromLength
static VMType GetVMTypeFromLength(size_t length, unsigned int size)
gdcm::VM::VM
VM(VMType type=VM0)
Definition gdcmVM.h:132
gdcmTypes.h
TYPETOLENGTH
#define TYPETOLENGTH(type, length)
Definition gdcmVM.h:156
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
gdcm::VMToLength
Definition gdcmVM.h:155