1 /*=========================================================================
4 Module: $RCSfile: TestEnumVR.cxx,v $
6 Date: $Date: 2005/11/10 18:02:26 $
7 Version: $Revision: 1.2 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 * Proof of concept for using enum instead of string for representing VR
21 * 1. Qickly check against another VR (faster than string comparison)
22 * 2. Support the advance VR like 'OB or OW'
55 US_SS_OW = US | SS | OW
58 static const char *VRStrings[] = {
91 int get_index_vr(VR vr)
108 for (l = 0; a > 1; ++l)
115 int TestEnumVR(int , char *[])
117 for(int i=0; i<26; i++)
120 int k = get_index_vr((VR)j);
121 std::cout << k << "," << VRStrings[k] << std::endl;
125 int k = get_index_vr(vr);
126 std::cout << k << "," << VRStrings[k] << std::endl;
128 k = get_index_vr(vr);
129 std::cout << k << "," << VRStrings[k] << std::endl;
131 k = get_index_vr(vr);
132 std::cout << k << "," << VRStrings[k] << std::endl;