1 #include "gdcmCommon.h" //to shut up warnings
2 // Checks the basic functionalities of STL <map>.
7 int TestHash( int, char * [] )
9 std::cout << "Test::TestHash : " << std::endl;
10 std::cout << " Checks that the basic STL <map> functionalities required "
12 << " by gdcm are operational. " << std::endl;
14 typedef std::map<std::string, std::string> dict;
17 // Adding entries by key:
19 dict::iterator im = tb1.find("00380010");
20 tb1["00100010"] = "Patient Name";
21 tb1["7fe00010"] = "Pixel Data";
22 tb1["50000010"] = "Number of points";
23 tb1["00380010"] = "Admission ID";
25 // Travesing the dictionary:
27 std::cout << " Traversal of dictionary (note the proper ordering on key):"
29 for ( im = tb1.begin(); im != tb1.end(); ++im )
30 std::cout << " \"" << im->first << "\" = " << im->second
32 std::cout << " End of dictionary." << std::endl;
36 std::cout << " Find request on key 00380010" << std::endl;
37 im = tb1.find("00380010");
38 std::cout << " \"" << im->first << "\" = " << im->second << std::endl;
40 // The following should print in hexadecimal an in decimal the given
41 // integer as stated by:
42 // http://www.developer.com/net/cplus/article.php/10919_2119781_3
43 // Alas it doesn't work with g++ (at least)...
45 //std::cout.setf(std::ios::hex);
46 std::cout << "Test::TestHash : hexdecimal output : " << std::hex << i << std::endl;
47 //std::cout.setf(std::ios::dec);
48 std::cout << "Test::TestHash : decimal output : " << std::dec << i << std::endl;